diff --git a/gapic-libraries-bom/pom.xml b/gapic-libraries-bom/pom.xml index 03a22b1d67fd..0927f2eb891d 100644 --- a/gapic-libraries-bom/pom.xml +++ b/gapic-libraries-bom/pom.xml @@ -763,6 +763,13 @@ pom import + + com.google.cloud + google-cloud-policysimulator-bom + 0.0.1-SNAPSHOT + pom + import + com.google.cloud google-cloud-policy-troubleshooter-bom diff --git a/java-policysimulator/.OwlBot.yaml b/java-policysimulator/.OwlBot.yaml new file mode 100644 index 000000000000..f7d95f431009 --- /dev/null +++ b/java-policysimulator/.OwlBot.yaml @@ -0,0 +1,36 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +deep-remove-regex: +- "/java-policysimulator/grpc-google-.*/src" +- "/java-policysimulator/proto-google-.*/src" +- "/java-policysimulator/google-.*/src" +- "/java-policysimulator/samples/snippets/generated" + +deep-preserve-regex: +- "/java-policysimulator/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java" + +deep-copy-regex: +- source: "/google/cloud/policysimulator/(v.*)/.*-java/proto-google-.*/src" + dest: "/owl-bot-staging/java-policysimulator/$1/proto-google-cloud-policysimulator-$1/src" +- source: "/google/cloud/policysimulator/(v.*)/.*-java/grpc-google-.*/src" + dest: "/owl-bot-staging/java-policysimulator/$1/grpc-google-cloud-policysimulator-$1/src" +- source: "/google/cloud/policysimulator/(v.*)/.*-java/gapic-google-.*/src" + dest: "/owl-bot-staging/java-policysimulator/$1/google-cloud-policysimulator/src" +- source: "/google/cloud/policysimulator/(v.*)/.*-java/samples/snippets/generated" + dest: "/owl-bot-staging/java-policysimulator/$1/samples/snippets/generated" + + +api-name: policysimulator \ No newline at end of file diff --git a/java-policysimulator/.repo-metadata.json b/java-policysimulator/.repo-metadata.json new file mode 100644 index 000000000000..a3d8f4eeed3d --- /dev/null +++ b/java-policysimulator/.repo-metadata.json @@ -0,0 +1,16 @@ +{ + "api_shortname": "policysimulator", + "name_pretty": "Policy Simulator API", + "product_documentation": "https://cloud.google.com/policysimulator/docs/overview", + "api_description": "Policy Simulator is a collection of endpoints for creating, running, and viewing a Replay.", + "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-policysimulator/latest/overview", + "release_level": "preview", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-policysimulator", + "repo_short": "java-policysimulator", + "distribution_name": "com.google.cloud:google-cloud-policysimulator", + "api_id": "policysimulator.googleapis.com", + "library_type": "GAPIC_AUTO", + "requires_billing": true +} \ No newline at end of file diff --git a/java-policysimulator/README.md b/java-policysimulator/README.md new file mode 100644 index 000000000000..29cfc2d88e3a --- /dev/null +++ b/java-policysimulator/README.md @@ -0,0 +1,225 @@ +# Google Policy Simulator API Client for Java + +Java idiomatic client for [Policy Simulator API][product-docs]. + +[![Maven][maven-version-image]][maven-version-link] +![Stability][stability-image] + +- [Product Documentation][product-docs] +- [Client Library Documentation][javadocs] + +> Note: This client is a work-in-progress, and may occasionally +> make backwards-incompatible changes. + + +## Quickstart + + +If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: + +```xml + + + + com.google.cloud + libraries-bom + 26.19.0 + pom + import + + + + + + + com.google.cloud + google-cloud-policysimulator + +``` + +If you are using Maven without the BOM, add this to your dependencies: + + + +```xml + + com.google.cloud + google-cloud-policysimulator + 0.0.0 + +``` + +If you are using Gradle without BOM, add this to your dependencies: + +```Groovy +implementation 'com.google.cloud:google-cloud-policysimulator:0.0.0' +``` + +If you are using SBT, add this to your dependencies: + +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-policysimulator" % "0.0.0" +``` + + +## Authentication + +See the [Authentication][authentication] section in the base directory's README. + +## Authorization + +The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired Policy Simulator API APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the Policy Simulator API API calls. + +## Getting Started + +### Prerequisites + +You will need a [Google Cloud Platform Console][developer-console] project with the Policy Simulator API [API enabled][enable-api]. +You will need to [enable billing][enable-billing] to use Google Policy Simulator API. +[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by +[installing the Google Cloud Command Line Interface][cloud-cli] and running the following commands in command line: +`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. + +### Installation and setup + +You'll need to obtain the `google-cloud-policysimulator` library. See the [Quickstart](#quickstart) section +to add `google-cloud-policysimulator` as a dependency in your code. + +## About Policy Simulator API + + +[Policy Simulator API][product-docs] Policy Simulator is a collection of endpoints for creating, running, and viewing a Replay. + +See the [Policy Simulator API client library docs][javadocs] to learn how to +use this Policy Simulator API Client Library. + + + + + + +## Troubleshooting + +To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. + +## Transport + +Policy Simulator API uses gRPC for the transport layer. + +## Supported Java Versions + +Java 8 or above is required for using this client. + +Google's Java client libraries, +[Google Cloud Client Libraries][cloudlibs] +and +[Google Cloud API Libraries][apilibs], +follow the +[Oracle Java SE support roadmap][oracle] +(see the Oracle Java SE Product Releases section). + +### For new development + +In general, new feature development occurs with support for the lowest Java +LTS version covered by Oracle's Premier Support (which typically lasts 5 years +from initial General Availability). If the minimum required JVM for a given +library is changed, it is accompanied by a [semver][semver] major release. + +Java 11 and (in September 2021) Java 17 are the best choices for new +development. + +### Keeping production systems current + +Google tests its client libraries with all current LTS versions covered by +Oracle's Extended Support (which typically lasts 8 years from initial +General Availability). + +#### Legacy support + +Google's client libraries support legacy versions of Java runtimes with long +term stable libraries that don't receive feature updates on a best efforts basis +as it may not be possible to backport all patches. + +Google provides updates on a best efforts basis to apps that continue to use +Java 7, though apps might need to upgrade to current versions of the library +that supports their JVM. + +#### Where to find specific information + +The latest versions and the supported Java versions are identified on +the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` +and on [google-cloud-java][g-c-j]. + +## 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 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] + +Java is a registered trademark of Oracle and/or its affiliates. + +[product-docs]: https://cloud.google.com/policysimulator/docs/overview +[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-policysimulator/latest/overview +[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java7.svg +[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java7.html +[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java8.svg +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java8-win.svg +[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java8-win.html +[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java11.svg +[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-policysimulator/java11.html +[stability-image]: https://img.shields.io/badge/stability-preview-yellow +[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-policysimulator.svg +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-policysimulator/0.0.0 +[authentication]: https://github.com/googleapis/google-cloud-java#authentication +[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes +[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles +[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy +[developer-console]: https://console.developers.google.com/ +[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects +[cloud-cli]: https://cloud.google.com/cli +[troubleshooting]: https://github.com/googleapis/google-cloud-java/blob/main/TROUBLESHOOTING.md +[contributing]: https://github.com/googleapis/java-policysimulator/blob/main/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/java-policysimulator/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/java-policysimulator/blob/main/LICENSE +[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing +[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=policysimulator.googleapis.com +[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png + +[semver]: https://semver.org/ +[cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained +[apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries +[oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html +[g-c-j]: http://github.com/googleapis/google-cloud-java diff --git a/java-policysimulator/google-cloud-policysimulator-bom/pom.xml b/java-policysimulator/google-cloud-policysimulator-bom/pom.xml new file mode 100644 index 000000000000..f397aec0a7e7 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator-bom/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + com.google.cloud + google-cloud-policysimulator-bom + 0.0.1-SNAPSHOT + pom + + + com.google.cloud + google-cloud-pom-parent + 1.16.0-SNAPSHOT + ../../google-cloud-pom-parent/pom.xml + + + Google Policy Simulator API BOM + + BOM for Policy Simulator API + + + + true + + + + + + com.google.cloud + google-cloud-policysimulator + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-policysimulator-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-policysimulator-v1 + 0.0.1-SNAPSHOT + + + + diff --git a/java-policysimulator/google-cloud-policysimulator/pom.xml b/java-policysimulator/google-cloud-policysimulator/pom.xml new file mode 100644 index 000000000000..7c00bd853674 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/pom.xml @@ -0,0 +1,113 @@ + + + 4.0.0 + com.google.cloud + google-cloud-policysimulator + 0.0.1-SNAPSHOT + jar + Google Policy Simulator API + Policy Simulator API Policy Simulator is a collection of endpoints for creating, running, and viewing a Replay. + + com.google.cloud + google-cloud-policysimulator-parent + 0.0.1-SNAPSHOT + + + google-cloud-policysimulator + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + com.google.api.grpc + proto-google-cloud-policysimulator-v1 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + com.google.api + gax-httpjson + + + com.google.api.grpc + grpc-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api.grpc + grpc-google-iam-v1 + + + org.threeten + threetenbp + + + + + junit + junit + test + + + + com.google.api.grpc + grpc-google-cloud-policysimulator-v1 + test + + + + com.google.api + gax + testlib + test + + + com.google.api + gax-grpc + testlib + test + + + com.google.api + gax-httpjson + testlib + test + + + diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/SimulatorClient.java b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/SimulatorClient.java new file mode 100644 index 000000000000..2b000e53bb8c --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/SimulatorClient.java @@ -0,0 +1,758 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.policysimulator.v1.stub.SimulatorStub; +import com.google.cloud.policysimulator.v1.stub.SimulatorStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Policy Simulator API service. + * + *

Policy Simulator is a collection of endpoints for creating, running, and viewing a + * [Replay][google.cloud.policysimulator.v1.Replay]. A + * [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that lets you see how + * your principals' access to resources might change if you changed your IAM policy. + * + *

During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator re-evaluates, or + * replays, past access attempts under both the current policy and your proposed policy, and + * compares those results to determine how your principals' access might change under the proposed + * policy. + * + *

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

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+ *   ReplayName name =
+ *       ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]");
+ *   Replay response = simulatorClient.getReplay(name);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the SimulatorClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of SimulatorSettings to create(). + * For example: + * + *

To customize credentials: + * + *

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

To customize the endpoint: + * + *

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

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

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

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class SimulatorClient implements BackgroundResource { + private final SimulatorSettings settings; + private final SimulatorStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of SimulatorClient with default settings. */ + public static final SimulatorClient create() throws IOException { + return create(SimulatorSettings.newBuilder().build()); + } + + /** + * Constructs an instance of SimulatorClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final SimulatorClient create(SimulatorSettings settings) throws IOException { + return new SimulatorClient(settings); + } + + /** + * Constructs an instance of SimulatorClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(SimulatorSettings). + */ + public static final SimulatorClient create(SimulatorStub stub) { + return new SimulatorClient(stub); + } + + /** + * Constructs an instance of SimulatorClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected SimulatorClient(SimulatorSettings settings) throws IOException { + this.settings = settings; + this.stub = ((SimulatorStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected SimulatorClient(SimulatorStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final SimulatorSettings getSettings() { + return settings; + } + + public SimulatorStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each `Replay` is available + * for at least 7 days. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   ReplayName name =
+   *       ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]");
+   *   Replay response = simulatorClient.getReplay(name);
+   * }
+   * }
+ * + * @param name Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay] to + * retrieve, in the following format: + *

`{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`, + * where `{resource-id}` is the ID of the project, folder, or organization that owns the + * `Replay`. + *

Example: + * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Replay getReplay(ReplayName name) { + GetReplayRequest request = + GetReplayRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getReplay(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each `Replay` is available + * for at least 7 days. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   String name =
+   *       ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]").toString();
+   *   Replay response = simulatorClient.getReplay(name);
+   * }
+   * }
+ * + * @param name Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay] to + * retrieve, in the following format: + *

`{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`, + * where `{resource-id}` is the ID of the project, folder, or organization that owns the + * `Replay`. + *

Example: + * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Replay getReplay(String name) { + GetReplayRequest request = GetReplayRequest.newBuilder().setName(name).build(); + return getReplay(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each `Replay` is available + * for at least 7 days. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   GetReplayRequest request =
+   *       GetReplayRequest.newBuilder()
+   *           .setName(
+   *               ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]")
+   *                   .toString())
+   *           .build();
+   *   Replay response = simulatorClient.getReplay(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Replay getReplay(GetReplayRequest request) { + return getReplayCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each `Replay` is available + * for at least 7 days. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   GetReplayRequest request =
+   *       GetReplayRequest.newBuilder()
+   *           .setName(
+   *               ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = simulatorClient.getReplayCallable().futureCall(request);
+   *   // Do something.
+   *   Replay response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getReplayCallable() { + return stub.getReplayCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given + * [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   String parent = "parent-995424086";
+   *   Replay replay = Replay.newBuilder().build();
+   *   Replay response = simulatorClient.createReplayAsync(parent, replay).get();
+   * }
+   * }
+ * + * @param parent Required. The parent resource where this + * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This resource must be a + * project, folder, or organization with a location. + *

Example: `projects/my-example-project/locations/global` + * @param replay Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create. Set + * `Replay.ReplayConfig` to configure the replay. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createReplayAsync( + String parent, Replay replay) { + CreateReplayRequest request = + CreateReplayRequest.newBuilder().setParent(parent).setReplay(replay).build(); + return createReplayAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given + * [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   CreateReplayRequest request =
+   *       CreateReplayRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setReplay(Replay.newBuilder().build())
+   *           .build();
+   *   Replay response = simulatorClient.createReplayAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createReplayAsync( + CreateReplayRequest request) { + return createReplayOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given + * [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   CreateReplayRequest request =
+   *       CreateReplayRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setReplay(Replay.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       simulatorClient.createReplayOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Replay response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + createReplayOperationCallable() { + return stub.createReplayOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using the given + * [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   CreateReplayRequest request =
+   *       CreateReplayRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setReplay(Replay.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = simulatorClient.createReplayCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createReplayCallable() { + return stub.createReplayCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   ReplayName parent =
+   *       ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]");
+   *   for (ReplayResult element : simulatorClient.listReplayResults(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose results are + * listed, in the following format: + *

`{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}` + *

Example: + * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListReplayResultsPagedResponse listReplayResults(ReplayName parent) { + ListReplayResultsRequest request = + ListReplayResultsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listReplayResults(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   String parent =
+   *       ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]").toString();
+   *   for (ReplayResult element : simulatorClient.listReplayResults(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose results are + * listed, in the following format: + *

`{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}` + *

Example: + * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListReplayResultsPagedResponse listReplayResults(String parent) { + ListReplayResultsRequest request = + ListReplayResultsRequest.newBuilder().setParent(parent).build(); + return listReplayResults(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay]. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   ListReplayResultsRequest request =
+   *       ListReplayResultsRequest.newBuilder()
+   *           .setParent(
+   *               ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]")
+   *                   .toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (ReplayResult element : simulatorClient.listReplayResults(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListReplayResultsPagedResponse listReplayResults(ListReplayResultsRequest request) { + return listReplayResultsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the results of running a [Replay][google.cloud.policysimulator.v1.Replay]. + * + *

Sample code: + * + *

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

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+   *   ListReplayResultsRequest request =
+   *       ListReplayResultsRequest.newBuilder()
+   *           .setParent(
+   *               ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]")
+   *                   .toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListReplayResultsResponse response =
+   *         simulatorClient.listReplayResultsCallable().call(request);
+   *     for (ReplayResult element : response.getReplayResultsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listReplayResultsCallable() { + return stub.listReplayResultsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListReplayResultsPagedResponse + extends AbstractPagedListResponse< + ListReplayResultsRequest, + ListReplayResultsResponse, + ReplayResult, + ListReplayResultsPage, + ListReplayResultsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListReplayResultsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListReplayResultsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListReplayResultsPagedResponse(ListReplayResultsPage page) { + super(page, ListReplayResultsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListReplayResultsPage + extends AbstractPage< + ListReplayResultsRequest, + ListReplayResultsResponse, + ReplayResult, + ListReplayResultsPage> { + + private ListReplayResultsPage( + PageContext context, + ListReplayResultsResponse response) { + super(context, response); + } + + private static ListReplayResultsPage createEmptyPage() { + return new ListReplayResultsPage(null, null); + } + + @Override + protected ListReplayResultsPage createPage( + PageContext context, + ListReplayResultsResponse response) { + return new ListReplayResultsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListReplayResultsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListReplayResultsRequest, + ListReplayResultsResponse, + ReplayResult, + ListReplayResultsPage, + ListReplayResultsFixedSizeCollection> { + + private ListReplayResultsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListReplayResultsFixedSizeCollection createEmptyCollection() { + return new ListReplayResultsFixedSizeCollection(null, 0); + } + + @Override + protected ListReplayResultsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListReplayResultsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/SimulatorSettings.java b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/SimulatorSettings.java new file mode 100644 index 000000000000..e9e1e6aea6fd --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/SimulatorSettings.java @@ -0,0 +1,245 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1; + +import static com.google.cloud.policysimulator.v1.SimulatorClient.ListReplayResultsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.policysimulator.v1.stub.SimulatorStubSettings; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link SimulatorClient}. + * + *

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

    + *
  • The default service address (policysimulator.googleapis.com) and default port (443) are + * used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getReplay to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SimulatorSettings.Builder simulatorSettingsBuilder = SimulatorSettings.newBuilder();
+ * simulatorSettingsBuilder
+ *     .getReplaySettings()
+ *     .setRetrySettings(
+ *         simulatorSettingsBuilder
+ *             .getReplaySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * SimulatorSettings simulatorSettings = simulatorSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class SimulatorSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to getReplay. */ + public UnaryCallSettings getReplaySettings() { + return ((SimulatorStubSettings) getStubSettings()).getReplaySettings(); + } + + /** Returns the object with the settings used for calls to createReplay. */ + public UnaryCallSettings createReplaySettings() { + return ((SimulatorStubSettings) getStubSettings()).createReplaySettings(); + } + + /** Returns the object with the settings used for calls to createReplay. */ + public OperationCallSettings + createReplayOperationSettings() { + return ((SimulatorStubSettings) getStubSettings()).createReplayOperationSettings(); + } + + /** Returns the object with the settings used for calls to listReplayResults. */ + public PagedCallSettings< + ListReplayResultsRequest, ListReplayResultsResponse, ListReplayResultsPagedResponse> + listReplayResultsSettings() { + return ((SimulatorStubSettings) getStubSettings()).listReplayResultsSettings(); + } + + public static final SimulatorSettings create(SimulatorStubSettings stub) throws IOException { + return new SimulatorSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return SimulatorStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return SimulatorStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return SimulatorStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return SimulatorStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return SimulatorStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return SimulatorStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return SimulatorStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SimulatorStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SimulatorSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for SimulatorSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(SimulatorStubSettings.newBuilder(clientContext)); + } + + protected Builder(SimulatorSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(SimulatorStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(SimulatorStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(SimulatorStubSettings.newHttpJsonBuilder()); + } + + public SimulatorStubSettings.Builder getStubSettingsBuilder() { + return ((SimulatorStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getReplay. */ + public UnaryCallSettings.Builder getReplaySettings() { + return getStubSettingsBuilder().getReplaySettings(); + } + + /** Returns the builder for the settings used for calls to createReplay. */ + public UnaryCallSettings.Builder createReplaySettings() { + return getStubSettingsBuilder().createReplaySettings(); + } + + /** Returns the builder for the settings used for calls to createReplay. */ + public OperationCallSettings.Builder + createReplayOperationSettings() { + return getStubSettingsBuilder().createReplayOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listReplayResults. */ + public PagedCallSettings.Builder< + ListReplayResultsRequest, ListReplayResultsResponse, ListReplayResultsPagedResponse> + listReplayResultsSettings() { + return getStubSettingsBuilder().listReplayResultsSettings(); + } + + @Override + public SimulatorSettings build() throws IOException { + return new SimulatorSettings(this); + } + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/gapic_metadata.json b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/gapic_metadata.json new file mode 100644 index 000000000000..c0d7ff8eb0bc --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/gapic_metadata.json @@ -0,0 +1,27 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.cloud.policysimulator.v1", + "libraryPackage": "com.google.cloud.policysimulator.v1", + "services": { + "Simulator": { + "clients": { + "grpc": { + "libraryClient": "SimulatorClient", + "rpcs": { + "CreateReplay": { + "methods": ["createReplayAsync", "createReplayAsync", "createReplayOperationCallable", "createReplayCallable"] + }, + "GetReplay": { + "methods": ["getReplay", "getReplay", "getReplay", "getReplayCallable"] + }, + "ListReplayResults": { + "methods": ["listReplayResults", "listReplayResults", "listReplayResults", "listReplayResultsPagedCallable", "listReplayResultsCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/package-info.java b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/package-info.java new file mode 100644 index 000000000000..3a62af133b09 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/package-info.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A client to Policy Simulator API + * + *

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

======================= SimulatorClient ======================= + * + *

Service Description: Policy Simulator API service. + * + *

Policy Simulator is a collection of endpoints for creating, running, and viewing a + * [Replay][google.cloud.policysimulator.v1.Replay]. A + * [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that lets you see how + * your principals' access to resources might change if you changed your IAM policy. + * + *

During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator re-evaluates, or + * replays, past access attempts under both the current policy and your proposed policy, and + * compares those results to determine how your principals' access might change under the proposed + * policy. + * + *

Sample for SimulatorClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (SimulatorClient simulatorClient = SimulatorClient.create()) {
+ *   ReplayName name =
+ *       ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]");
+ *   Replay response = simulatorClient.getReplay(name);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.cloud.policysimulator.v1; + +import javax.annotation.Generated; diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/GrpcSimulatorCallableFactory.java b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/GrpcSimulatorCallableFactory.java new file mode 100644 index 000000000000..f012672673b2 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/GrpcSimulatorCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the Simulator service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcSimulatorCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/GrpcSimulatorStub.java b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/GrpcSimulatorStub.java new file mode 100644 index 000000000000..27ccd29c7d16 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/GrpcSimulatorStub.java @@ -0,0 +1,255 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.stub; + +import static com.google.cloud.policysimulator.v1.SimulatorClient.ListReplayResultsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.RequestParamsBuilder; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.policysimulator.v1.CreateReplayRequest; +import com.google.cloud.policysimulator.v1.GetReplayRequest; +import com.google.cloud.policysimulator.v1.ListReplayResultsRequest; +import com.google.cloud.policysimulator.v1.ListReplayResultsResponse; +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.ReplayOperationMetadata; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the Simulator service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcSimulatorStub extends SimulatorStub { + private static final MethodDescriptor getReplayMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.policysimulator.v1.Simulator/GetReplay") + .setRequestMarshaller(ProtoUtils.marshaller(GetReplayRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Replay.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + createReplayMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.policysimulator.v1.Simulator/CreateReplay") + .setRequestMarshaller(ProtoUtils.marshaller(CreateReplayRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listReplayResultsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.policysimulator.v1.Simulator/ListReplayResults") + .setRequestMarshaller( + ProtoUtils.marshaller(ListReplayResultsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListReplayResultsResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable getReplayCallable; + private final UnaryCallable createReplayCallable; + private final OperationCallable + createReplayOperationCallable; + private final UnaryCallable + listReplayResultsCallable; + private final UnaryCallable + listReplayResultsPagedCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcSimulatorStub create(SimulatorStubSettings settings) throws IOException { + return new GrpcSimulatorStub(settings, ClientContext.create(settings)); + } + + public static final GrpcSimulatorStub create(ClientContext clientContext) throws IOException { + return new GrpcSimulatorStub(SimulatorStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcSimulatorStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcSimulatorStub( + SimulatorStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcSimulatorStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcSimulatorStub(SimulatorStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcSimulatorCallableFactory()); + } + + /** + * Constructs an instance of GrpcSimulatorStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcSimulatorStub( + SimulatorStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings getReplayTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getReplayMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + GrpcCallSettings createReplayTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createReplayMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); + GrpcCallSettings + listReplayResultsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listReplayResultsMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); + + this.getReplayCallable = + callableFactory.createUnaryCallable( + getReplayTransportSettings, settings.getReplaySettings(), clientContext); + this.createReplayCallable = + callableFactory.createUnaryCallable( + createReplayTransportSettings, settings.createReplaySettings(), clientContext); + this.createReplayOperationCallable = + callableFactory.createOperationCallable( + createReplayTransportSettings, + settings.createReplayOperationSettings(), + clientContext, + operationsStub); + this.listReplayResultsCallable = + callableFactory.createUnaryCallable( + listReplayResultsTransportSettings, + settings.listReplayResultsSettings(), + clientContext); + this.listReplayResultsPagedCallable = + callableFactory.createPagedCallable( + listReplayResultsTransportSettings, + settings.listReplayResultsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable getReplayCallable() { + return getReplayCallable; + } + + @Override + public UnaryCallable createReplayCallable() { + return createReplayCallable; + } + + @Override + public OperationCallable + createReplayOperationCallable() { + return createReplayOperationCallable; + } + + @Override + public UnaryCallable + listReplayResultsCallable() { + return listReplayResultsCallable; + } + + @Override + public UnaryCallable + listReplayResultsPagedCallable() { + return listReplayResultsPagedCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/HttpJsonSimulatorCallableFactory.java b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/HttpJsonSimulatorCallableFactory.java new file mode 100644 index 000000000000..a1a144d8a753 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/HttpJsonSimulatorCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the Simulator service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonSimulatorCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/HttpJsonSimulatorStub.java b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/HttpJsonSimulatorStub.java new file mode 100644 index 000000000000..6c3c519c8ec6 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/HttpJsonSimulatorStub.java @@ -0,0 +1,420 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.stub; + +import static com.google.cloud.policysimulator.v1.SimulatorClient.ListReplayResultsPagedResponse; + +import com.google.api.HttpRule; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.RequestParamsBuilder; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.policysimulator.v1.CreateReplayRequest; +import com.google.cloud.policysimulator.v1.GetReplayRequest; +import com.google.cloud.policysimulator.v1.ListReplayResultsRequest; +import com.google.cloud.policysimulator.v1.ListReplayResultsResponse; +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.ReplayOperationMetadata; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the Simulator service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonSimulatorStub extends SimulatorStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Replay.getDescriptor()) + .add(ReplayOperationMetadata.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor getReplayMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.policysimulator.v1.Simulator/GetReplay") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/replays/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setAdditionalPaths( + "/v1/{name=folders/*/locations/*/replays/*}", + "/v1/{name=organizations/*/locations/*/replays/*}") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Replay.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createReplayMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.policysimulator.v1.Simulator/CreateReplay") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/replays", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths( + "/v1/{parent=folders/*/locations/*}/replays", + "/v1/{parent=organizations/*/locations/*}/replays") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("replay", request.getReplay(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateReplayRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listReplayResultsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.policysimulator.v1.Simulator/ListReplayResults") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/replays/*}/results", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths( + "/v1/{parent=folders/*/locations/*/replays/*}/results", + "/v1/{parent=organizations/*/locations/*/replays/*}/results") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListReplayResultsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable getReplayCallable; + private final UnaryCallable createReplayCallable; + private final OperationCallable + createReplayOperationCallable; + private final UnaryCallable + listReplayResultsCallable; + private final UnaryCallable + listReplayResultsPagedCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonSimulatorStub create(SimulatorStubSettings settings) + throws IOException { + return new HttpJsonSimulatorStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonSimulatorStub create(ClientContext clientContext) throws IOException { + return new HttpJsonSimulatorStub( + SimulatorStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonSimulatorStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonSimulatorStub( + SimulatorStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonSimulatorStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSimulatorStub(SimulatorStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonSimulatorCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonSimulatorStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonSimulatorStub( + SimulatorStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create( + clientContext, + callableFactory, + typeRegistry, + ImmutableMap.builder() + .put( + "google.longrunning.Operations.GetOperation", + HttpRule.newBuilder() + .setGet("/v1/{name=operations/**}") + .addAdditionalBindings( + HttpRule.newBuilder() + .setGet("/v1/{name=projects/*/locations/*/replays/*/operations/**}") + .build()) + .addAdditionalBindings( + HttpRule.newBuilder() + .setGet("/v1/{name=folders/*/locations/*/replays/*/operations/**}") + .build()) + .addAdditionalBindings( + HttpRule.newBuilder() + .setGet( + "/v1/{name=organizations/*/locations/*/replays/*/operations/**}") + .build()) + .build()) + .put( + "google.longrunning.Operations.ListOperations", + HttpRule.newBuilder() + .setGet("/v1/{name=operations}") + .addAdditionalBindings( + HttpRule.newBuilder() + .setGet("/v1/{name=projects/*/locations/*/replays/*/operations}") + .build()) + .addAdditionalBindings( + HttpRule.newBuilder() + .setGet("/v1/{name=folders/*/locations/*/replays/*/operations}") + .build()) + .addAdditionalBindings( + HttpRule.newBuilder() + .setGet( + "/v1/{name=organizations/*/locations/*/replays/*/operations}") + .build()) + .build()) + .build()); + + HttpJsonCallSettings getReplayTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getReplayMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("name", String.valueOf(request.getName())); + return builder.build(); + }) + .build(); + HttpJsonCallSettings createReplayTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createReplayMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); + HttpJsonCallSettings + listReplayResultsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listReplayResultsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("parent", String.valueOf(request.getParent())); + return builder.build(); + }) + .build(); + + this.getReplayCallable = + callableFactory.createUnaryCallable( + getReplayTransportSettings, settings.getReplaySettings(), clientContext); + this.createReplayCallable = + callableFactory.createUnaryCallable( + createReplayTransportSettings, settings.createReplaySettings(), clientContext); + this.createReplayOperationCallable = + callableFactory.createOperationCallable( + createReplayTransportSettings, + settings.createReplayOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listReplayResultsCallable = + callableFactory.createUnaryCallable( + listReplayResultsTransportSettings, + settings.listReplayResultsSettings(), + clientContext); + this.listReplayResultsPagedCallable = + callableFactory.createPagedCallable( + listReplayResultsTransportSettings, + settings.listReplayResultsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(getReplayMethodDescriptor); + methodDescriptors.add(createReplayMethodDescriptor); + methodDescriptors.add(listReplayResultsMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable getReplayCallable() { + return getReplayCallable; + } + + @Override + public UnaryCallable createReplayCallable() { + return createReplayCallable; + } + + @Override + public OperationCallable + createReplayOperationCallable() { + return createReplayOperationCallable; + } + + @Override + public UnaryCallable + listReplayResultsCallable() { + return listReplayResultsCallable; + } + + @Override + public UnaryCallable + listReplayResultsPagedCallable() { + return listReplayResultsPagedCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/SimulatorStub.java b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/SimulatorStub.java new file mode 100644 index 000000000000..f70759deccbe --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/SimulatorStub.java @@ -0,0 +1,76 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.stub; + +import static com.google.cloud.policysimulator.v1.SimulatorClient.ListReplayResultsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.policysimulator.v1.CreateReplayRequest; +import com.google.cloud.policysimulator.v1.GetReplayRequest; +import com.google.cloud.policysimulator.v1.ListReplayResultsRequest; +import com.google.cloud.policysimulator.v1.ListReplayResultsResponse; +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.ReplayOperationMetadata; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the Simulator service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class SimulatorStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; + } + + public UnaryCallable getReplayCallable() { + throw new UnsupportedOperationException("Not implemented: getReplayCallable()"); + } + + public OperationCallable + createReplayOperationCallable() { + throw new UnsupportedOperationException("Not implemented: createReplayOperationCallable()"); + } + + public UnaryCallable createReplayCallable() { + throw new UnsupportedOperationException("Not implemented: createReplayCallable()"); + } + + public UnaryCallable + listReplayResultsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listReplayResultsPagedCallable()"); + } + + public UnaryCallable + listReplayResultsCallable() { + throw new UnsupportedOperationException("Not implemented: listReplayResultsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/SimulatorStubSettings.java b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/SimulatorStubSettings.java new file mode 100644 index 000000000000..3e82fe45f0ff --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/java/com/google/cloud/policysimulator/v1/stub/SimulatorStubSettings.java @@ -0,0 +1,509 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.stub; + +import static com.google.cloud.policysimulator.v1.SimulatorClient.ListReplayResultsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.policysimulator.v1.CreateReplayRequest; +import com.google.cloud.policysimulator.v1.GetReplayRequest; +import com.google.cloud.policysimulator.v1.ListReplayResultsRequest; +import com.google.cloud.policysimulator.v1.ListReplayResultsResponse; +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.ReplayOperationMetadata; +import com.google.cloud.policysimulator.v1.ReplayResult; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link SimulatorStub}. + * + *

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

    + *
  • The default service address (policysimulator.googleapis.com) and default port (443) are + * used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getReplay to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * SimulatorStubSettings.Builder simulatorSettingsBuilder = SimulatorStubSettings.newBuilder();
+ * simulatorSettingsBuilder
+ *     .getReplaySettings()
+ *     .setRetrySettings(
+ *         simulatorSettingsBuilder
+ *             .getReplaySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * SimulatorStubSettings simulatorSettings = simulatorSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class SimulatorStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings getReplaySettings; + private final UnaryCallSettings createReplaySettings; + private final OperationCallSettings + createReplayOperationSettings; + private final PagedCallSettings< + ListReplayResultsRequest, ListReplayResultsResponse, ListReplayResultsPagedResponse> + listReplayResultsSettings; + + private static final PagedListDescriptor< + ListReplayResultsRequest, ListReplayResultsResponse, ReplayResult> + LIST_REPLAY_RESULTS_PAGE_STR_DESC = + new PagedListDescriptor< + ListReplayResultsRequest, ListReplayResultsResponse, ReplayResult>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListReplayResultsRequest injectToken( + ListReplayResultsRequest payload, String token) { + return ListReplayResultsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListReplayResultsRequest injectPageSize( + ListReplayResultsRequest payload, int pageSize) { + return ListReplayResultsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListReplayResultsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListReplayResultsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListReplayResultsResponse payload) { + return payload.getReplayResultsList() == null + ? ImmutableList.of() + : payload.getReplayResultsList(); + } + }; + + private static final PagedListResponseFactory< + ListReplayResultsRequest, ListReplayResultsResponse, ListReplayResultsPagedResponse> + LIST_REPLAY_RESULTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListReplayResultsRequest, + ListReplayResultsResponse, + ListReplayResultsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListReplayResultsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_REPLAY_RESULTS_PAGE_STR_DESC, request, context); + return ListReplayResultsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to getReplay. */ + public UnaryCallSettings getReplaySettings() { + return getReplaySettings; + } + + /** Returns the object with the settings used for calls to createReplay. */ + public UnaryCallSettings createReplaySettings() { + return createReplaySettings; + } + + /** Returns the object with the settings used for calls to createReplay. */ + public OperationCallSettings + createReplayOperationSettings() { + return createReplayOperationSettings; + } + + /** Returns the object with the settings used for calls to listReplayResults. */ + public PagedCallSettings< + ListReplayResultsRequest, ListReplayResultsResponse, ListReplayResultsPagedResponse> + listReplayResultsSettings() { + return listReplayResultsSettings; + } + + public SimulatorStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcSimulatorStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonSimulatorStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "policysimulator.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "policysimulator.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(SimulatorStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(SimulatorStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return SimulatorStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected SimulatorStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getReplaySettings = settingsBuilder.getReplaySettings().build(); + createReplaySettings = settingsBuilder.createReplaySettings().build(); + createReplayOperationSettings = settingsBuilder.createReplayOperationSettings().build(); + listReplayResultsSettings = settingsBuilder.listReplayResultsSettings().build(); + } + + /** Builder for SimulatorStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder getReplaySettings; + private final UnaryCallSettings.Builder createReplaySettings; + private final OperationCallSettings.Builder< + CreateReplayRequest, Replay, ReplayOperationMetadata> + createReplayOperationSettings; + private final PagedCallSettings.Builder< + ListReplayResultsRequest, ListReplayResultsResponse, ListReplayResultsPagedResponse> + listReplayResultsSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); + definitions.put( + "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(1000L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(10000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + settings = + RetrySettings.newBuilder() + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("no_retry_1_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getReplaySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createReplaySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createReplayOperationSettings = OperationCallSettings.newBuilder(); + listReplayResultsSettings = PagedCallSettings.newBuilder(LIST_REPLAY_RESULTS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getReplaySettings, createReplaySettings, listReplayResultsSettings); + initDefaults(this); + } + + protected Builder(SimulatorStubSettings settings) { + super(settings); + + getReplaySettings = settings.getReplaySettings.toBuilder(); + createReplaySettings = settings.createReplaySettings.toBuilder(); + createReplayOperationSettings = settings.createReplayOperationSettings.toBuilder(); + listReplayResultsSettings = settings.listReplayResultsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getReplaySettings, createReplaySettings, listReplayResultsSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .getReplaySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .createReplaySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .listReplayResultsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .createReplayOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Replay.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(ReplayOperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(1000L)) + .setRetryDelayMultiplier(2.0) + .setMaxRetryDelay(Duration.ofMillis(10000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(18000000L)) + .build())); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getReplay. */ + public UnaryCallSettings.Builder getReplaySettings() { + return getReplaySettings; + } + + /** Returns the builder for the settings used for calls to createReplay. */ + public UnaryCallSettings.Builder createReplaySettings() { + return createReplaySettings; + } + + /** Returns the builder for the settings used for calls to createReplay. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createReplayOperationSettings() { + return createReplayOperationSettings; + } + + /** Returns the builder for the settings used for calls to listReplayResults. */ + public PagedCallSettings.Builder< + ListReplayResultsRequest, ListReplayResultsResponse, ListReplayResultsPagedResponse> + listReplayResultsSettings() { + return listReplayResultsSettings; + } + + @Override + public SimulatorStubSettings build() throws IOException { + return new SimulatorStubSettings(this); + } + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/main/resources/META-INF/native-image/com.google.cloud.policysimulator.v1/reflect-config.json b/java-policysimulator/google-cloud-policysimulator/src/main/resources/META-INF/native-image/com.google.cloud.policysimulator.v1/reflect-config.json new file mode 100644 index 000000000000..94fa4ca7a46b --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/main/resources/META-INF/native-image/com.google.cloud.policysimulator.v1/reflect-config.json @@ -0,0 +1,1748 @@ +[ + { + "name": "com.google.api.ClientLibraryDestination", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ClientLibraryOrganization", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ClientLibrarySettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ClientLibrarySettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CommonLanguageSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CommonLanguageSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CppSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CppSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CustomHttpPattern", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.CustomHttpPattern$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.DotnetSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.DotnetSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.FieldBehavior", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.GoSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.GoSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.Http", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.Http$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.HttpRule", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.HttpRule$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.JavaSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.JavaSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.LaunchStage", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.MethodSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.MethodSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.MethodSettings$LongRunning", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.MethodSettings$LongRunning$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.NodeSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.NodeSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PhpSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PhpSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.Publishing", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.Publishing$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PythonSettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PythonSettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceDescriptor", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceDescriptor$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceDescriptor$History", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceDescriptor$Style", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceReference", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.ResourceReference$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.RubySettings", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.RubySettings$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.AccessState", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.AccessStateDiff", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.AccessStateDiff$AccessChangeType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.AccessStateDiff$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.AccessTuple", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.AccessTuple$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.BindingExplanation", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.BindingExplanation$AnnotatedMembership", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.BindingExplanation$AnnotatedMembership$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.BindingExplanation$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.BindingExplanation$Membership", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.BindingExplanation$RolePermission", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.CreateReplayRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.CreateReplayRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ExplainedAccess", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ExplainedAccess$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ExplainedPolicy", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ExplainedPolicy$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.GetReplayRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.GetReplayRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.HeuristicRelevance", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ListReplayResultsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ListReplayResultsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ListReplayResultsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ListReplayResultsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.Replay", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.Replay$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.Replay$ResultsSummary", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.Replay$ResultsSummary$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.Replay$State", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ReplayConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ReplayConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ReplayConfig$LogSource", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ReplayDiff", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ReplayDiff$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ReplayOperationMetadata", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ReplayOperationMetadata$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ReplayResult", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.policysimulator.v1.ReplayResult$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfigDelta", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfigDelta$Action", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfigDelta$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditLogConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditLogConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditLogConfig$LogType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Binding", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Binding$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.BindingDelta", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.BindingDelta$Action", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.BindingDelta$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Policy", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Policy$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.PolicyDelta", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.PolicyDelta$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.CancelOperationRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.CancelOperationRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.DeleteOperationRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.DeleteOperationRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.GetOperationRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.GetOperationRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.ListOperationsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.ListOperationsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.ListOperationsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.ListOperationsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.Operation", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.Operation$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.OperationInfo", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.OperationInfo$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.WaitOperationRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.longrunning.WaitOperationRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Any", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Any$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$ExtensionRange$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$ReservedRange", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$DescriptorProto$ReservedRange$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumDescriptorProto$EnumReservedRange", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumDescriptorProto$EnumReservedRange$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumValueDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumValueOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$EnumValueOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions$Declaration", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions$Declaration$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ExtensionRangeOptions$VerificationState", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Label", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldDescriptorProto$Type", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$CType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$JSType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$OptionRetention", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FieldOptions$OptionTargetType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileDescriptorSet", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileDescriptorSet$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$FileOptions$OptimizeMode", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Annotation", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Annotation$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Annotation$Semantic", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$GeneratedCodeInfo$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MessageOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MessageOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$MethodOptions$IdempotencyLevel", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$OneofDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$OneofDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$OneofOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$OneofOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ServiceDescriptorProto", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ServiceDescriptorProto$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ServiceOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$ServiceOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$SourceCodeInfo", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$SourceCodeInfo$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$SourceCodeInfo$Location", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$SourceCodeInfo$Location$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$UninterpretedOption", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$UninterpretedOption$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$UninterpretedOption$NamePart", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.DescriptorProtos$UninterpretedOption$NamePart$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Duration", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Duration$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Empty", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Empty$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Timestamp", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.protobuf.Timestamp$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.rpc.Status", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.rpc.Status$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.type.Date", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.type.Date$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.type.Expr", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.type.Expr$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + } +] \ No newline at end of file diff --git a/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/MockSimulator.java b/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/MockSimulator.java new file mode 100644 index 000000000000..54342145fb16 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/MockSimulator.java @@ -0,0 +1,59 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockSimulator implements MockGrpcService { + private final MockSimulatorImpl serviceImpl; + + public MockSimulator() { + serviceImpl = new MockSimulatorImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/MockSimulatorImpl.java b/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/MockSimulatorImpl.java new file mode 100644 index 000000000000..92f8f002f334 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/MockSimulatorImpl.java @@ -0,0 +1,124 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.policysimulator.v1.SimulatorGrpc.SimulatorImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockSimulatorImpl extends SimulatorImplBase { + private List requests; + private Queue responses; + + public MockSimulatorImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void getReplay(GetReplayRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Replay) { + requests.add(request); + responseObserver.onNext(((Replay) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetReplay, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Replay.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void createReplay( + CreateReplayRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateReplay, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listReplayResults( + ListReplayResultsRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListReplayResultsResponse) { + requests.add(request); + responseObserver.onNext(((ListReplayResultsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListReplayResults, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListReplayResultsResponse.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/SimulatorClientHttpJsonTest.java b/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/SimulatorClientHttpJsonTest.java new file mode 100644 index 000000000000..0d9b7f9dd613 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/SimulatorClientHttpJsonTest.java @@ -0,0 +1,333 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1; + +import static com.google.cloud.policysimulator.v1.SimulatorClient.ListReplayResultsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.policysimulator.v1.stub.HttpJsonSimulatorStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class SimulatorClientHttpJsonTest { + private static MockHttpService mockService; + private static SimulatorClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonSimulatorStub.getMethodDescriptors(), SimulatorSettings.getDefaultEndpoint()); + SimulatorSettings settings = + SimulatorSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + SimulatorSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SimulatorClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void getReplayTest() throws Exception { + Replay expectedResponse = + Replay.newBuilder() + .setName( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .setConfig(ReplayConfig.newBuilder().build()) + .setResultsSummary(Replay.ResultsSummary.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ReplayName name = ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + + Replay actualResponse = client.getReplay(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getReplayExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ReplayName name = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + client.getReplay(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getReplayTest2() throws Exception { + Replay expectedResponse = + Replay.newBuilder() + .setName( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .setConfig(ReplayConfig.newBuilder().build()) + .setResultsSummary(Replay.ResultsSummary.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-9166/locations/location-9166/replays/replay-9166"; + + Replay actualResponse = client.getReplay(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getReplayExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9166/locations/location-9166/replays/replay-9166"; + client.getReplay(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createReplayTest() throws Exception { + Replay expectedResponse = + Replay.newBuilder() + .setName( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .setConfig(ReplayConfig.newBuilder().build()) + .setResultsSummary(Replay.ResultsSummary.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createReplayTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Replay replay = Replay.newBuilder().build(); + + Replay actualResponse = client.createReplayAsync(parent, replay).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createReplayExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Replay replay = Replay.newBuilder().build(); + client.createReplayAsync(parent, replay).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listReplayResultsTest() throws Exception { + ReplayResult responsesElement = ReplayResult.newBuilder().build(); + ListReplayResultsResponse expectedResponse = + ListReplayResultsResponse.newBuilder() + .setNextPageToken("") + .addAllReplayResults(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ReplayName parent = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + + ListReplayResultsPagedResponse pagedListResponse = client.listReplayResults(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getReplayResultsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listReplayResultsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ReplayName parent = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + client.listReplayResults(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listReplayResultsTest2() throws Exception { + ReplayResult responsesElement = ReplayResult.newBuilder().build(); + ListReplayResultsResponse expectedResponse = + ListReplayResultsResponse.newBuilder() + .setNextPageToken("") + .addAllReplayResults(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-4625/locations/location-4625/replays/replay-4625"; + + ListReplayResultsPagedResponse pagedListResponse = client.listReplayResults(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getReplayResultsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listReplayResultsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-4625/locations/location-4625/replays/replay-4625"; + client.listReplayResults(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/SimulatorClientTest.java b/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/SimulatorClientTest.java new file mode 100644 index 000000000000..f4e5dbfb31a8 --- /dev/null +++ b/java-policysimulator/google-cloud-policysimulator/src/test/java/com/google/cloud/policysimulator/v1/SimulatorClientTest.java @@ -0,0 +1,312 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1; + +import static com.google.cloud.policysimulator.v1.SimulatorClient.ListReplayResultsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class SimulatorClientTest { + private static MockServiceHelper mockServiceHelper; + private static MockSimulator mockSimulator; + private LocalChannelProvider channelProvider; + private SimulatorClient client; + + @BeforeClass + public static void startStaticServer() { + mockSimulator = new MockSimulator(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockSimulator)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + SimulatorSettings settings = + SimulatorSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = SimulatorClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void getReplayTest() throws Exception { + Replay expectedResponse = + Replay.newBuilder() + .setName( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .setConfig(ReplayConfig.newBuilder().build()) + .setResultsSummary(Replay.ResultsSummary.newBuilder().build()) + .build(); + mockSimulator.addResponse(expectedResponse); + + ReplayName name = ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + + Replay actualResponse = client.getReplay(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSimulator.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetReplayRequest actualRequest = ((GetReplayRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getReplayExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSimulator.addException(exception); + + try { + ReplayName name = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + client.getReplay(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getReplayTest2() throws Exception { + Replay expectedResponse = + Replay.newBuilder() + .setName( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .setConfig(ReplayConfig.newBuilder().build()) + .setResultsSummary(Replay.ResultsSummary.newBuilder().build()) + .build(); + mockSimulator.addResponse(expectedResponse); + + String name = "name3373707"; + + Replay actualResponse = client.getReplay(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSimulator.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetReplayRequest actualRequest = ((GetReplayRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getReplayExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSimulator.addException(exception); + + try { + String name = "name3373707"; + client.getReplay(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createReplayTest() throws Exception { + Replay expectedResponse = + Replay.newBuilder() + .setName( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .setConfig(ReplayConfig.newBuilder().build()) + .setResultsSummary(Replay.ResultsSummary.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createReplayTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockSimulator.addResponse(resultOperation); + + String parent = "parent-995424086"; + Replay replay = Replay.newBuilder().build(); + + Replay actualResponse = client.createReplayAsync(parent, replay).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockSimulator.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateReplayRequest actualRequest = ((CreateReplayRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(replay, actualRequest.getReplay()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createReplayExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSimulator.addException(exception); + + try { + String parent = "parent-995424086"; + Replay replay = Replay.newBuilder().build(); + client.createReplayAsync(parent, replay).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void listReplayResultsTest() throws Exception { + ReplayResult responsesElement = ReplayResult.newBuilder().build(); + ListReplayResultsResponse expectedResponse = + ListReplayResultsResponse.newBuilder() + .setNextPageToken("") + .addAllReplayResults(Arrays.asList(responsesElement)) + .build(); + mockSimulator.addResponse(expectedResponse); + + ReplayName parent = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + + ListReplayResultsPagedResponse pagedListResponse = client.listReplayResults(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getReplayResultsList().get(0), resources.get(0)); + + List actualRequests = mockSimulator.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListReplayResultsRequest actualRequest = ((ListReplayResultsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listReplayResultsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSimulator.addException(exception); + + try { + ReplayName parent = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + client.listReplayResults(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listReplayResultsTest2() throws Exception { + ReplayResult responsesElement = ReplayResult.newBuilder().build(); + ListReplayResultsResponse expectedResponse = + ListReplayResultsResponse.newBuilder() + .setNextPageToken("") + .addAllReplayResults(Arrays.asList(responsesElement)) + .build(); + mockSimulator.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListReplayResultsPagedResponse pagedListResponse = client.listReplayResults(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getReplayResultsList().get(0), resources.get(0)); + + List actualRequests = mockSimulator.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListReplayResultsRequest actualRequest = ((ListReplayResultsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listReplayResultsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockSimulator.addException(exception); + + try { + String parent = "parent-995424086"; + client.listReplayResults(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-policysimulator/grpc-google-cloud-policysimulator-v1/pom.xml b/java-policysimulator/grpc-google-cloud-policysimulator-v1/pom.xml new file mode 100644 index 000000000000..ee7cdb55853c --- /dev/null +++ b/java-policysimulator/grpc-google-cloud-policysimulator-v1/pom.xml @@ -0,0 +1,45 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-policysimulator-v1 + 0.0.1-SNAPSHOT + grpc-google-cloud-policysimulator-v1 + GRPC library for google-cloud-policysimulator + + com.google.cloud + google-cloud-policysimulator-parent + 0.0.1-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-cloud-policysimulator-v1 + + + com.google.guava + guava + + + \ No newline at end of file diff --git a/java-policysimulator/grpc-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/SimulatorGrpc.java b/java-policysimulator/grpc-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/SimulatorGrpc.java new file mode 100644 index 000000000000..2c29ddeed13d --- /dev/null +++ b/java-policysimulator/grpc-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/SimulatorGrpc.java @@ -0,0 +1,666 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.policysimulator.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Policy Simulator API service.
+ * Policy Simulator is a collection of endpoints for creating, running, and
+ * viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A
+ * [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that
+ * lets you see how your principals' access to resources might change if you
+ * changed your IAM policy.
+ * During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator
+ * re-evaluates, or replays, past access attempts under both the current policy
+ * and  your proposed policy, and compares those results to determine how your
+ * principals' access might change under the proposed policy.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/policysimulator/v1/simulator.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class SimulatorGrpc { + + private SimulatorGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.policysimulator.v1.Simulator"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.policysimulator.v1.GetReplayRequest, + com.google.cloud.policysimulator.v1.Replay> + getGetReplayMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetReplay", + requestType = com.google.cloud.policysimulator.v1.GetReplayRequest.class, + responseType = com.google.cloud.policysimulator.v1.Replay.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.policysimulator.v1.GetReplayRequest, + com.google.cloud.policysimulator.v1.Replay> + getGetReplayMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.policysimulator.v1.GetReplayRequest, + com.google.cloud.policysimulator.v1.Replay> + getGetReplayMethod; + if ((getGetReplayMethod = SimulatorGrpc.getGetReplayMethod) == null) { + synchronized (SimulatorGrpc.class) { + if ((getGetReplayMethod = SimulatorGrpc.getGetReplayMethod) == null) { + SimulatorGrpc.getGetReplayMethod = + getGetReplayMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetReplay")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.policysimulator.v1.GetReplayRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.policysimulator.v1.Replay.getDefaultInstance())) + .setSchemaDescriptor(new SimulatorMethodDescriptorSupplier("GetReplay")) + .build(); + } + } + } + return getGetReplayMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.policysimulator.v1.CreateReplayRequest, com.google.longrunning.Operation> + getCreateReplayMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateReplay", + requestType = com.google.cloud.policysimulator.v1.CreateReplayRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.policysimulator.v1.CreateReplayRequest, com.google.longrunning.Operation> + getCreateReplayMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.policysimulator.v1.CreateReplayRequest, + com.google.longrunning.Operation> + getCreateReplayMethod; + if ((getCreateReplayMethod = SimulatorGrpc.getCreateReplayMethod) == null) { + synchronized (SimulatorGrpc.class) { + if ((getCreateReplayMethod = SimulatorGrpc.getCreateReplayMethod) == null) { + SimulatorGrpc.getCreateReplayMethod = + getCreateReplayMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateReplay")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.policysimulator.v1.CreateReplayRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new SimulatorMethodDescriptorSupplier("CreateReplay")) + .build(); + } + } + } + return getCreateReplayMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.policysimulator.v1.ListReplayResultsRequest, + com.google.cloud.policysimulator.v1.ListReplayResultsResponse> + getListReplayResultsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListReplayResults", + requestType = com.google.cloud.policysimulator.v1.ListReplayResultsRequest.class, + responseType = com.google.cloud.policysimulator.v1.ListReplayResultsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.policysimulator.v1.ListReplayResultsRequest, + com.google.cloud.policysimulator.v1.ListReplayResultsResponse> + getListReplayResultsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.policysimulator.v1.ListReplayResultsRequest, + com.google.cloud.policysimulator.v1.ListReplayResultsResponse> + getListReplayResultsMethod; + if ((getListReplayResultsMethod = SimulatorGrpc.getListReplayResultsMethod) == null) { + synchronized (SimulatorGrpc.class) { + if ((getListReplayResultsMethod = SimulatorGrpc.getListReplayResultsMethod) == null) { + SimulatorGrpc.getListReplayResultsMethod = + getListReplayResultsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListReplayResults")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.policysimulator.v1.ListReplayResultsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.policysimulator.v1.ListReplayResultsResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new SimulatorMethodDescriptorSupplier("ListReplayResults")) + .build(); + } + } + } + return getListReplayResultsMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static SimulatorStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public SimulatorStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SimulatorStub(channel, callOptions); + } + }; + return SimulatorStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static SimulatorBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public SimulatorBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SimulatorBlockingStub(channel, callOptions); + } + }; + return SimulatorBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static SimulatorFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public SimulatorFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SimulatorFutureStub(channel, callOptions); + } + }; + return SimulatorFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Policy Simulator API service.
+   * Policy Simulator is a collection of endpoints for creating, running, and
+   * viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A
+   * [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that
+   * lets you see how your principals' access to resources might change if you
+   * changed your IAM policy.
+   * During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator
+   * re-evaluates, or replays, past access attempts under both the current policy
+   * and  your proposed policy, and compares those results to determine how your
+   * principals' access might change under the proposed policy.
+   * 
+ */ + public interface AsyncService { + + /** + * + * + *
+     * Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
+     * `Replay` is available for at least 7 days.
+     * 
+ */ + default void getReplay( + com.google.cloud.policysimulator.v1.GetReplayRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetReplayMethod(), responseObserver); + } + + /** + * + * + *
+     * Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using
+     * the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
+     * 
+ */ + default void createReplay( + com.google.cloud.policysimulator.v1.CreateReplayRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateReplayMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists the results of running a
+     * [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ */ + default void listReplayResults( + com.google.cloud.policysimulator.v1.ListReplayResultsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListReplayResultsMethod(), responseObserver); + } + } + + /** + * Base class for the server implementation of the service Simulator. + * + *
+   * Policy Simulator API service.
+   * Policy Simulator is a collection of endpoints for creating, running, and
+   * viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A
+   * [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that
+   * lets you see how your principals' access to resources might change if you
+   * changed your IAM policy.
+   * During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator
+   * re-evaluates, or replays, past access attempts under both the current policy
+   * and  your proposed policy, and compares those results to determine how your
+   * principals' access might change under the proposed policy.
+   * 
+ */ + public abstract static class SimulatorImplBase implements io.grpc.BindableService, AsyncService { + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return SimulatorGrpc.bindService(this); + } + } + + /** + * A stub to allow clients to do asynchronous rpc calls to service Simulator. + * + *
+   * Policy Simulator API service.
+   * Policy Simulator is a collection of endpoints for creating, running, and
+   * viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A
+   * [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that
+   * lets you see how your principals' access to resources might change if you
+   * changed your IAM policy.
+   * During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator
+   * re-evaluates, or replays, past access attempts under both the current policy
+   * and  your proposed policy, and compares those results to determine how your
+   * principals' access might change under the proposed policy.
+   * 
+ */ + public static final class SimulatorStub extends io.grpc.stub.AbstractAsyncStub { + private SimulatorStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected SimulatorStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SimulatorStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
+     * `Replay` is available for at least 7 days.
+     * 
+ */ + public void getReplay( + com.google.cloud.policysimulator.v1.GetReplayRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetReplayMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using
+     * the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
+     * 
+ */ + public void createReplay( + com.google.cloud.policysimulator.v1.CreateReplayRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateReplayMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists the results of running a
+     * [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ */ + public void listReplayResults( + com.google.cloud.policysimulator.v1.ListReplayResultsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListReplayResultsMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * A stub to allow clients to do synchronous rpc calls to service Simulator. + * + *
+   * Policy Simulator API service.
+   * Policy Simulator is a collection of endpoints for creating, running, and
+   * viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A
+   * [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that
+   * lets you see how your principals' access to resources might change if you
+   * changed your IAM policy.
+   * During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator
+   * re-evaluates, or replays, past access attempts under both the current policy
+   * and  your proposed policy, and compares those results to determine how your
+   * principals' access might change under the proposed policy.
+   * 
+ */ + public static final class SimulatorBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private SimulatorBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected SimulatorBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SimulatorBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
+     * `Replay` is available for at least 7 days.
+     * 
+ */ + public com.google.cloud.policysimulator.v1.Replay getReplay( + com.google.cloud.policysimulator.v1.GetReplayRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetReplayMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using
+     * the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
+     * 
+ */ + public com.google.longrunning.Operation createReplay( + com.google.cloud.policysimulator.v1.CreateReplayRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateReplayMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists the results of running a
+     * [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ */ + public com.google.cloud.policysimulator.v1.ListReplayResultsResponse listReplayResults( + com.google.cloud.policysimulator.v1.ListReplayResultsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListReplayResultsMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service Simulator. + * + *
+   * Policy Simulator API service.
+   * Policy Simulator is a collection of endpoints for creating, running, and
+   * viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A
+   * [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that
+   * lets you see how your principals' access to resources might change if you
+   * changed your IAM policy.
+   * During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator
+   * re-evaluates, or replays, past access attempts under both the current policy
+   * and  your proposed policy, and compares those results to determine how your
+   * principals' access might change under the proposed policy.
+   * 
+ */ + public static final class SimulatorFutureStub + extends io.grpc.stub.AbstractFutureStub { + private SimulatorFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected SimulatorFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new SimulatorFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each
+     * `Replay` is available for at least 7 days.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.policysimulator.v1.Replay> + getReplay(com.google.cloud.policysimulator.v1.GetReplayRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetReplayMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using
+     * the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createReplay(com.google.cloud.policysimulator.v1.CreateReplayRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateReplayMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists the results of running a
+     * [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.policysimulator.v1.ListReplayResultsResponse> + listReplayResults(com.google.cloud.policysimulator.v1.ListReplayResultsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListReplayResultsMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_GET_REPLAY = 0; + private static final int METHODID_CREATE_REPLAY = 1; + private static final int METHODID_LIST_REPLAY_RESULTS = 2; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final AsyncService serviceImpl; + private final int methodId; + + MethodHandlers(AsyncService serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_GET_REPLAY: + serviceImpl.getReplay( + (com.google.cloud.policysimulator.v1.GetReplayRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_CREATE_REPLAY: + serviceImpl.createReplay( + (com.google.cloud.policysimulator.v1.CreateReplayRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_REPLAY_RESULTS: + serviceImpl.listReplayResults( + (com.google.cloud.policysimulator.v1.ListReplayResultsRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.policysimulator.v1.ListReplayResultsResponse>) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getGetReplayMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.policysimulator.v1.GetReplayRequest, + com.google.cloud.policysimulator.v1.Replay>(service, METHODID_GET_REPLAY))) + .addMethod( + getCreateReplayMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.policysimulator.v1.CreateReplayRequest, + com.google.longrunning.Operation>(service, METHODID_CREATE_REPLAY))) + .addMethod( + getListReplayResultsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.policysimulator.v1.ListReplayResultsRequest, + com.google.cloud.policysimulator.v1.ListReplayResultsResponse>( + service, METHODID_LIST_REPLAY_RESULTS))) + .build(); + } + + private abstract static class SimulatorBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + SimulatorBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Simulator"); + } + } + + private static final class SimulatorFileDescriptorSupplier + extends SimulatorBaseDescriptorSupplier { + SimulatorFileDescriptorSupplier() {} + } + + private static final class SimulatorMethodDescriptorSupplier + extends SimulatorBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + SimulatorMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (SimulatorGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new SimulatorFileDescriptorSupplier()) + .addMethod(getGetReplayMethod()) + .addMethod(getCreateReplayMethod()) + .addMethod(getListReplayResultsMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-policysimulator/owlbot.py b/java-policysimulator/owlbot.py new file mode 100644 index 000000000000..03c0f6686d3f --- /dev/null +++ b/java-policysimulator/owlbot.py @@ -0,0 +1,36 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import synthtool as s +from synthtool.languages import java + + +for library in s.get_staging_dirs(): + # put any special-case replacements here + s.move(library) + +s.remove_staging_dirs() +java.common_templates(monorepo=True, excludes=[ + ".github/*", + ".kokoro/*", + "samples/*", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "LICENSE", + "SECURITY.md", + "java.header", + "license-checks.xml", + "renovate.json", + ".gitignore" +]) \ No newline at end of file diff --git a/java-policysimulator/pom.xml b/java-policysimulator/pom.xml new file mode 100644 index 000000000000..fad6f5b1cb95 --- /dev/null +++ b/java-policysimulator/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + com.google.cloud + google-cloud-policysimulator-parent + pom + 0.0.1-SNAPSHOT + Google Policy Simulator API Parent + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-jar-parent + 1.16.0-SNAPSHOT + ../google-cloud-jar-parent/pom.xml + + + + UTF-8 + UTF-8 + github + google-cloud-policysimulator-parent + + + + + + com.google.cloud + google-cloud-policysimulator + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-policysimulator-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-policysimulator-v1 + 0.0.1-SNAPSHOT + + + + + + google-cloud-policysimulator + grpc-google-cloud-policysimulator-v1 + proto-google-cloud-policysimulator-v1 + google-cloud-policysimulator-bom + + + diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/clirr-ignored-differences.xml b/java-policysimulator/proto-google-cloud-policysimulator-v1/clirr-ignored-differences.xml new file mode 100644 index 000000000000..879c307c8914 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/cloud/policysimulator/v1/*OrBuilder + * get*(*) + + + 7012 + com/google/cloud/policysimulator/v1/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/cloud/policysimulator/v1/*OrBuilder + boolean has*(*) + + diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/pom.xml b/java-policysimulator/proto-google-cloud-policysimulator-v1/pom.xml new file mode 100644 index 000000000000..afeb005e9e61 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/pom.xml @@ -0,0 +1,37 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-policysimulator-v1 + 0.0.1-SNAPSHOT + proto-google-cloud-policysimulator-v1 + Proto library for google-cloud-policysimulator + + com.google.cloud + google-cloud-policysimulator-parent + 0.0.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessState.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessState.java new file mode 100644 index 000000000000..0b4098a843d5 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessState.java @@ -0,0 +1,228 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/explanations.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Whether a principal has a permission for a resource.
+ * 
+ * + * Protobuf enum {@code google.cloud.policysimulator.v1.AccessState} + */ +public enum AccessState implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Default value. This value is unused.
+   * 
+ * + * ACCESS_STATE_UNSPECIFIED = 0; + */ + ACCESS_STATE_UNSPECIFIED(0), + /** + * + * + *
+   * The principal has the permission.
+   * 
+ * + * GRANTED = 1; + */ + GRANTED(1), + /** + * + * + *
+   * The principal does not have the permission.
+   * 
+ * + * NOT_GRANTED = 2; + */ + NOT_GRANTED(2), + /** + * + * + *
+   * The principal has the permission only if a condition expression evaluates
+   * to `true`.
+   * 
+ * + * UNKNOWN_CONDITIONAL = 3; + */ + UNKNOWN_CONDITIONAL(3), + /** + * + * + *
+   * The user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to all of the policies that Policy Simulator needs to evaluate.
+   * 
+ * + * UNKNOWN_INFO_DENIED = 4; + */ + UNKNOWN_INFO_DENIED(4), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Default value. This value is unused.
+   * 
+ * + * ACCESS_STATE_UNSPECIFIED = 0; + */ + public static final int ACCESS_STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * The principal has the permission.
+   * 
+ * + * GRANTED = 1; + */ + public static final int GRANTED_VALUE = 1; + /** + * + * + *
+   * The principal does not have the permission.
+   * 
+ * + * NOT_GRANTED = 2; + */ + public static final int NOT_GRANTED_VALUE = 2; + /** + * + * + *
+   * The principal has the permission only if a condition expression evaluates
+   * to `true`.
+   * 
+ * + * UNKNOWN_CONDITIONAL = 3; + */ + public static final int UNKNOWN_CONDITIONAL_VALUE = 3; + /** + * + * + *
+   * The user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to all of the policies that Policy Simulator needs to evaluate.
+   * 
+ * + * UNKNOWN_INFO_DENIED = 4; + */ + public static final int UNKNOWN_INFO_DENIED_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AccessState 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 AccessState forNumber(int value) { + switch (value) { + case 0: + return ACCESS_STATE_UNSPECIFIED; + case 1: + return GRANTED; + case 2: + return NOT_GRANTED; + case 3: + return UNKNOWN_CONDITIONAL; + case 4: + return UNKNOWN_INFO_DENIED; + 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 AccessState findValueByNumber(int number) { + return AccessState.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final AccessState[] VALUES = values(); + + public static AccessState 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 AccessState(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.policysimulator.v1.AccessState) +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessStateDiff.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessStateDiff.java new file mode 100644 index 000000000000..c348f87244c2 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessStateDiff.java @@ -0,0 +1,1527 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * A summary and comparison of the principal's access under the current
+ * (baseline) policies and the proposed (simulated) policies for a single
+ * access tuple.
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.AccessStateDiff} + */ +public final class AccessStateDiff extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.AccessStateDiff) + AccessStateDiffOrBuilder { + private static final long serialVersionUID = 0L; + // Use AccessStateDiff.newBuilder() to construct. + private AccessStateDiff(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AccessStateDiff() { + accessChange_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AccessStateDiff(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_AccessStateDiff_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_AccessStateDiff_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.AccessStateDiff.class, + com.google.cloud.policysimulator.v1.AccessStateDiff.Builder.class); + } + + /** + * + * + *
+   * How the principal's access, specified in the AccessState field, changed
+   * between the current (baseline) policies and proposed (simulated) policies.
+   * 
+ * + * Protobuf enum {@code google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType} + */ + public enum AccessChangeType implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * ACCESS_CHANGE_TYPE_UNSPECIFIED = 0; + */ + ACCESS_CHANGE_TYPE_UNSPECIFIED(0), + /** + * + * + *
+     * The principal's access did not change.
+     * This includes the case where both baseline and simulated are UNKNOWN,
+     * but the unknown information is equivalent.
+     * 
+ * + * NO_CHANGE = 1; + */ + NO_CHANGE(1), + /** + * + * + *
+     * The principal's access under both the current policies and the proposed
+     * policies is `UNKNOWN`, but the unknown information differs between them.
+     * 
+ * + * UNKNOWN_CHANGE = 2; + */ + UNKNOWN_CHANGE(2), + /** + * + * + *
+     * The principal had access under the current policies (`GRANTED`), but will
+     * no longer have access after the proposed changes (`NOT_GRANTED`).
+     * 
+ * + * ACCESS_REVOKED = 3; + */ + ACCESS_REVOKED(3), + /** + * + * + *
+     * The principal did not have access under the current policies
+     * (`NOT_GRANTED`), but will have access after the proposed changes
+     * (`GRANTED`).
+     * 
+ * + * ACCESS_GAINED = 4; + */ + ACCESS_GAINED(4), + /** + * + * + *
+     * This result can occur for the following reasons:
+     *
+     * * The principal had access under the current policies (`GRANTED`), but
+     *   their access after the proposed changes is `UNKNOWN`.
+     *
+     * * The principal's access under the current policies is `UNKNOWN`, but
+     * they
+     *   will not have access after the proposed changes (`NOT_GRANTED`).
+     * 
+ * + * ACCESS_MAYBE_REVOKED = 5; + */ + ACCESS_MAYBE_REVOKED(5), + /** + * + * + *
+     * This result can occur for the following reasons:
+     *
+     * * The principal did not have access under the current policies
+     *   (`NOT_GRANTED`), but their access after the proposed changes is
+     *   `UNKNOWN`.
+     *
+     * * The principal's access under the current policies is `UNKNOWN`, but
+     * they will have access after the proposed changes (`GRANTED`).
+     * 
+ * + * ACCESS_MAYBE_GAINED = 6; + */ + ACCESS_MAYBE_GAINED(6), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * ACCESS_CHANGE_TYPE_UNSPECIFIED = 0; + */ + public static final int ACCESS_CHANGE_TYPE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The principal's access did not change.
+     * This includes the case where both baseline and simulated are UNKNOWN,
+     * but the unknown information is equivalent.
+     * 
+ * + * NO_CHANGE = 1; + */ + public static final int NO_CHANGE_VALUE = 1; + /** + * + * + *
+     * The principal's access under both the current policies and the proposed
+     * policies is `UNKNOWN`, but the unknown information differs between them.
+     * 
+ * + * UNKNOWN_CHANGE = 2; + */ + public static final int UNKNOWN_CHANGE_VALUE = 2; + /** + * + * + *
+     * The principal had access under the current policies (`GRANTED`), but will
+     * no longer have access after the proposed changes (`NOT_GRANTED`).
+     * 
+ * + * ACCESS_REVOKED = 3; + */ + public static final int ACCESS_REVOKED_VALUE = 3; + /** + * + * + *
+     * The principal did not have access under the current policies
+     * (`NOT_GRANTED`), but will have access after the proposed changes
+     * (`GRANTED`).
+     * 
+ * + * ACCESS_GAINED = 4; + */ + public static final int ACCESS_GAINED_VALUE = 4; + /** + * + * + *
+     * This result can occur for the following reasons:
+     *
+     * * The principal had access under the current policies (`GRANTED`), but
+     *   their access after the proposed changes is `UNKNOWN`.
+     *
+     * * The principal's access under the current policies is `UNKNOWN`, but
+     * they
+     *   will not have access after the proposed changes (`NOT_GRANTED`).
+     * 
+ * + * ACCESS_MAYBE_REVOKED = 5; + */ + public static final int ACCESS_MAYBE_REVOKED_VALUE = 5; + /** + * + * + *
+     * This result can occur for the following reasons:
+     *
+     * * The principal did not have access under the current policies
+     *   (`NOT_GRANTED`), but their access after the proposed changes is
+     *   `UNKNOWN`.
+     *
+     * * The principal's access under the current policies is `UNKNOWN`, but
+     * they will have access after the proposed changes (`GRANTED`).
+     * 
+ * + * ACCESS_MAYBE_GAINED = 6; + */ + public static final int ACCESS_MAYBE_GAINED_VALUE = 6; + + 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 AccessChangeType 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 AccessChangeType forNumber(int value) { + switch (value) { + case 0: + return ACCESS_CHANGE_TYPE_UNSPECIFIED; + case 1: + return NO_CHANGE; + case 2: + return UNKNOWN_CHANGE; + case 3: + return ACCESS_REVOKED; + case 4: + return ACCESS_GAINED; + case 5: + return ACCESS_MAYBE_REVOKED; + case 6: + return ACCESS_MAYBE_GAINED; + 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 AccessChangeType findValueByNumber(int number) { + return AccessChangeType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.AccessStateDiff.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final AccessChangeType[] VALUES = values(); + + public static AccessChangeType 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 AccessChangeType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType) + } + + public static final int BASELINE_FIELD_NUMBER = 1; + private com.google.cloud.policysimulator.v1.ExplainedAccess baseline_; + /** + * + * + *
+   * The results of evaluating the access tuple under the current (baseline)
+   * policies.
+   *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+   * be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + * + * @return Whether the baseline field is set. + */ + @java.lang.Override + public boolean hasBaseline() { + return baseline_ != null; + } + /** + * + * + *
+   * The results of evaluating the access tuple under the current (baseline)
+   * policies.
+   *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+   * be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + * + * @return The baseline. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedAccess getBaseline() { + return baseline_ == null + ? com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance() + : baseline_; + } + /** + * + * + *
+   * The results of evaluating the access tuple under the current (baseline)
+   * policies.
+   *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+   * be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder getBaselineOrBuilder() { + return baseline_ == null + ? com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance() + : baseline_; + } + + public static final int SIMULATED_FIELD_NUMBER = 2; + private com.google.cloud.policysimulator.v1.ExplainedAccess simulated_; + /** + * + * + *
+   * The results of evaluating the access tuple under the proposed (simulated)
+   * policies.
+   *
+   * If the AccessState couldn't be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + * + * @return Whether the simulated field is set. + */ + @java.lang.Override + public boolean hasSimulated() { + return simulated_ != null; + } + /** + * + * + *
+   * The results of evaluating the access tuple under the proposed (simulated)
+   * policies.
+   *
+   * If the AccessState couldn't be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + * + * @return The simulated. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedAccess getSimulated() { + return simulated_ == null + ? com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance() + : simulated_; + } + /** + * + * + *
+   * The results of evaluating the access tuple under the proposed (simulated)
+   * policies.
+   *
+   * If the AccessState couldn't be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder getSimulatedOrBuilder() { + return simulated_ == null + ? com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance() + : simulated_; + } + + public static final int ACCESS_CHANGE_FIELD_NUMBER = 3; + private int accessChange_ = 0; + /** + * + * + *
+   * How the principal's access, specified in the AccessState field, changed
+   * between the current (baseline) policies and proposed (simulated) policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType access_change = 3; + * + * + * @return The enum numeric value on the wire for accessChange. + */ + @java.lang.Override + public int getAccessChangeValue() { + return accessChange_; + } + /** + * + * + *
+   * How the principal's access, specified in the AccessState field, changed
+   * between the current (baseline) policies and proposed (simulated) policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType access_change = 3; + * + * + * @return The accessChange. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType getAccessChange() { + com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType result = + com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType.forNumber( + accessChange_); + return result == null + ? com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (baseline_ != null) { + output.writeMessage(1, getBaseline()); + } + if (simulated_ != null) { + output.writeMessage(2, getSimulated()); + } + if (accessChange_ + != com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType + .ACCESS_CHANGE_TYPE_UNSPECIFIED + .getNumber()) { + output.writeEnum(3, accessChange_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (baseline_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getBaseline()); + } + if (simulated_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSimulated()); + } + if (accessChange_ + != com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType + .ACCESS_CHANGE_TYPE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, accessChange_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.AccessStateDiff)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.AccessStateDiff other = + (com.google.cloud.policysimulator.v1.AccessStateDiff) obj; + + if (hasBaseline() != other.hasBaseline()) return false; + if (hasBaseline()) { + if (!getBaseline().equals(other.getBaseline())) return false; + } + if (hasSimulated() != other.hasSimulated()) return false; + if (hasSimulated()) { + if (!getSimulated().equals(other.getSimulated())) return false; + } + if (accessChange_ != other.accessChange_) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasBaseline()) { + hash = (37 * hash) + BASELINE_FIELD_NUMBER; + hash = (53 * hash) + getBaseline().hashCode(); + } + if (hasSimulated()) { + hash = (37 * hash) + SIMULATED_FIELD_NUMBER; + hash = (53 * hash) + getSimulated().hashCode(); + } + hash = (37 * hash) + ACCESS_CHANGE_FIELD_NUMBER; + hash = (53 * hash) + accessChange_; + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.AccessStateDiff parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.AccessStateDiff 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.policysimulator.v1.AccessStateDiff parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.AccessStateDiff 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.policysimulator.v1.AccessStateDiff parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.AccessStateDiff parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.AccessStateDiff parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.AccessStateDiff 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.policysimulator.v1.AccessStateDiff parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.AccessStateDiff 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.policysimulator.v1.AccessStateDiff parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.AccessStateDiff 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.policysimulator.v1.AccessStateDiff prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A summary and comparison of the principal's access under the current
+   * (baseline) policies and the proposed (simulated) policies for a single
+   * access tuple.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.AccessStateDiff} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.AccessStateDiff) + com.google.cloud.policysimulator.v1.AccessStateDiffOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_AccessStateDiff_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_AccessStateDiff_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.AccessStateDiff.class, + com.google.cloud.policysimulator.v1.AccessStateDiff.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.AccessStateDiff.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + baseline_ = null; + if (baselineBuilder_ != null) { + baselineBuilder_.dispose(); + baselineBuilder_ = null; + } + simulated_ = null; + if (simulatedBuilder_ != null) { + simulatedBuilder_.dispose(); + simulatedBuilder_ = null; + } + accessChange_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_AccessStateDiff_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessStateDiff getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.AccessStateDiff.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessStateDiff build() { + com.google.cloud.policysimulator.v1.AccessStateDiff result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessStateDiff buildPartial() { + com.google.cloud.policysimulator.v1.AccessStateDiff result = + new com.google.cloud.policysimulator.v1.AccessStateDiff(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.AccessStateDiff result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.baseline_ = baselineBuilder_ == null ? baseline_ : baselineBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.simulated_ = simulatedBuilder_ == null ? simulated_ : simulatedBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.accessChange_ = accessChange_; + } + } + + @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.policysimulator.v1.AccessStateDiff) { + return mergeFrom((com.google.cloud.policysimulator.v1.AccessStateDiff) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.AccessStateDiff other) { + if (other == com.google.cloud.policysimulator.v1.AccessStateDiff.getDefaultInstance()) + return this; + if (other.hasBaseline()) { + mergeBaseline(other.getBaseline()); + } + if (other.hasSimulated()) { + mergeSimulated(other.getSimulated()); + } + if (other.accessChange_ != 0) { + setAccessChangeValue(other.getAccessChangeValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getBaselineFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getSimulatedFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: + { + accessChange_ = input.readEnum(); + bitField0_ |= 0x00000004; + break; + } // case 24 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.cloud.policysimulator.v1.ExplainedAccess baseline_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ExplainedAccess, + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder, + com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder> + baselineBuilder_; + /** + * + * + *
+     * The results of evaluating the access tuple under the current (baseline)
+     * policies.
+     *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+     * be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + * + * @return Whether the baseline field is set. + */ + public boolean hasBaseline() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * The results of evaluating the access tuple under the current (baseline)
+     * policies.
+     *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+     * be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + * + * @return The baseline. + */ + public com.google.cloud.policysimulator.v1.ExplainedAccess getBaseline() { + if (baselineBuilder_ == null) { + return baseline_ == null + ? com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance() + : baseline_; + } else { + return baselineBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The results of evaluating the access tuple under the current (baseline)
+     * policies.
+     *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+     * be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + */ + public Builder setBaseline(com.google.cloud.policysimulator.v1.ExplainedAccess value) { + if (baselineBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + baseline_ = value; + } else { + baselineBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The results of evaluating the access tuple under the current (baseline)
+     * policies.
+     *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+     * be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + */ + public Builder setBaseline( + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder builderForValue) { + if (baselineBuilder_ == null) { + baseline_ = builderForValue.build(); + } else { + baselineBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The results of evaluating the access tuple under the current (baseline)
+     * policies.
+     *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+     * be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + */ + public Builder mergeBaseline(com.google.cloud.policysimulator.v1.ExplainedAccess value) { + if (baselineBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && baseline_ != null + && baseline_ + != com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance()) { + getBaselineBuilder().mergeFrom(value); + } else { + baseline_ = value; + } + } else { + baselineBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The results of evaluating the access tuple under the current (baseline)
+     * policies.
+     *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+     * be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + */ + public Builder clearBaseline() { + bitField0_ = (bitField0_ & ~0x00000001); + baseline_ = null; + if (baselineBuilder_ != null) { + baselineBuilder_.dispose(); + baselineBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The results of evaluating the access tuple under the current (baseline)
+     * policies.
+     *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+     * be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + */ + public com.google.cloud.policysimulator.v1.ExplainedAccess.Builder getBaselineBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getBaselineFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The results of evaluating the access tuple under the current (baseline)
+     * policies.
+     *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+     * be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + */ + public com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder getBaselineOrBuilder() { + if (baselineBuilder_ != null) { + return baselineBuilder_.getMessageOrBuilder(); + } else { + return baseline_ == null + ? com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance() + : baseline_; + } + } + /** + * + * + *
+     * The results of evaluating the access tuple under the current (baseline)
+     * policies.
+     *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+     * be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ExplainedAccess, + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder, + com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder> + getBaselineFieldBuilder() { + if (baselineBuilder_ == null) { + baselineBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ExplainedAccess, + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder, + com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder>( + getBaseline(), getParentForChildren(), isClean()); + baseline_ = null; + } + return baselineBuilder_; + } + + private com.google.cloud.policysimulator.v1.ExplainedAccess simulated_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ExplainedAccess, + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder, + com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder> + simulatedBuilder_; + /** + * + * + *
+     * The results of evaluating the access tuple under the proposed (simulated)
+     * policies.
+     *
+     * If the AccessState couldn't be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + * + * @return Whether the simulated field is set. + */ + public boolean hasSimulated() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * The results of evaluating the access tuple under the proposed (simulated)
+     * policies.
+     *
+     * If the AccessState couldn't be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + * + * @return The simulated. + */ + public com.google.cloud.policysimulator.v1.ExplainedAccess getSimulated() { + if (simulatedBuilder_ == null) { + return simulated_ == null + ? com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance() + : simulated_; + } else { + return simulatedBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The results of evaluating the access tuple under the proposed (simulated)
+     * policies.
+     *
+     * If the AccessState couldn't be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + */ + public Builder setSimulated(com.google.cloud.policysimulator.v1.ExplainedAccess value) { + if (simulatedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + simulated_ = value; + } else { + simulatedBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The results of evaluating the access tuple under the proposed (simulated)
+     * policies.
+     *
+     * If the AccessState couldn't be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + */ + public Builder setSimulated( + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder builderForValue) { + if (simulatedBuilder_ == null) { + simulated_ = builderForValue.build(); + } else { + simulatedBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The results of evaluating the access tuple under the proposed (simulated)
+     * policies.
+     *
+     * If the AccessState couldn't be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + */ + public Builder mergeSimulated(com.google.cloud.policysimulator.v1.ExplainedAccess value) { + if (simulatedBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && simulated_ != null + && simulated_ + != com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance()) { + getSimulatedBuilder().mergeFrom(value); + } else { + simulated_ = value; + } + } else { + simulatedBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The results of evaluating the access tuple under the proposed (simulated)
+     * policies.
+     *
+     * If the AccessState couldn't be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + */ + public Builder clearSimulated() { + bitField0_ = (bitField0_ & ~0x00000002); + simulated_ = null; + if (simulatedBuilder_ != null) { + simulatedBuilder_.dispose(); + simulatedBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The results of evaluating the access tuple under the proposed (simulated)
+     * policies.
+     *
+     * If the AccessState couldn't be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + */ + public com.google.cloud.policysimulator.v1.ExplainedAccess.Builder getSimulatedBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getSimulatedFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The results of evaluating the access tuple under the proposed (simulated)
+     * policies.
+     *
+     * If the AccessState couldn't be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + */ + public com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder getSimulatedOrBuilder() { + if (simulatedBuilder_ != null) { + return simulatedBuilder_.getMessageOrBuilder(); + } else { + return simulated_ == null + ? com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance() + : simulated_; + } + } + /** + * + * + *
+     * The results of evaluating the access tuple under the proposed (simulated)
+     * policies.
+     *
+     * If the AccessState couldn't be fully evaluated, this field explains why.
+     * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ExplainedAccess, + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder, + com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder> + getSimulatedFieldBuilder() { + if (simulatedBuilder_ == null) { + simulatedBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ExplainedAccess, + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder, + com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder>( + getSimulated(), getParentForChildren(), isClean()); + simulated_ = null; + } + return simulatedBuilder_; + } + + private int accessChange_ = 0; + /** + * + * + *
+     * How the principal's access, specified in the AccessState field, changed
+     * between the current (baseline) policies and proposed (simulated) policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType access_change = 3; + * + * + * @return The enum numeric value on the wire for accessChange. + */ + @java.lang.Override + public int getAccessChangeValue() { + return accessChange_; + } + /** + * + * + *
+     * How the principal's access, specified in the AccessState field, changed
+     * between the current (baseline) policies and proposed (simulated) policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType access_change = 3; + * + * + * @param value The enum numeric value on the wire for accessChange to set. + * @return This builder for chaining. + */ + public Builder setAccessChangeValue(int value) { + accessChange_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * How the principal's access, specified in the AccessState field, changed
+     * between the current (baseline) policies and proposed (simulated) policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType access_change = 3; + * + * + * @return The accessChange. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType getAccessChange() { + com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType result = + com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType.forNumber( + accessChange_); + return result == null + ? com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * How the principal's access, specified in the AccessState field, changed
+     * between the current (baseline) policies and proposed (simulated) policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType access_change = 3; + * + * + * @param value The accessChange to set. + * @return This builder for chaining. + */ + public Builder setAccessChange( + com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + accessChange_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * How the principal's access, specified in the AccessState field, changed
+     * between the current (baseline) policies and proposed (simulated) policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType access_change = 3; + * + * + * @return This builder for chaining. + */ + public Builder clearAccessChange() { + bitField0_ = (bitField0_ & ~0x00000004); + accessChange_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.policysimulator.v1.AccessStateDiff) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.AccessStateDiff) + private static final com.google.cloud.policysimulator.v1.AccessStateDiff DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.AccessStateDiff(); + } + + public static com.google.cloud.policysimulator.v1.AccessStateDiff getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AccessStateDiff parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessStateDiff getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessStateDiffOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessStateDiffOrBuilder.java new file mode 100644 index 000000000000..02c781c823fe --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessStateDiffOrBuilder.java @@ -0,0 +1,145 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface AccessStateDiffOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.AccessStateDiff) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The results of evaluating the access tuple under the current (baseline)
+   * policies.
+   *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+   * be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + * + * @return Whether the baseline field is set. + */ + boolean hasBaseline(); + /** + * + * + *
+   * The results of evaluating the access tuple under the current (baseline)
+   * policies.
+   *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+   * be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + * + * @return The baseline. + */ + com.google.cloud.policysimulator.v1.ExplainedAccess getBaseline(); + /** + * + * + *
+   * The results of evaluating the access tuple under the current (baseline)
+   * policies.
+   *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't
+   * be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess baseline = 1; + */ + com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder getBaselineOrBuilder(); + + /** + * + * + *
+   * The results of evaluating the access tuple under the proposed (simulated)
+   * policies.
+   *
+   * If the AccessState couldn't be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + * + * @return Whether the simulated field is set. + */ + boolean hasSimulated(); + /** + * + * + *
+   * The results of evaluating the access tuple under the proposed (simulated)
+   * policies.
+   *
+   * If the AccessState couldn't be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + * + * @return The simulated. + */ + com.google.cloud.policysimulator.v1.ExplainedAccess getSimulated(); + /** + * + * + *
+   * The results of evaluating the access tuple under the proposed (simulated)
+   * policies.
+   *
+   * If the AccessState couldn't be fully evaluated, this field explains why.
+   * 
+ * + * .google.cloud.policysimulator.v1.ExplainedAccess simulated = 2; + */ + com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder getSimulatedOrBuilder(); + + /** + * + * + *
+   * How the principal's access, specified in the AccessState field, changed
+   * between the current (baseline) policies and proposed (simulated) policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType access_change = 3; + * + * + * @return The enum numeric value on the wire for accessChange. + */ + int getAccessChangeValue(); + /** + * + * + *
+   * How the principal's access, specified in the AccessState field, changed
+   * between the current (baseline) policies and proposed (simulated) policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType access_change = 3; + * + * + * @return The accessChange. + */ + com.google.cloud.policysimulator.v1.AccessStateDiff.AccessChangeType getAccessChange(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessTuple.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessTuple.java new file mode 100644 index 000000000000..a89087183521 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessTuple.java @@ -0,0 +1,1107 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/explanations.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Information about the principal, resource, and permission to check.
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.AccessTuple} + */ +public final class AccessTuple extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.AccessTuple) + AccessTupleOrBuilder { + private static final long serialVersionUID = 0L; + // Use AccessTuple.newBuilder() to construct. + private AccessTuple(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AccessTuple() { + principal_ = ""; + fullResourceName_ = ""; + permission_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AccessTuple(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_AccessTuple_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_AccessTuple_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.AccessTuple.class, + com.google.cloud.policysimulator.v1.AccessTuple.Builder.class); + } + + public static final int PRINCIPAL_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object principal_ = ""; + /** + * + * + *
+   * Required. The principal whose access you want to check, in the form of
+   * the email address that represents that principal. For example,
+   * `alice@example.com` or
+   * `my-service-account@my-project.iam.gserviceaccount.com`.
+   *
+   * The principal must be a Google Account or a service account. Other types of
+   * principals are not supported.
+   * 
+ * + * string principal = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The principal. + */ + @java.lang.Override + public java.lang.String getPrincipal() { + java.lang.Object ref = principal_; + 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(); + principal_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The principal whose access you want to check, in the form of
+   * the email address that represents that principal. For example,
+   * `alice@example.com` or
+   * `my-service-account@my-project.iam.gserviceaccount.com`.
+   *
+   * The principal must be a Google Account or a service account. Other types of
+   * principals are not supported.
+   * 
+ * + * string principal = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for principal. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPrincipalBytes() { + java.lang.Object ref = principal_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + principal_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FULL_RESOURCE_NAME_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object fullResourceName_ = ""; + /** + * + * + *
+   * Required. The full resource name that identifies the resource. For example,
+   * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+   *
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   * 
+ * + * string full_resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The fullResourceName. + */ + @java.lang.Override + public java.lang.String getFullResourceName() { + java.lang.Object ref = fullResourceName_; + 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(); + fullResourceName_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The full resource name that identifies the resource. For example,
+   * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+   *
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   * 
+ * + * string full_resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for fullResourceName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFullResourceNameBytes() { + java.lang.Object ref = fullResourceName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + fullResourceName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PERMISSION_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object permission_ = ""; + /** + * + * + *
+   * Required. The IAM permission to check for the specified principal and
+   * resource.
+   *
+   * For a complete list of IAM permissions, see
+   * https://cloud.google.com/iam/help/permissions/reference.
+   *
+   * For a complete list of predefined IAM roles and the permissions in each
+   * role, see https://cloud.google.com/iam/help/roles/reference.
+   * 
+ * + * string permission = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The permission. + */ + @java.lang.Override + public java.lang.String getPermission() { + java.lang.Object ref = permission_; + 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(); + permission_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The IAM permission to check for the specified principal and
+   * resource.
+   *
+   * For a complete list of IAM permissions, see
+   * https://cloud.google.com/iam/help/permissions/reference.
+   *
+   * For a complete list of predefined IAM roles and the permissions in each
+   * role, see https://cloud.google.com/iam/help/roles/reference.
+   * 
+ * + * string permission = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for permission. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPermissionBytes() { + java.lang.Object ref = permission_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + permission_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(principal_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, principal_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(fullResourceName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, fullResourceName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(permission_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, permission_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(principal_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, principal_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(fullResourceName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, fullResourceName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(permission_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, permission_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.AccessTuple)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.AccessTuple other = + (com.google.cloud.policysimulator.v1.AccessTuple) obj; + + if (!getPrincipal().equals(other.getPrincipal())) return false; + if (!getFullResourceName().equals(other.getFullResourceName())) return false; + if (!getPermission().equals(other.getPermission())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PRINCIPAL_FIELD_NUMBER; + hash = (53 * hash) + getPrincipal().hashCode(); + hash = (37 * hash) + FULL_RESOURCE_NAME_FIELD_NUMBER; + hash = (53 * hash) + getFullResourceName().hashCode(); + hash = (37 * hash) + PERMISSION_FIELD_NUMBER; + hash = (53 * hash) + getPermission().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.AccessTuple parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.AccessTuple 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.policysimulator.v1.AccessTuple parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.AccessTuple 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.policysimulator.v1.AccessTuple parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.AccessTuple parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.AccessTuple parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.AccessTuple 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.policysimulator.v1.AccessTuple parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.AccessTuple 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.policysimulator.v1.AccessTuple parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.AccessTuple 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.policysimulator.v1.AccessTuple 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; + } + /** + * + * + *
+   * Information about the principal, resource, and permission to check.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.AccessTuple} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.AccessTuple) + com.google.cloud.policysimulator.v1.AccessTupleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_AccessTuple_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_AccessTuple_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.AccessTuple.class, + com.google.cloud.policysimulator.v1.AccessTuple.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.AccessTuple.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + principal_ = ""; + fullResourceName_ = ""; + permission_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_AccessTuple_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessTuple getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.AccessTuple.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessTuple build() { + com.google.cloud.policysimulator.v1.AccessTuple result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessTuple buildPartial() { + com.google.cloud.policysimulator.v1.AccessTuple result = + new com.google.cloud.policysimulator.v1.AccessTuple(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.AccessTuple result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.principal_ = principal_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.fullResourceName_ = fullResourceName_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.permission_ = permission_; + } + } + + @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.policysimulator.v1.AccessTuple) { + return mergeFrom((com.google.cloud.policysimulator.v1.AccessTuple) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.AccessTuple other) { + if (other == com.google.cloud.policysimulator.v1.AccessTuple.getDefaultInstance()) + return this; + if (!other.getPrincipal().isEmpty()) { + principal_ = other.principal_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getFullResourceName().isEmpty()) { + fullResourceName_ = other.fullResourceName_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getPermission().isEmpty()) { + permission_ = other.permission_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + principal_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + fullResourceName_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + permission_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object principal_ = ""; + /** + * + * + *
+     * Required. The principal whose access you want to check, in the form of
+     * the email address that represents that principal. For example,
+     * `alice@example.com` or
+     * `my-service-account@my-project.iam.gserviceaccount.com`.
+     *
+     * The principal must be a Google Account or a service account. Other types of
+     * principals are not supported.
+     * 
+ * + * string principal = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The principal. + */ + public java.lang.String getPrincipal() { + java.lang.Object ref = principal_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + principal_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The principal whose access you want to check, in the form of
+     * the email address that represents that principal. For example,
+     * `alice@example.com` or
+     * `my-service-account@my-project.iam.gserviceaccount.com`.
+     *
+     * The principal must be a Google Account or a service account. Other types of
+     * principals are not supported.
+     * 
+ * + * string principal = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for principal. + */ + public com.google.protobuf.ByteString getPrincipalBytes() { + java.lang.Object ref = principal_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + principal_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The principal whose access you want to check, in the form of
+     * the email address that represents that principal. For example,
+     * `alice@example.com` or
+     * `my-service-account@my-project.iam.gserviceaccount.com`.
+     *
+     * The principal must be a Google Account or a service account. Other types of
+     * principals are not supported.
+     * 
+ * + * string principal = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The principal to set. + * @return This builder for chaining. + */ + public Builder setPrincipal(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + principal_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The principal whose access you want to check, in the form of
+     * the email address that represents that principal. For example,
+     * `alice@example.com` or
+     * `my-service-account@my-project.iam.gserviceaccount.com`.
+     *
+     * The principal must be a Google Account or a service account. Other types of
+     * principals are not supported.
+     * 
+ * + * string principal = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearPrincipal() { + principal_ = getDefaultInstance().getPrincipal(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The principal whose access you want to check, in the form of
+     * the email address that represents that principal. For example,
+     * `alice@example.com` or
+     * `my-service-account@my-project.iam.gserviceaccount.com`.
+     *
+     * The principal must be a Google Account or a service account. Other types of
+     * principals are not supported.
+     * 
+ * + * string principal = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for principal to set. + * @return This builder for chaining. + */ + public Builder setPrincipalBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + principal_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object fullResourceName_ = ""; + /** + * + * + *
+     * Required. The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The fullResourceName. + */ + public java.lang.String getFullResourceName() { + java.lang.Object ref = fullResourceName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + fullResourceName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for fullResourceName. + */ + public com.google.protobuf.ByteString getFullResourceNameBytes() { + java.lang.Object ref = fullResourceName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + fullResourceName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The fullResourceName to set. + * @return This builder for chaining. + */ + public Builder setFullResourceName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + fullResourceName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearFullResourceName() { + fullResourceName_ = getDefaultInstance().getFullResourceName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for fullResourceName to set. + * @return This builder for chaining. + */ + public Builder setFullResourceNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + fullResourceName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object permission_ = ""; + /** + * + * + *
+     * Required. The IAM permission to check for the specified principal and
+     * resource.
+     *
+     * For a complete list of IAM permissions, see
+     * https://cloud.google.com/iam/help/permissions/reference.
+     *
+     * For a complete list of predefined IAM roles and the permissions in each
+     * role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string permission = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The permission. + */ + public java.lang.String getPermission() { + java.lang.Object ref = permission_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + permission_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The IAM permission to check for the specified principal and
+     * resource.
+     *
+     * For a complete list of IAM permissions, see
+     * https://cloud.google.com/iam/help/permissions/reference.
+     *
+     * For a complete list of predefined IAM roles and the permissions in each
+     * role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string permission = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for permission. + */ + public com.google.protobuf.ByteString getPermissionBytes() { + java.lang.Object ref = permission_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + permission_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The IAM permission to check for the specified principal and
+     * resource.
+     *
+     * For a complete list of IAM permissions, see
+     * https://cloud.google.com/iam/help/permissions/reference.
+     *
+     * For a complete list of predefined IAM roles and the permissions in each
+     * role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string permission = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The permission to set. + * @return This builder for chaining. + */ + public Builder setPermission(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + permission_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The IAM permission to check for the specified principal and
+     * resource.
+     *
+     * For a complete list of IAM permissions, see
+     * https://cloud.google.com/iam/help/permissions/reference.
+     *
+     * For a complete list of predefined IAM roles and the permissions in each
+     * role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string permission = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearPermission() { + permission_ = getDefaultInstance().getPermission(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The IAM permission to check for the specified principal and
+     * resource.
+     *
+     * For a complete list of IAM permissions, see
+     * https://cloud.google.com/iam/help/permissions/reference.
+     *
+     * For a complete list of predefined IAM roles and the permissions in each
+     * role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string permission = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for permission to set. + * @return This builder for chaining. + */ + public Builder setPermissionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + permission_ = value; + bitField0_ |= 0x00000004; + 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.policysimulator.v1.AccessTuple) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.AccessTuple) + private static final com.google.cloud.policysimulator.v1.AccessTuple DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.AccessTuple(); + } + + public static com.google.cloud.policysimulator.v1.AccessTuple getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AccessTuple parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessTuple getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessTupleOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessTupleOrBuilder.java new file mode 100644 index 000000000000..a750a3081f83 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/AccessTupleOrBuilder.java @@ -0,0 +1,134 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/explanations.proto + +package com.google.cloud.policysimulator.v1; + +public interface AccessTupleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.AccessTuple) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The principal whose access you want to check, in the form of
+   * the email address that represents that principal. For example,
+   * `alice@example.com` or
+   * `my-service-account@my-project.iam.gserviceaccount.com`.
+   *
+   * The principal must be a Google Account or a service account. Other types of
+   * principals are not supported.
+   * 
+ * + * string principal = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The principal. + */ + java.lang.String getPrincipal(); + /** + * + * + *
+   * Required. The principal whose access you want to check, in the form of
+   * the email address that represents that principal. For example,
+   * `alice@example.com` or
+   * `my-service-account@my-project.iam.gserviceaccount.com`.
+   *
+   * The principal must be a Google Account or a service account. Other types of
+   * principals are not supported.
+   * 
+ * + * string principal = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for principal. + */ + com.google.protobuf.ByteString getPrincipalBytes(); + + /** + * + * + *
+   * Required. The full resource name that identifies the resource. For example,
+   * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+   *
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   * 
+ * + * string full_resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The fullResourceName. + */ + java.lang.String getFullResourceName(); + /** + * + * + *
+   * Required. The full resource name that identifies the resource. For example,
+   * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+   *
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   * 
+ * + * string full_resource_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for fullResourceName. + */ + com.google.protobuf.ByteString getFullResourceNameBytes(); + + /** + * + * + *
+   * Required. The IAM permission to check for the specified principal and
+   * resource.
+   *
+   * For a complete list of IAM permissions, see
+   * https://cloud.google.com/iam/help/permissions/reference.
+   *
+   * For a complete list of predefined IAM roles and the permissions in each
+   * role, see https://cloud.google.com/iam/help/roles/reference.
+   * 
+ * + * string permission = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The permission. + */ + java.lang.String getPermission(); + /** + * + * + *
+   * Required. The IAM permission to check for the specified principal and
+   * resource.
+   *
+   * For a complete list of IAM permissions, see
+   * https://cloud.google.com/iam/help/permissions/reference.
+   *
+   * For a complete list of predefined IAM roles and the permissions in each
+   * role, see https://cloud.google.com/iam/help/roles/reference.
+   * 
+ * + * string permission = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for permission. + */ + com.google.protobuf.ByteString getPermissionBytes(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/BindingExplanation.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/BindingExplanation.java new file mode 100644 index 000000000000..82e3ba786737 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/BindingExplanation.java @@ -0,0 +1,3546 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/explanations.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Details about how a binding in a policy affects a principal's ability to use
+ * a permission.
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.BindingExplanation} + */ +public final class BindingExplanation extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.BindingExplanation) + BindingExplanationOrBuilder { + private static final long serialVersionUID = 0L; + // Use BindingExplanation.newBuilder() to construct. + private BindingExplanation(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BindingExplanation() { + access_ = 0; + role_ = ""; + rolePermission_ = 0; + rolePermissionRelevance_ = 0; + relevance_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BindingExplanation(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 5: + return internalGetMemberships(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.BindingExplanation.class, + com.google.cloud.policysimulator.v1.BindingExplanation.Builder.class); + } + + /** + * + * + *
+   * Whether a role includes a specific permission.
+   * 
+ * + * Protobuf enum {@code google.cloud.policysimulator.v1.BindingExplanation.RolePermission} + */ + public enum RolePermission implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * ROLE_PERMISSION_UNSPECIFIED = 0; + */ + ROLE_PERMISSION_UNSPECIFIED(0), + /** + * + * + *
+     * The permission is included in the role.
+     * 
+ * + * ROLE_PERMISSION_INCLUDED = 1; + */ + ROLE_PERMISSION_INCLUDED(1), + /** + * + * + *
+     * The permission is not included in the role.
+     * 
+ * + * ROLE_PERMISSION_NOT_INCLUDED = 2; + */ + ROLE_PERMISSION_NOT_INCLUDED(2), + /** + * + * + *
+     * The user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] is not
+     * allowed to access the binding.
+     * 
+ * + * ROLE_PERMISSION_UNKNOWN_INFO_DENIED = 3; + */ + ROLE_PERMISSION_UNKNOWN_INFO_DENIED(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * ROLE_PERMISSION_UNSPECIFIED = 0; + */ + public static final int ROLE_PERMISSION_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The permission is included in the role.
+     * 
+ * + * ROLE_PERMISSION_INCLUDED = 1; + */ + public static final int ROLE_PERMISSION_INCLUDED_VALUE = 1; + /** + * + * + *
+     * The permission is not included in the role.
+     * 
+ * + * ROLE_PERMISSION_NOT_INCLUDED = 2; + */ + public static final int ROLE_PERMISSION_NOT_INCLUDED_VALUE = 2; + /** + * + * + *
+     * The user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] is not
+     * allowed to access the binding.
+     * 
+ * + * ROLE_PERMISSION_UNKNOWN_INFO_DENIED = 3; + */ + public static final int ROLE_PERMISSION_UNKNOWN_INFO_DENIED_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static RolePermission 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 RolePermission forNumber(int value) { + switch (value) { + case 0: + return ROLE_PERMISSION_UNSPECIFIED; + case 1: + return ROLE_PERMISSION_INCLUDED; + case 2: + return ROLE_PERMISSION_NOT_INCLUDED; + case 3: + return ROLE_PERMISSION_UNKNOWN_INFO_DENIED; + 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 RolePermission findValueByNumber(int number) { + return RolePermission.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.BindingExplanation.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final RolePermission[] VALUES = values(); + + public static RolePermission 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 RolePermission(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.policysimulator.v1.BindingExplanation.RolePermission) + } + + /** + * + * + *
+   * Whether the binding includes the principal.
+   * 
+ * + * Protobuf enum {@code google.cloud.policysimulator.v1.BindingExplanation.Membership} + */ + public enum Membership implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * MEMBERSHIP_UNSPECIFIED = 0; + */ + MEMBERSHIP_UNSPECIFIED(0), + /** + * + * + *
+     * The binding includes the principal. The principal can be included
+     * directly or indirectly. For example:
+     *
+     * * A principal is included directly if that principal is listed in the
+     *   binding.
+     * * A principal is included indirectly if that principal is in a Google
+     *   group or Google Workspace domain that is listed in the binding.
+     * 
+ * + * MEMBERSHIP_INCLUDED = 1; + */ + MEMBERSHIP_INCLUDED(1), + /** + * + * + *
+     * The binding does not include the principal.
+     * 
+ * + * MEMBERSHIP_NOT_INCLUDED = 2; + */ + MEMBERSHIP_NOT_INCLUDED(2), + /** + * + * + *
+     * The user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] is not
+     * allowed to access the binding.
+     * 
+ * + * MEMBERSHIP_UNKNOWN_INFO_DENIED = 3; + */ + MEMBERSHIP_UNKNOWN_INFO_DENIED(3), + /** + * + * + *
+     * The principal is an unsupported type. Only Google Accounts and service
+     * accounts are supported.
+     * 
+ * + * MEMBERSHIP_UNKNOWN_UNSUPPORTED = 4; + */ + MEMBERSHIP_UNKNOWN_UNSUPPORTED(4), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * MEMBERSHIP_UNSPECIFIED = 0; + */ + public static final int MEMBERSHIP_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The binding includes the principal. The principal can be included
+     * directly or indirectly. For example:
+     *
+     * * A principal is included directly if that principal is listed in the
+     *   binding.
+     * * A principal is included indirectly if that principal is in a Google
+     *   group or Google Workspace domain that is listed in the binding.
+     * 
+ * + * MEMBERSHIP_INCLUDED = 1; + */ + public static final int MEMBERSHIP_INCLUDED_VALUE = 1; + /** + * + * + *
+     * The binding does not include the principal.
+     * 
+ * + * MEMBERSHIP_NOT_INCLUDED = 2; + */ + public static final int MEMBERSHIP_NOT_INCLUDED_VALUE = 2; + /** + * + * + *
+     * The user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] is not
+     * allowed to access the binding.
+     * 
+ * + * MEMBERSHIP_UNKNOWN_INFO_DENIED = 3; + */ + public static final int MEMBERSHIP_UNKNOWN_INFO_DENIED_VALUE = 3; + /** + * + * + *
+     * The principal is an unsupported type. Only Google Accounts and service
+     * accounts are supported.
+     * 
+ * + * MEMBERSHIP_UNKNOWN_UNSUPPORTED = 4; + */ + public static final int MEMBERSHIP_UNKNOWN_UNSUPPORTED_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Membership 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 Membership forNumber(int value) { + switch (value) { + case 0: + return MEMBERSHIP_UNSPECIFIED; + case 1: + return MEMBERSHIP_INCLUDED; + case 2: + return MEMBERSHIP_NOT_INCLUDED; + case 3: + return MEMBERSHIP_UNKNOWN_INFO_DENIED; + case 4: + return MEMBERSHIP_UNKNOWN_UNSUPPORTED; + 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 Membership findValueByNumber(int number) { + return Membership.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.BindingExplanation.getDescriptor() + .getEnumTypes() + .get(1); + } + + private static final Membership[] VALUES = values(); + + public static Membership 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 Membership(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.policysimulator.v1.BindingExplanation.Membership) + } + + public interface AnnotatedMembershipOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Indicates whether the binding includes the principal.
+     * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.Membership membership = 1; + * + * @return The enum numeric value on the wire for membership. + */ + int getMembershipValue(); + /** + * + * + *
+     * Indicates whether the binding includes the principal.
+     * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.Membership membership = 1; + * + * @return The membership. + */ + com.google.cloud.policysimulator.v1.BindingExplanation.Membership getMembership(); + + /** + * + * + *
+     * The relevance of the principal's status to the overall determination for
+     * the binding.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 2; + * + * @return The enum numeric value on the wire for relevance. + */ + int getRelevanceValue(); + /** + * + * + *
+     * The relevance of the principal's status to the overall determination for
+     * the binding.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 2; + * + * @return The relevance. + */ + com.google.cloud.policysimulator.v1.HeuristicRelevance getRelevance(); + } + /** + * + * + *
+   * Details about whether the binding includes the principal.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership} + */ + public static final class AnnotatedMembership extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership) + AnnotatedMembershipOrBuilder { + private static final long serialVersionUID = 0L; + // Use AnnotatedMembership.newBuilder() to construct. + private AnnotatedMembership(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AnnotatedMembership() { + membership_ = 0; + relevance_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AnnotatedMembership(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership.class, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership.Builder + .class); + } + + public static final int MEMBERSHIP_FIELD_NUMBER = 1; + private int membership_ = 0; + /** + * + * + *
+     * Indicates whether the binding includes the principal.
+     * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.Membership membership = 1; + * + * @return The enum numeric value on the wire for membership. + */ + @java.lang.Override + public int getMembershipValue() { + return membership_; + } + /** + * + * + *
+     * Indicates whether the binding includes the principal.
+     * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.Membership membership = 1; + * + * @return The membership. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.Membership getMembership() { + com.google.cloud.policysimulator.v1.BindingExplanation.Membership result = + com.google.cloud.policysimulator.v1.BindingExplanation.Membership.forNumber(membership_); + return result == null + ? com.google.cloud.policysimulator.v1.BindingExplanation.Membership.UNRECOGNIZED + : result; + } + + public static final int RELEVANCE_FIELD_NUMBER = 2; + private int relevance_ = 0; + /** + * + * + *
+     * The relevance of the principal's status to the overall determination for
+     * the binding.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 2; + * + * @return The enum numeric value on the wire for relevance. + */ + @java.lang.Override + public int getRelevanceValue() { + return relevance_; + } + /** + * + * + *
+     * The relevance of the principal's status to the overall determination for
+     * the binding.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 2; + * + * @return The relevance. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.HeuristicRelevance getRelevance() { + com.google.cloud.policysimulator.v1.HeuristicRelevance result = + com.google.cloud.policysimulator.v1.HeuristicRelevance.forNumber(relevance_); + return result == null + ? com.google.cloud.policysimulator.v1.HeuristicRelevance.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (membership_ + != com.google.cloud.policysimulator.v1.BindingExplanation.Membership + .MEMBERSHIP_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, membership_); + } + if (relevance_ + != com.google.cloud.policysimulator.v1.HeuristicRelevance.HEURISTIC_RELEVANCE_UNSPECIFIED + .getNumber()) { + output.writeEnum(2, relevance_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (membership_ + != com.google.cloud.policysimulator.v1.BindingExplanation.Membership + .MEMBERSHIP_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, membership_); + } + if (relevance_ + != com.google.cloud.policysimulator.v1.HeuristicRelevance.HEURISTIC_RELEVANCE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, relevance_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership other = + (com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership) obj; + + if (membership_ != other.membership_) return false; + if (relevance_ != other.relevance_) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MEMBERSHIP_FIELD_NUMBER; + hash = (53 * hash) + membership_; + hash = (37 * hash) + RELEVANCE_FIELD_NUMBER; + hash = (53 * hash) + relevance_; + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + 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.policysimulator.v1.BindingExplanation.AnnotatedMembership + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + 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.policysimulator.v1.BindingExplanation.AnnotatedMembership + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + 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.policysimulator.v1.BindingExplanation.AnnotatedMembership + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + 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.policysimulator.v1.BindingExplanation.AnnotatedMembership + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + 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.policysimulator.v1.BindingExplanation.AnnotatedMembership prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Details about whether the binding includes the principal.
+     * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership) + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembershipOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership.class, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership.Builder + .class); + } + + // Construct using + // com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + membership_ = 0; + relevance_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership build() { + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + buildPartial() { + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership result = + new com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.membership_ = membership_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.relevance_ = relevance_; + } + } + + @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.policysimulator.v1.BindingExplanation.AnnotatedMembership) { + return mergeFrom( + (com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership other) { + if (other + == com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + .getDefaultInstance()) return this; + if (other.membership_ != 0) { + setMembershipValue(other.getMembershipValue()); + } + if (other.relevance_ != 0) { + setRelevanceValue(other.getRelevanceValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + membership_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: + { + relevance_ = input.readEnum(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int membership_ = 0; + /** + * + * + *
+       * Indicates whether the binding includes the principal.
+       * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.Membership membership = 1; + * + * @return The enum numeric value on the wire for membership. + */ + @java.lang.Override + public int getMembershipValue() { + return membership_; + } + /** + * + * + *
+       * Indicates whether the binding includes the principal.
+       * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.Membership membership = 1; + * + * @param value The enum numeric value on the wire for membership to set. + * @return This builder for chaining. + */ + public Builder setMembershipValue(int value) { + membership_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * Indicates whether the binding includes the principal.
+       * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.Membership membership = 1; + * + * @return The membership. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.Membership getMembership() { + com.google.cloud.policysimulator.v1.BindingExplanation.Membership result = + com.google.cloud.policysimulator.v1.BindingExplanation.Membership.forNumber( + membership_); + return result == null + ? com.google.cloud.policysimulator.v1.BindingExplanation.Membership.UNRECOGNIZED + : result; + } + /** + * + * + *
+       * Indicates whether the binding includes the principal.
+       * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.Membership membership = 1; + * + * @param value The membership to set. + * @return This builder for chaining. + */ + public Builder setMembership( + com.google.cloud.policysimulator.v1.BindingExplanation.Membership value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + membership_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+       * Indicates whether the binding includes the principal.
+       * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.Membership membership = 1; + * + * @return This builder for chaining. + */ + public Builder clearMembership() { + bitField0_ = (bitField0_ & ~0x00000001); + membership_ = 0; + onChanged(); + return this; + } + + private int relevance_ = 0; + /** + * + * + *
+       * The relevance of the principal's status to the overall determination for
+       * the binding.
+       * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 2; + * + * @return The enum numeric value on the wire for relevance. + */ + @java.lang.Override + public int getRelevanceValue() { + return relevance_; + } + /** + * + * + *
+       * The relevance of the principal's status to the overall determination for
+       * the binding.
+       * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 2; + * + * @param value The enum numeric value on the wire for relevance to set. + * @return This builder for chaining. + */ + public Builder setRelevanceValue(int value) { + relevance_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * The relevance of the principal's status to the overall determination for
+       * the binding.
+       * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 2; + * + * @return The relevance. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.HeuristicRelevance getRelevance() { + com.google.cloud.policysimulator.v1.HeuristicRelevance result = + com.google.cloud.policysimulator.v1.HeuristicRelevance.forNumber(relevance_); + return result == null + ? com.google.cloud.policysimulator.v1.HeuristicRelevance.UNRECOGNIZED + : result; + } + /** + * + * + *
+       * The relevance of the principal's status to the overall determination for
+       * the binding.
+       * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 2; + * + * @param value The relevance to set. + * @return This builder for chaining. + */ + public Builder setRelevance(com.google.cloud.policysimulator.v1.HeuristicRelevance value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + relevance_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+       * The relevance of the principal's status to the overall determination for
+       * the binding.
+       * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 2; + * + * @return This builder for chaining. + */ + public Builder clearRelevance() { + bitField0_ = (bitField0_ & ~0x00000002); + relevance_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership) + private static final com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership(); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnnotatedMembership parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int ACCESS_FIELD_NUMBER = 1; + private int access_ = 0; + /** + * + * + *
+   * Required. Indicates whether _this binding_ provides the specified
+   * permission to the specified principal for the specified resource.
+   *
+   * This field does _not_ indicate whether the principal actually has the
+   * permission for the resource. There might be another binding that overrides
+   * this binding. To determine whether the principal actually has the
+   * permission, use the `access` field in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   * 
+ * + * + * .google.cloud.policysimulator.v1.AccessState access = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for access. + */ + @java.lang.Override + public int getAccessValue() { + return access_; + } + /** + * + * + *
+   * Required. Indicates whether _this binding_ provides the specified
+   * permission to the specified principal for the specified resource.
+   *
+   * This field does _not_ indicate whether the principal actually has the
+   * permission for the resource. There might be another binding that overrides
+   * this binding. To determine whether the principal actually has the
+   * permission, use the `access` field in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   * 
+ * + * + * .google.cloud.policysimulator.v1.AccessState access = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The access. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessState getAccess() { + com.google.cloud.policysimulator.v1.AccessState result = + com.google.cloud.policysimulator.v1.AccessState.forNumber(access_); + return result == null ? com.google.cloud.policysimulator.v1.AccessState.UNRECOGNIZED : result; + } + + public static final int ROLE_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object role_ = ""; + /** + * + * + *
+   * The role that this binding grants. For example,
+   * `roles/compute.serviceAgent`.
+   *
+   * For a complete list of predefined IAM roles, as well as the permissions in
+   * each role, see https://cloud.google.com/iam/help/roles/reference.
+   * 
+ * + * string role = 2; + * + * @return The role. + */ + @java.lang.Override + public java.lang.String getRole() { + java.lang.Object ref = role_; + 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(); + role_ = s; + return s; + } + } + /** + * + * + *
+   * The role that this binding grants. For example,
+   * `roles/compute.serviceAgent`.
+   *
+   * For a complete list of predefined IAM roles, as well as the permissions in
+   * each role, see https://cloud.google.com/iam/help/roles/reference.
+   * 
+ * + * string role = 2; + * + * @return The bytes for role. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRoleBytes() { + java.lang.Object ref = role_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + role_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ROLE_PERMISSION_FIELD_NUMBER = 3; + private int rolePermission_ = 0; + /** + * + * + *
+   * Indicates whether the role granted by this binding contains the specified
+   * permission.
+   * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.RolePermission role_permission = 3; + * + * + * @return The enum numeric value on the wire for rolePermission. + */ + @java.lang.Override + public int getRolePermissionValue() { + return rolePermission_; + } + /** + * + * + *
+   * Indicates whether the role granted by this binding contains the specified
+   * permission.
+   * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.RolePermission role_permission = 3; + * + * + * @return The rolePermission. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission getRolePermission() { + com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission result = + com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission.forNumber( + rolePermission_); + return result == null + ? com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission.UNRECOGNIZED + : result; + } + + public static final int ROLE_PERMISSION_RELEVANCE_FIELD_NUMBER = 4; + private int rolePermissionRelevance_ = 0; + /** + * + * + *
+   * The relevance of the permission's existence, or nonexistence, in the role
+   * to the overall determination for the entire policy.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance role_permission_relevance = 4; + * + * @return The enum numeric value on the wire for rolePermissionRelevance. + */ + @java.lang.Override + public int getRolePermissionRelevanceValue() { + return rolePermissionRelevance_; + } + /** + * + * + *
+   * The relevance of the permission's existence, or nonexistence, in the role
+   * to the overall determination for the entire policy.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance role_permission_relevance = 4; + * + * @return The rolePermissionRelevance. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.HeuristicRelevance getRolePermissionRelevance() { + com.google.cloud.policysimulator.v1.HeuristicRelevance result = + com.google.cloud.policysimulator.v1.HeuristicRelevance.forNumber(rolePermissionRelevance_); + return result == null + ? com.google.cloud.policysimulator.v1.HeuristicRelevance.UNRECOGNIZED + : result; + } + + public static final int MEMBERSHIPS_FIELD_NUMBER = 5; + + private static final class MembershipsDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + defaultEntry = + com.google.protobuf.MapEntry + . + newDefaultInstance( + com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_MembershipsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + .getDefaultInstance()); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + memberships_; + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + internalGetMemberships() { + if (memberships_ == null) { + return com.google.protobuf.MapField.emptyMapField(MembershipsDefaultEntryHolder.defaultEntry); + } + return memberships_; + } + + public int getMembershipsCount() { + return internalGetMemberships().getMap().size(); + } + /** + * + * + *
+   * Indicates whether each principal in the binding includes the principal
+   * specified in the request, either directly or indirectly. Each key
+   * identifies a principal in the binding, and each value indicates whether the
+   * principal in the binding includes the principal in the request.
+   *
+   * For example, suppose that a binding includes the following principals:
+   *
+   * * `user:alice@example.com`
+   * * `group:product-eng@example.com`
+   *
+   * The principal in the replayed access tuple is `user:bob@example.com`. This
+   * user is a principal of the group `group:product-eng@example.com`.
+   *
+   * For the first principal in the binding, the key is
+   * `user:alice@example.com`, and the `membership` field in the value is set to
+   * `MEMBERSHIP_NOT_INCLUDED`.
+   *
+   * For the second principal in the binding, the key is
+   * `group:product-eng@example.com`, and the `membership` field in the value is
+   * set to `MEMBERSHIP_INCLUDED`.
+   * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + @java.lang.Override + public boolean containsMemberships(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetMemberships().getMap().containsKey(key); + } + /** Use {@link #getMembershipsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + getMemberships() { + return getMembershipsMap(); + } + /** + * + * + *
+   * Indicates whether each principal in the binding includes the principal
+   * specified in the request, either directly or indirectly. Each key
+   * identifies a principal in the binding, and each value indicates whether the
+   * principal in the binding includes the principal in the request.
+   *
+   * For example, suppose that a binding includes the following principals:
+   *
+   * * `user:alice@example.com`
+   * * `group:product-eng@example.com`
+   *
+   * The principal in the replayed access tuple is `user:bob@example.com`. This
+   * user is a principal of the group `group:product-eng@example.com`.
+   *
+   * For the first principal in the binding, the key is
+   * `user:alice@example.com`, and the `membership` field in the value is set to
+   * `MEMBERSHIP_NOT_INCLUDED`.
+   *
+   * For the second principal in the binding, the key is
+   * `group:product-eng@example.com`, and the `membership` field in the value is
+   * set to `MEMBERSHIP_INCLUDED`.
+   * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + @java.lang.Override + public java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + getMembershipsMap() { + return internalGetMemberships().getMap(); + } + /** + * + * + *
+   * Indicates whether each principal in the binding includes the principal
+   * specified in the request, either directly or indirectly. Each key
+   * identifies a principal in the binding, and each value indicates whether the
+   * principal in the binding includes the principal in the request.
+   *
+   * For example, suppose that a binding includes the following principals:
+   *
+   * * `user:alice@example.com`
+   * * `group:product-eng@example.com`
+   *
+   * The principal in the replayed access tuple is `user:bob@example.com`. This
+   * user is a principal of the group `group:product-eng@example.com`.
+   *
+   * For the first principal in the binding, the key is
+   * `user:alice@example.com`, and the `membership` field in the value is set to
+   * `MEMBERSHIP_NOT_INCLUDED`.
+   *
+   * For the second principal in the binding, the key is
+   * `group:product-eng@example.com`, and the `membership` field in the value is
+   * set to `MEMBERSHIP_INCLUDED`.
+   * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + @java.lang.Override + public /* nullable */ com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + getMembershipsOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + map = internalGetMemberships().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Indicates whether each principal in the binding includes the principal
+   * specified in the request, either directly or indirectly. Each key
+   * identifies a principal in the binding, and each value indicates whether the
+   * principal in the binding includes the principal in the request.
+   *
+   * For example, suppose that a binding includes the following principals:
+   *
+   * * `user:alice@example.com`
+   * * `group:product-eng@example.com`
+   *
+   * The principal in the replayed access tuple is `user:bob@example.com`. This
+   * user is a principal of the group `group:product-eng@example.com`.
+   *
+   * For the first principal in the binding, the key is
+   * `user:alice@example.com`, and the `membership` field in the value is set to
+   * `MEMBERSHIP_NOT_INCLUDED`.
+   *
+   * For the second principal in the binding, the key is
+   * `group:product-eng@example.com`, and the `membership` field in the value is
+   * set to `MEMBERSHIP_INCLUDED`.
+   * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + getMembershipsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + map = internalGetMemberships().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int RELEVANCE_FIELD_NUMBER = 6; + private int relevance_ = 0; + /** + * + * + *
+   * The relevance of this binding to the overall determination for the entire
+   * policy.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 6; + * + * @return The enum numeric value on the wire for relevance. + */ + @java.lang.Override + public int getRelevanceValue() { + return relevance_; + } + /** + * + * + *
+   * The relevance of this binding to the overall determination for the entire
+   * policy.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 6; + * + * @return The relevance. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.HeuristicRelevance getRelevance() { + com.google.cloud.policysimulator.v1.HeuristicRelevance result = + com.google.cloud.policysimulator.v1.HeuristicRelevance.forNumber(relevance_); + return result == null + ? com.google.cloud.policysimulator.v1.HeuristicRelevance.UNRECOGNIZED + : result; + } + + public static final int CONDITION_FIELD_NUMBER = 7; + private com.google.type.Expr condition_; + /** + * + * + *
+   * A condition expression that prevents this binding from granting access
+   * unless the expression evaluates to `true`.
+   *
+   * To learn about IAM Conditions, see
+   * https://cloud.google.com/iam/docs/conditions-overview.
+   * 
+ * + * .google.type.Expr condition = 7; + * + * @return Whether the condition field is set. + */ + @java.lang.Override + public boolean hasCondition() { + return condition_ != null; + } + /** + * + * + *
+   * A condition expression that prevents this binding from granting access
+   * unless the expression evaluates to `true`.
+   *
+   * To learn about IAM Conditions, see
+   * https://cloud.google.com/iam/docs/conditions-overview.
+   * 
+ * + * .google.type.Expr condition = 7; + * + * @return The condition. + */ + @java.lang.Override + public com.google.type.Expr getCondition() { + return condition_ == null ? com.google.type.Expr.getDefaultInstance() : condition_; + } + /** + * + * + *
+   * A condition expression that prevents this binding from granting access
+   * unless the expression evaluates to `true`.
+   *
+   * To learn about IAM Conditions, see
+   * https://cloud.google.com/iam/docs/conditions-overview.
+   * 
+ * + * .google.type.Expr condition = 7; + */ + @java.lang.Override + public com.google.type.ExprOrBuilder getConditionOrBuilder() { + return condition_ == null ? com.google.type.Expr.getDefaultInstance() : condition_; + } + + 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 (access_ + != com.google.cloud.policysimulator.v1.AccessState.ACCESS_STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, access_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(role_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, role_); + } + if (rolePermission_ + != com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission + .ROLE_PERMISSION_UNSPECIFIED + .getNumber()) { + output.writeEnum(3, rolePermission_); + } + if (rolePermissionRelevance_ + != com.google.cloud.policysimulator.v1.HeuristicRelevance.HEURISTIC_RELEVANCE_UNSPECIFIED + .getNumber()) { + output.writeEnum(4, rolePermissionRelevance_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetMemberships(), MembershipsDefaultEntryHolder.defaultEntry, 5); + if (relevance_ + != com.google.cloud.policysimulator.v1.HeuristicRelevance.HEURISTIC_RELEVANCE_UNSPECIFIED + .getNumber()) { + output.writeEnum(6, relevance_); + } + if (condition_ != null) { + output.writeMessage(7, getCondition()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (access_ + != com.google.cloud.policysimulator.v1.AccessState.ACCESS_STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, access_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(role_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, role_); + } + if (rolePermission_ + != com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission + .ROLE_PERMISSION_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, rolePermission_); + } + if (rolePermissionRelevance_ + != com.google.cloud.policysimulator.v1.HeuristicRelevance.HEURISTIC_RELEVANCE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(4, rolePermissionRelevance_); + } + for (java.util.Map.Entry< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + entry : internalGetMemberships().getMap().entrySet()) { + com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + memberships__ = + MembershipsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, memberships__); + } + if (relevance_ + != com.google.cloud.policysimulator.v1.HeuristicRelevance.HEURISTIC_RELEVANCE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(6, relevance_); + } + if (condition_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getCondition()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.BindingExplanation)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.BindingExplanation other = + (com.google.cloud.policysimulator.v1.BindingExplanation) obj; + + if (access_ != other.access_) return false; + if (!getRole().equals(other.getRole())) return false; + if (rolePermission_ != other.rolePermission_) return false; + if (rolePermissionRelevance_ != other.rolePermissionRelevance_) return false; + if (!internalGetMemberships().equals(other.internalGetMemberships())) return false; + if (relevance_ != other.relevance_) return false; + if (hasCondition() != other.hasCondition()) return false; + if (hasCondition()) { + if (!getCondition().equals(other.getCondition())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ACCESS_FIELD_NUMBER; + hash = (53 * hash) + access_; + hash = (37 * hash) + ROLE_FIELD_NUMBER; + hash = (53 * hash) + getRole().hashCode(); + hash = (37 * hash) + ROLE_PERMISSION_FIELD_NUMBER; + hash = (53 * hash) + rolePermission_; + hash = (37 * hash) + ROLE_PERMISSION_RELEVANCE_FIELD_NUMBER; + hash = (53 * hash) + rolePermissionRelevance_; + if (!internalGetMemberships().getMap().isEmpty()) { + hash = (37 * hash) + MEMBERSHIPS_FIELD_NUMBER; + hash = (53 * hash) + internalGetMemberships().hashCode(); + } + hash = (37 * hash) + RELEVANCE_FIELD_NUMBER; + hash = (53 * hash) + relevance_; + if (hasCondition()) { + hash = (37 * hash) + CONDITION_FIELD_NUMBER; + hash = (53 * hash) + getCondition().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation 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.policysimulator.v1.BindingExplanation parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation 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.policysimulator.v1.BindingExplanation parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation 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.policysimulator.v1.BindingExplanation parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation 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.policysimulator.v1.BindingExplanation parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation 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.policysimulator.v1.BindingExplanation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Details about how a binding in a policy affects a principal's ability to use
+   * a permission.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.BindingExplanation} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.BindingExplanation) + com.google.cloud.policysimulator.v1.BindingExplanationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 5: + return internalGetMemberships(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 5: + return internalGetMutableMemberships(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.BindingExplanation.class, + com.google.cloud.policysimulator.v1.BindingExplanation.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.BindingExplanation.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + access_ = 0; + role_ = ""; + rolePermission_ = 0; + rolePermissionRelevance_ = 0; + internalGetMutableMemberships().clear(); + relevance_ = 0; + condition_ = null; + if (conditionBuilder_ != null) { + conditionBuilder_.dispose(); + conditionBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_BindingExplanation_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.BindingExplanation.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation build() { + com.google.cloud.policysimulator.v1.BindingExplanation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation buildPartial() { + com.google.cloud.policysimulator.v1.BindingExplanation result = + new com.google.cloud.policysimulator.v1.BindingExplanation(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.BindingExplanation result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.access_ = access_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.role_ = role_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.rolePermission_ = rolePermission_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.rolePermissionRelevance_ = rolePermissionRelevance_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.memberships_ = internalGetMemberships(); + result.memberships_.makeImmutable(); + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.relevance_ = relevance_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + result.condition_ = conditionBuilder_ == null ? condition_ : conditionBuilder_.build(); + } + } + + @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.policysimulator.v1.BindingExplanation) { + return mergeFrom((com.google.cloud.policysimulator.v1.BindingExplanation) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.BindingExplanation other) { + if (other == com.google.cloud.policysimulator.v1.BindingExplanation.getDefaultInstance()) + return this; + if (other.access_ != 0) { + setAccessValue(other.getAccessValue()); + } + if (!other.getRole().isEmpty()) { + role_ = other.role_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.rolePermission_ != 0) { + setRolePermissionValue(other.getRolePermissionValue()); + } + if (other.rolePermissionRelevance_ != 0) { + setRolePermissionRelevanceValue(other.getRolePermissionRelevanceValue()); + } + internalGetMutableMemberships().mergeFrom(other.internalGetMemberships()); + bitField0_ |= 0x00000010; + if (other.relevance_ != 0) { + setRelevanceValue(other.getRelevanceValue()); + } + if (other.hasCondition()) { + mergeCondition(other.getCondition()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + access_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + role_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: + { + rolePermission_ = input.readEnum(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: + { + rolePermissionRelevance_ = input.readEnum(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 42: + { + com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + memberships__ = + input.readMessage( + MembershipsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableMemberships() + .getMutableMap() + .put(memberships__.getKey(), memberships__.getValue()); + bitField0_ |= 0x00000010; + break; + } // case 42 + case 48: + { + relevance_ = input.readEnum(); + bitField0_ |= 0x00000020; + break; + } // case 48 + case 58: + { + input.readMessage(getConditionFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000040; + break; + } // case 58 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int access_ = 0; + /** + * + * + *
+     * Required. Indicates whether _this binding_ provides the specified
+     * permission to the specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another binding that overrides
+     * this binding. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * + * .google.cloud.policysimulator.v1.AccessState access = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for access. + */ + @java.lang.Override + public int getAccessValue() { + return access_; + } + /** + * + * + *
+     * Required. Indicates whether _this binding_ provides the specified
+     * permission to the specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another binding that overrides
+     * this binding. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * + * .google.cloud.policysimulator.v1.AccessState access = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The enum numeric value on the wire for access to set. + * @return This builder for chaining. + */ + public Builder setAccessValue(int value) { + access_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Indicates whether _this binding_ provides the specified
+     * permission to the specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another binding that overrides
+     * this binding. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * + * .google.cloud.policysimulator.v1.AccessState access = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The access. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessState getAccess() { + com.google.cloud.policysimulator.v1.AccessState result = + com.google.cloud.policysimulator.v1.AccessState.forNumber(access_); + return result == null ? com.google.cloud.policysimulator.v1.AccessState.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Required. Indicates whether _this binding_ provides the specified
+     * permission to the specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another binding that overrides
+     * this binding. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * + * .google.cloud.policysimulator.v1.AccessState access = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The access to set. + * @return This builder for chaining. + */ + public Builder setAccess(com.google.cloud.policysimulator.v1.AccessState value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + access_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Indicates whether _this binding_ provides the specified
+     * permission to the specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another binding that overrides
+     * this binding. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * + * .google.cloud.policysimulator.v1.AccessState access = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return This builder for chaining. + */ + public Builder clearAccess() { + bitField0_ = (bitField0_ & ~0x00000001); + access_ = 0; + onChanged(); + return this; + } + + private java.lang.Object role_ = ""; + /** + * + * + *
+     * The role that this binding grants. For example,
+     * `roles/compute.serviceAgent`.
+     *
+     * For a complete list of predefined IAM roles, as well as the permissions in
+     * each role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string role = 2; + * + * @return The role. + */ + public java.lang.String getRole() { + java.lang.Object ref = role_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + role_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The role that this binding grants. For example,
+     * `roles/compute.serviceAgent`.
+     *
+     * For a complete list of predefined IAM roles, as well as the permissions in
+     * each role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string role = 2; + * + * @return The bytes for role. + */ + public com.google.protobuf.ByteString getRoleBytes() { + java.lang.Object ref = role_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + role_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The role that this binding grants. For example,
+     * `roles/compute.serviceAgent`.
+     *
+     * For a complete list of predefined IAM roles, as well as the permissions in
+     * each role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string role = 2; + * + * @param value The role to set. + * @return This builder for chaining. + */ + public Builder setRole(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + role_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The role that this binding grants. For example,
+     * `roles/compute.serviceAgent`.
+     *
+     * For a complete list of predefined IAM roles, as well as the permissions in
+     * each role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string role = 2; + * + * @return This builder for chaining. + */ + public Builder clearRole() { + role_ = getDefaultInstance().getRole(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * The role that this binding grants. For example,
+     * `roles/compute.serviceAgent`.
+     *
+     * For a complete list of predefined IAM roles, as well as the permissions in
+     * each role, see https://cloud.google.com/iam/help/roles/reference.
+     * 
+ * + * string role = 2; + * + * @param value The bytes for role to set. + * @return This builder for chaining. + */ + public Builder setRoleBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + role_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private int rolePermission_ = 0; + /** + * + * + *
+     * Indicates whether the role granted by this binding contains the specified
+     * permission.
+     * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.RolePermission role_permission = 3; + * + * + * @return The enum numeric value on the wire for rolePermission. + */ + @java.lang.Override + public int getRolePermissionValue() { + return rolePermission_; + } + /** + * + * + *
+     * Indicates whether the role granted by this binding contains the specified
+     * permission.
+     * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.RolePermission role_permission = 3; + * + * + * @param value The enum numeric value on the wire for rolePermission to set. + * @return This builder for chaining. + */ + public Builder setRolePermissionValue(int value) { + rolePermission_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates whether the role granted by this binding contains the specified
+     * permission.
+     * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.RolePermission role_permission = 3; + * + * + * @return The rolePermission. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission + getRolePermission() { + com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission result = + com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission.forNumber( + rolePermission_); + return result == null + ? com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Indicates whether the role granted by this binding contains the specified
+     * permission.
+     * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.RolePermission role_permission = 3; + * + * + * @param value The rolePermission to set. + * @return This builder for chaining. + */ + public Builder setRolePermission( + com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + rolePermission_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates whether the role granted by this binding contains the specified
+     * permission.
+     * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.RolePermission role_permission = 3; + * + * + * @return This builder for chaining. + */ + public Builder clearRolePermission() { + bitField0_ = (bitField0_ & ~0x00000004); + rolePermission_ = 0; + onChanged(); + return this; + } + + private int rolePermissionRelevance_ = 0; + /** + * + * + *
+     * The relevance of the permission's existence, or nonexistence, in the role
+     * to the overall determination for the entire policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance role_permission_relevance = 4; + * + * + * @return The enum numeric value on the wire for rolePermissionRelevance. + */ + @java.lang.Override + public int getRolePermissionRelevanceValue() { + return rolePermissionRelevance_; + } + /** + * + * + *
+     * The relevance of the permission's existence, or nonexistence, in the role
+     * to the overall determination for the entire policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance role_permission_relevance = 4; + * + * + * @param value The enum numeric value on the wire for rolePermissionRelevance to set. + * @return This builder for chaining. + */ + public Builder setRolePermissionRelevanceValue(int value) { + rolePermissionRelevance_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * The relevance of the permission's existence, or nonexistence, in the role
+     * to the overall determination for the entire policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance role_permission_relevance = 4; + * + * + * @return The rolePermissionRelevance. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.HeuristicRelevance getRolePermissionRelevance() { + com.google.cloud.policysimulator.v1.HeuristicRelevance result = + com.google.cloud.policysimulator.v1.HeuristicRelevance.forNumber( + rolePermissionRelevance_); + return result == null + ? com.google.cloud.policysimulator.v1.HeuristicRelevance.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The relevance of the permission's existence, or nonexistence, in the role
+     * to the overall determination for the entire policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance role_permission_relevance = 4; + * + * + * @param value The rolePermissionRelevance to set. + * @return This builder for chaining. + */ + public Builder setRolePermissionRelevance( + com.google.cloud.policysimulator.v1.HeuristicRelevance value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + rolePermissionRelevance_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The relevance of the permission's existence, or nonexistence, in the role
+     * to the overall determination for the entire policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance role_permission_relevance = 4; + * + * + * @return This builder for chaining. + */ + public Builder clearRolePermissionRelevance() { + bitField0_ = (bitField0_ & ~0x00000008); + rolePermissionRelevance_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + memberships_; + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + internalGetMemberships() { + if (memberships_ == null) { + return com.google.protobuf.MapField.emptyMapField( + MembershipsDefaultEntryHolder.defaultEntry); + } + return memberships_; + } + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + internalGetMutableMemberships() { + if (memberships_ == null) { + memberships_ = + com.google.protobuf.MapField.newMapField(MembershipsDefaultEntryHolder.defaultEntry); + } + if (!memberships_.isMutable()) { + memberships_ = memberships_.copy(); + } + bitField0_ |= 0x00000010; + onChanged(); + return memberships_; + } + + public int getMembershipsCount() { + return internalGetMemberships().getMap().size(); + } + /** + * + * + *
+     * Indicates whether each principal in the binding includes the principal
+     * specified in the request, either directly or indirectly. Each key
+     * identifies a principal in the binding, and each value indicates whether the
+     * principal in the binding includes the principal in the request.
+     *
+     * For example, suppose that a binding includes the following principals:
+     *
+     * * `user:alice@example.com`
+     * * `group:product-eng@example.com`
+     *
+     * The principal in the replayed access tuple is `user:bob@example.com`. This
+     * user is a principal of the group `group:product-eng@example.com`.
+     *
+     * For the first principal in the binding, the key is
+     * `user:alice@example.com`, and the `membership` field in the value is set to
+     * `MEMBERSHIP_NOT_INCLUDED`.
+     *
+     * For the second principal in the binding, the key is
+     * `group:product-eng@example.com`, and the `membership` field in the value is
+     * set to `MEMBERSHIP_INCLUDED`.
+     * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + @java.lang.Override + public boolean containsMemberships(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetMemberships().getMap().containsKey(key); + } + /** Use {@link #getMembershipsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + getMemberships() { + return getMembershipsMap(); + } + /** + * + * + *
+     * Indicates whether each principal in the binding includes the principal
+     * specified in the request, either directly or indirectly. Each key
+     * identifies a principal in the binding, and each value indicates whether the
+     * principal in the binding includes the principal in the request.
+     *
+     * For example, suppose that a binding includes the following principals:
+     *
+     * * `user:alice@example.com`
+     * * `group:product-eng@example.com`
+     *
+     * The principal in the replayed access tuple is `user:bob@example.com`. This
+     * user is a principal of the group `group:product-eng@example.com`.
+     *
+     * For the first principal in the binding, the key is
+     * `user:alice@example.com`, and the `membership` field in the value is set to
+     * `MEMBERSHIP_NOT_INCLUDED`.
+     *
+     * For the second principal in the binding, the key is
+     * `group:product-eng@example.com`, and the `membership` field in the value is
+     * set to `MEMBERSHIP_INCLUDED`.
+     * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + @java.lang.Override + public java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + getMembershipsMap() { + return internalGetMemberships().getMap(); + } + /** + * + * + *
+     * Indicates whether each principal in the binding includes the principal
+     * specified in the request, either directly or indirectly. Each key
+     * identifies a principal in the binding, and each value indicates whether the
+     * principal in the binding includes the principal in the request.
+     *
+     * For example, suppose that a binding includes the following principals:
+     *
+     * * `user:alice@example.com`
+     * * `group:product-eng@example.com`
+     *
+     * The principal in the replayed access tuple is `user:bob@example.com`. This
+     * user is a principal of the group `group:product-eng@example.com`.
+     *
+     * For the first principal in the binding, the key is
+     * `user:alice@example.com`, and the `membership` field in the value is set to
+     * `MEMBERSHIP_NOT_INCLUDED`.
+     *
+     * For the second principal in the binding, the key is
+     * `group:product-eng@example.com`, and the `membership` field in the value is
+     * set to `MEMBERSHIP_INCLUDED`.
+     * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + @java.lang.Override + public /* nullable */ com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + getMembershipsOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + map = internalGetMemberships().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Indicates whether each principal in the binding includes the principal
+     * specified in the request, either directly or indirectly. Each key
+     * identifies a principal in the binding, and each value indicates whether the
+     * principal in the binding includes the principal in the request.
+     *
+     * For example, suppose that a binding includes the following principals:
+     *
+     * * `user:alice@example.com`
+     * * `group:product-eng@example.com`
+     *
+     * The principal in the replayed access tuple is `user:bob@example.com`. This
+     * user is a principal of the group `group:product-eng@example.com`.
+     *
+     * For the first principal in the binding, the key is
+     * `user:alice@example.com`, and the `membership` field in the value is set to
+     * `MEMBERSHIP_NOT_INCLUDED`.
+     *
+     * For the second principal in the binding, the key is
+     * `group:product-eng@example.com`, and the `membership` field in the value is
+     * set to `MEMBERSHIP_INCLUDED`.
+     * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + getMembershipsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + map = internalGetMemberships().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearMemberships() { + bitField0_ = (bitField0_ & ~0x00000010); + internalGetMutableMemberships().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Indicates whether each principal in the binding includes the principal
+     * specified in the request, either directly or indirectly. Each key
+     * identifies a principal in the binding, and each value indicates whether the
+     * principal in the binding includes the principal in the request.
+     *
+     * For example, suppose that a binding includes the following principals:
+     *
+     * * `user:alice@example.com`
+     * * `group:product-eng@example.com`
+     *
+     * The principal in the replayed access tuple is `user:bob@example.com`. This
+     * user is a principal of the group `group:product-eng@example.com`.
+     *
+     * For the first principal in the binding, the key is
+     * `user:alice@example.com`, and the `membership` field in the value is set to
+     * `MEMBERSHIP_NOT_INCLUDED`.
+     *
+     * For the second principal in the binding, the key is
+     * `group:product-eng@example.com`, and the `membership` field in the value is
+     * set to `MEMBERSHIP_INCLUDED`.
+     * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + public Builder removeMemberships(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableMemberships().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + getMutableMemberships() { + bitField0_ |= 0x00000010; + return internalGetMutableMemberships().getMutableMap(); + } + /** + * + * + *
+     * Indicates whether each principal in the binding includes the principal
+     * specified in the request, either directly or indirectly. Each key
+     * identifies a principal in the binding, and each value indicates whether the
+     * principal in the binding includes the principal in the request.
+     *
+     * For example, suppose that a binding includes the following principals:
+     *
+     * * `user:alice@example.com`
+     * * `group:product-eng@example.com`
+     *
+     * The principal in the replayed access tuple is `user:bob@example.com`. This
+     * user is a principal of the group `group:product-eng@example.com`.
+     *
+     * For the first principal in the binding, the key is
+     * `user:alice@example.com`, and the `membership` field in the value is set to
+     * `MEMBERSHIP_NOT_INCLUDED`.
+     *
+     * For the second principal in the binding, the key is
+     * `group:product-eng@example.com`, and the `membership` field in the value is
+     * set to `MEMBERSHIP_INCLUDED`.
+     * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + public Builder putMemberships( + java.lang.String key, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableMemberships().getMutableMap().put(key, value); + bitField0_ |= 0x00000010; + return this; + } + /** + * + * + *
+     * Indicates whether each principal in the binding includes the principal
+     * specified in the request, either directly or indirectly. Each key
+     * identifies a principal in the binding, and each value indicates whether the
+     * principal in the binding includes the principal in the request.
+     *
+     * For example, suppose that a binding includes the following principals:
+     *
+     * * `user:alice@example.com`
+     * * `group:product-eng@example.com`
+     *
+     * The principal in the replayed access tuple is `user:bob@example.com`. This
+     * user is a principal of the group `group:product-eng@example.com`.
+     *
+     * For the first principal in the binding, the key is
+     * `user:alice@example.com`, and the `membership` field in the value is set to
+     * `MEMBERSHIP_NOT_INCLUDED`.
+     *
+     * For the second principal in the binding, the key is
+     * `group:product-eng@example.com`, and the `membership` field in the value is
+     * set to `MEMBERSHIP_INCLUDED`.
+     * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + public Builder putAllMemberships( + java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + values) { + internalGetMutableMemberships().getMutableMap().putAll(values); + bitField0_ |= 0x00000010; + return this; + } + + private int relevance_ = 0; + /** + * + * + *
+     * The relevance of this binding to the overall determination for the entire
+     * policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 6; + * + * @return The enum numeric value on the wire for relevance. + */ + @java.lang.Override + public int getRelevanceValue() { + return relevance_; + } + /** + * + * + *
+     * The relevance of this binding to the overall determination for the entire
+     * policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 6; + * + * @param value The enum numeric value on the wire for relevance to set. + * @return This builder for chaining. + */ + public Builder setRelevanceValue(int value) { + relevance_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * The relevance of this binding to the overall determination for the entire
+     * policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 6; + * + * @return The relevance. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.HeuristicRelevance getRelevance() { + com.google.cloud.policysimulator.v1.HeuristicRelevance result = + com.google.cloud.policysimulator.v1.HeuristicRelevance.forNumber(relevance_); + return result == null + ? com.google.cloud.policysimulator.v1.HeuristicRelevance.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The relevance of this binding to the overall determination for the entire
+     * policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 6; + * + * @param value The relevance to set. + * @return This builder for chaining. + */ + public Builder setRelevance(com.google.cloud.policysimulator.v1.HeuristicRelevance value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + relevance_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The relevance of this binding to the overall determination for the entire
+     * policy.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 6; + * + * @return This builder for chaining. + */ + public Builder clearRelevance() { + bitField0_ = (bitField0_ & ~0x00000020); + relevance_ = 0; + onChanged(); + return this; + } + + private com.google.type.Expr condition_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder> + conditionBuilder_; + /** + * + * + *
+     * A condition expression that prevents this binding from granting access
+     * unless the expression evaluates to `true`.
+     *
+     * To learn about IAM Conditions, see
+     * https://cloud.google.com/iam/docs/conditions-overview.
+     * 
+ * + * .google.type.Expr condition = 7; + * + * @return Whether the condition field is set. + */ + public boolean hasCondition() { + return ((bitField0_ & 0x00000040) != 0); + } + /** + * + * + *
+     * A condition expression that prevents this binding from granting access
+     * unless the expression evaluates to `true`.
+     *
+     * To learn about IAM Conditions, see
+     * https://cloud.google.com/iam/docs/conditions-overview.
+     * 
+ * + * .google.type.Expr condition = 7; + * + * @return The condition. + */ + public com.google.type.Expr getCondition() { + if (conditionBuilder_ == null) { + return condition_ == null ? com.google.type.Expr.getDefaultInstance() : condition_; + } else { + return conditionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A condition expression that prevents this binding from granting access
+     * unless the expression evaluates to `true`.
+     *
+     * To learn about IAM Conditions, see
+     * https://cloud.google.com/iam/docs/conditions-overview.
+     * 
+ * + * .google.type.Expr condition = 7; + */ + public Builder setCondition(com.google.type.Expr value) { + if (conditionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + condition_ = value; + } else { + conditionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * A condition expression that prevents this binding from granting access
+     * unless the expression evaluates to `true`.
+     *
+     * To learn about IAM Conditions, see
+     * https://cloud.google.com/iam/docs/conditions-overview.
+     * 
+ * + * .google.type.Expr condition = 7; + */ + public Builder setCondition(com.google.type.Expr.Builder builderForValue) { + if (conditionBuilder_ == null) { + condition_ = builderForValue.build(); + } else { + conditionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * A condition expression that prevents this binding from granting access
+     * unless the expression evaluates to `true`.
+     *
+     * To learn about IAM Conditions, see
+     * https://cloud.google.com/iam/docs/conditions-overview.
+     * 
+ * + * .google.type.Expr condition = 7; + */ + public Builder mergeCondition(com.google.type.Expr value) { + if (conditionBuilder_ == null) { + if (((bitField0_ & 0x00000040) != 0) + && condition_ != null + && condition_ != com.google.type.Expr.getDefaultInstance()) { + getConditionBuilder().mergeFrom(value); + } else { + condition_ = value; + } + } else { + conditionBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + * + * + *
+     * A condition expression that prevents this binding from granting access
+     * unless the expression evaluates to `true`.
+     *
+     * To learn about IAM Conditions, see
+     * https://cloud.google.com/iam/docs/conditions-overview.
+     * 
+ * + * .google.type.Expr condition = 7; + */ + public Builder clearCondition() { + bitField0_ = (bitField0_ & ~0x00000040); + condition_ = null; + if (conditionBuilder_ != null) { + conditionBuilder_.dispose(); + conditionBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * A condition expression that prevents this binding from granting access
+     * unless the expression evaluates to `true`.
+     *
+     * To learn about IAM Conditions, see
+     * https://cloud.google.com/iam/docs/conditions-overview.
+     * 
+ * + * .google.type.Expr condition = 7; + */ + public com.google.type.Expr.Builder getConditionBuilder() { + bitField0_ |= 0x00000040; + onChanged(); + return getConditionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A condition expression that prevents this binding from granting access
+     * unless the expression evaluates to `true`.
+     *
+     * To learn about IAM Conditions, see
+     * https://cloud.google.com/iam/docs/conditions-overview.
+     * 
+ * + * .google.type.Expr condition = 7; + */ + public com.google.type.ExprOrBuilder getConditionOrBuilder() { + if (conditionBuilder_ != null) { + return conditionBuilder_.getMessageOrBuilder(); + } else { + return condition_ == null ? com.google.type.Expr.getDefaultInstance() : condition_; + } + } + /** + * + * + *
+     * A condition expression that prevents this binding from granting access
+     * unless the expression evaluates to `true`.
+     *
+     * To learn about IAM Conditions, see
+     * https://cloud.google.com/iam/docs/conditions-overview.
+     * 
+ * + * .google.type.Expr condition = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder> + getConditionFieldBuilder() { + if (conditionBuilder_ == null) { + conditionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Expr, com.google.type.Expr.Builder, com.google.type.ExprOrBuilder>( + getCondition(), getParentForChildren(), isClean()); + condition_ = null; + } + return conditionBuilder_; + } + + @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.policysimulator.v1.BindingExplanation) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.BindingExplanation) + private static final com.google.cloud.policysimulator.v1.BindingExplanation DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.BindingExplanation(); + } + + public static com.google.cloud.policysimulator.v1.BindingExplanation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BindingExplanation parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/BindingExplanationOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/BindingExplanationOrBuilder.java new file mode 100644 index 000000000000..5c44839e7029 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/BindingExplanationOrBuilder.java @@ -0,0 +1,402 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/explanations.proto + +package com.google.cloud.policysimulator.v1; + +public interface BindingExplanationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.BindingExplanation) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Indicates whether _this binding_ provides the specified
+   * permission to the specified principal for the specified resource.
+   *
+   * This field does _not_ indicate whether the principal actually has the
+   * permission for the resource. There might be another binding that overrides
+   * this binding. To determine whether the principal actually has the
+   * permission, use the `access` field in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   * 
+ * + * + * .google.cloud.policysimulator.v1.AccessState access = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for access. + */ + int getAccessValue(); + /** + * + * + *
+   * Required. Indicates whether _this binding_ provides the specified
+   * permission to the specified principal for the specified resource.
+   *
+   * This field does _not_ indicate whether the principal actually has the
+   * permission for the resource. There might be another binding that overrides
+   * this binding. To determine whether the principal actually has the
+   * permission, use the `access` field in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   * 
+ * + * + * .google.cloud.policysimulator.v1.AccessState access = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The access. + */ + com.google.cloud.policysimulator.v1.AccessState getAccess(); + + /** + * + * + *
+   * The role that this binding grants. For example,
+   * `roles/compute.serviceAgent`.
+   *
+   * For a complete list of predefined IAM roles, as well as the permissions in
+   * each role, see https://cloud.google.com/iam/help/roles/reference.
+   * 
+ * + * string role = 2; + * + * @return The role. + */ + java.lang.String getRole(); + /** + * + * + *
+   * The role that this binding grants. For example,
+   * `roles/compute.serviceAgent`.
+   *
+   * For a complete list of predefined IAM roles, as well as the permissions in
+   * each role, see https://cloud.google.com/iam/help/roles/reference.
+   * 
+ * + * string role = 2; + * + * @return The bytes for role. + */ + com.google.protobuf.ByteString getRoleBytes(); + + /** + * + * + *
+   * Indicates whether the role granted by this binding contains the specified
+   * permission.
+   * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.RolePermission role_permission = 3; + * + * + * @return The enum numeric value on the wire for rolePermission. + */ + int getRolePermissionValue(); + /** + * + * + *
+   * Indicates whether the role granted by this binding contains the specified
+   * permission.
+   * 
+ * + * .google.cloud.policysimulator.v1.BindingExplanation.RolePermission role_permission = 3; + * + * + * @return The rolePermission. + */ + com.google.cloud.policysimulator.v1.BindingExplanation.RolePermission getRolePermission(); + + /** + * + * + *
+   * The relevance of the permission's existence, or nonexistence, in the role
+   * to the overall determination for the entire policy.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance role_permission_relevance = 4; + * + * @return The enum numeric value on the wire for rolePermissionRelevance. + */ + int getRolePermissionRelevanceValue(); + /** + * + * + *
+   * The relevance of the permission's existence, or nonexistence, in the role
+   * to the overall determination for the entire policy.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance role_permission_relevance = 4; + * + * @return The rolePermissionRelevance. + */ + com.google.cloud.policysimulator.v1.HeuristicRelevance getRolePermissionRelevance(); + + /** + * + * + *
+   * Indicates whether each principal in the binding includes the principal
+   * specified in the request, either directly or indirectly. Each key
+   * identifies a principal in the binding, and each value indicates whether the
+   * principal in the binding includes the principal in the request.
+   *
+   * For example, suppose that a binding includes the following principals:
+   *
+   * * `user:alice@example.com`
+   * * `group:product-eng@example.com`
+   *
+   * The principal in the replayed access tuple is `user:bob@example.com`. This
+   * user is a principal of the group `group:product-eng@example.com`.
+   *
+   * For the first principal in the binding, the key is
+   * `user:alice@example.com`, and the `membership` field in the value is set to
+   * `MEMBERSHIP_NOT_INCLUDED`.
+   *
+   * For the second principal in the binding, the key is
+   * `group:product-eng@example.com`, and the `membership` field in the value is
+   * set to `MEMBERSHIP_INCLUDED`.
+   * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + int getMembershipsCount(); + /** + * + * + *
+   * Indicates whether each principal in the binding includes the principal
+   * specified in the request, either directly or indirectly. Each key
+   * identifies a principal in the binding, and each value indicates whether the
+   * principal in the binding includes the principal in the request.
+   *
+   * For example, suppose that a binding includes the following principals:
+   *
+   * * `user:alice@example.com`
+   * * `group:product-eng@example.com`
+   *
+   * The principal in the replayed access tuple is `user:bob@example.com`. This
+   * user is a principal of the group `group:product-eng@example.com`.
+   *
+   * For the first principal in the binding, the key is
+   * `user:alice@example.com`, and the `membership` field in the value is set to
+   * `MEMBERSHIP_NOT_INCLUDED`.
+   *
+   * For the second principal in the binding, the key is
+   * `group:product-eng@example.com`, and the `membership` field in the value is
+   * set to `MEMBERSHIP_INCLUDED`.
+   * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + boolean containsMemberships(java.lang.String key); + /** Use {@link #getMembershipsMap()} instead. */ + @java.lang.Deprecated + java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + getMemberships(); + /** + * + * + *
+   * Indicates whether each principal in the binding includes the principal
+   * specified in the request, either directly or indirectly. Each key
+   * identifies a principal in the binding, and each value indicates whether the
+   * principal in the binding includes the principal in the request.
+   *
+   * For example, suppose that a binding includes the following principals:
+   *
+   * * `user:alice@example.com`
+   * * `group:product-eng@example.com`
+   *
+   * The principal in the replayed access tuple is `user:bob@example.com`. This
+   * user is a principal of the group `group:product-eng@example.com`.
+   *
+   * For the first principal in the binding, the key is
+   * `user:alice@example.com`, and the `membership` field in the value is set to
+   * `MEMBERSHIP_NOT_INCLUDED`.
+   *
+   * For the second principal in the binding, the key is
+   * `group:product-eng@example.com`, and the `membership` field in the value is
+   * set to `MEMBERSHIP_INCLUDED`.
+   * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + java.util.Map< + java.lang.String, + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> + getMembershipsMap(); + /** + * + * + *
+   * Indicates whether each principal in the binding includes the principal
+   * specified in the request, either directly or indirectly. Each key
+   * identifies a principal in the binding, and each value indicates whether the
+   * principal in the binding includes the principal in the request.
+   *
+   * For example, suppose that a binding includes the following principals:
+   *
+   * * `user:alice@example.com`
+   * * `group:product-eng@example.com`
+   *
+   * The principal in the replayed access tuple is `user:bob@example.com`. This
+   * user is a principal of the group `group:product-eng@example.com`.
+   *
+   * For the first principal in the binding, the key is
+   * `user:alice@example.com`, and the `membership` field in the value is set to
+   * `MEMBERSHIP_NOT_INCLUDED`.
+   *
+   * For the second principal in the binding, the key is
+   * `group:product-eng@example.com`, and the `membership` field in the value is
+   * set to `MEMBERSHIP_INCLUDED`.
+   * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + /* nullable */ + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership + getMembershipsOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership defaultValue); + /** + * + * + *
+   * Indicates whether each principal in the binding includes the principal
+   * specified in the request, either directly or indirectly. Each key
+   * identifies a principal in the binding, and each value indicates whether the
+   * principal in the binding includes the principal in the request.
+   *
+   * For example, suppose that a binding includes the following principals:
+   *
+   * * `user:alice@example.com`
+   * * `group:product-eng@example.com`
+   *
+   * The principal in the replayed access tuple is `user:bob@example.com`. This
+   * user is a principal of the group `group:product-eng@example.com`.
+   *
+   * For the first principal in the binding, the key is
+   * `user:alice@example.com`, and the `membership` field in the value is set to
+   * `MEMBERSHIP_NOT_INCLUDED`.
+   *
+   * For the second principal in the binding, the key is
+   * `group:product-eng@example.com`, and the `membership` field in the value is
+   * set to `MEMBERSHIP_INCLUDED`.
+   * 
+ * + * + * map<string, .google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership> memberships = 5; + * + */ + com.google.cloud.policysimulator.v1.BindingExplanation.AnnotatedMembership getMembershipsOrThrow( + java.lang.String key); + + /** + * + * + *
+   * The relevance of this binding to the overall determination for the entire
+   * policy.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 6; + * + * @return The enum numeric value on the wire for relevance. + */ + int getRelevanceValue(); + /** + * + * + *
+   * The relevance of this binding to the overall determination for the entire
+   * policy.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 6; + * + * @return The relevance. + */ + com.google.cloud.policysimulator.v1.HeuristicRelevance getRelevance(); + + /** + * + * + *
+   * A condition expression that prevents this binding from granting access
+   * unless the expression evaluates to `true`.
+   *
+   * To learn about IAM Conditions, see
+   * https://cloud.google.com/iam/docs/conditions-overview.
+   * 
+ * + * .google.type.Expr condition = 7; + * + * @return Whether the condition field is set. + */ + boolean hasCondition(); + /** + * + * + *
+   * A condition expression that prevents this binding from granting access
+   * unless the expression evaluates to `true`.
+   *
+   * To learn about IAM Conditions, see
+   * https://cloud.google.com/iam/docs/conditions-overview.
+   * 
+ * + * .google.type.Expr condition = 7; + * + * @return The condition. + */ + com.google.type.Expr getCondition(); + /** + * + * + *
+   * A condition expression that prevents this binding from granting access
+   * unless the expression evaluates to `true`.
+   *
+   * To learn about IAM Conditions, see
+   * https://cloud.google.com/iam/docs/conditions-overview.
+   * 
+ * + * .google.type.Expr condition = 7; + */ + com.google.type.ExprOrBuilder getConditionOrBuilder(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/CreateReplayRequest.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/CreateReplayRequest.java new file mode 100644 index 000000000000..adb6cd2de9c9 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/CreateReplayRequest.java @@ -0,0 +1,955 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Request message for
+ * [Simulator.CreateReplay][google.cloud.policysimulator.v1.Simulator.CreateReplay].
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.CreateReplayRequest} + */ +public final class CreateReplayRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.CreateReplayRequest) + CreateReplayRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateReplayRequest.newBuilder() to construct. + private CreateReplayRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateReplayRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateReplayRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.CreateReplayRequest.class, + com.google.cloud.policysimulator.v1.CreateReplayRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. The parent resource where this
+   * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This
+   * resource must be a project, folder, or organization with a location.
+   *
+   * Example: `projects/my-example-project/locations/global`
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The parent resource where this
+   * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This
+   * resource must be a project, folder, or organization with a location.
+   *
+   * Example: `projects/my-example-project/locations/global`
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REPLAY_FIELD_NUMBER = 2; + private com.google.cloud.policysimulator.v1.Replay replay_; + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+   * Set `Replay.ReplayConfig` to configure the replay.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the replay field is set. + */ + @java.lang.Override + public boolean hasReplay() { + return replay_ != null; + } + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+   * Set `Replay.ReplayConfig` to configure the replay.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The replay. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay getReplay() { + return replay_ == null + ? com.google.cloud.policysimulator.v1.Replay.getDefaultInstance() + : replay_; + } + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+   * Set `Replay.ReplayConfig` to configure the replay.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayOrBuilder getReplayOrBuilder() { + return replay_ == null + ? com.google.cloud.policysimulator.v1.Replay.getDefaultInstance() + : replay_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (replay_ != null) { + output.writeMessage(2, getReplay()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (replay_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getReplay()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.CreateReplayRequest)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.CreateReplayRequest other = + (com.google.cloud.policysimulator.v1.CreateReplayRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasReplay() != other.hasReplay()) return false; + if (hasReplay()) { + if (!getReplay().equals(other.getReplay())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasReplay()) { + hash = (37 * hash) + REPLAY_FIELD_NUMBER; + hash = (53 * hash) + getReplay().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.CreateReplayRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.CreateReplayRequest 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.policysimulator.v1.CreateReplayRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.CreateReplayRequest 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.policysimulator.v1.CreateReplayRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.CreateReplayRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.CreateReplayRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.CreateReplayRequest 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.policysimulator.v1.CreateReplayRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.CreateReplayRequest 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.policysimulator.v1.CreateReplayRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.CreateReplayRequest 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.policysimulator.v1.CreateReplayRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [Simulator.CreateReplay][google.cloud.policysimulator.v1.Simulator.CreateReplay].
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.CreateReplayRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.CreateReplayRequest) + com.google.cloud.policysimulator.v1.CreateReplayRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.CreateReplayRequest.class, + com.google.cloud.policysimulator.v1.CreateReplayRequest.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.CreateReplayRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + replay_ = null; + if (replayBuilder_ != null) { + replayBuilder_.dispose(); + replayBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.CreateReplayRequest getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.CreateReplayRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.CreateReplayRequest build() { + com.google.cloud.policysimulator.v1.CreateReplayRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.CreateReplayRequest buildPartial() { + com.google.cloud.policysimulator.v1.CreateReplayRequest result = + new com.google.cloud.policysimulator.v1.CreateReplayRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.CreateReplayRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.replay_ = replayBuilder_ == null ? replay_ : replayBuilder_.build(); + } + } + + @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.policysimulator.v1.CreateReplayRequest) { + return mergeFrom((com.google.cloud.policysimulator.v1.CreateReplayRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.CreateReplayRequest other) { + if (other == com.google.cloud.policysimulator.v1.CreateReplayRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasReplay()) { + mergeReplay(other.getReplay()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getReplayFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent resource where this
+     * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This
+     * resource must be a project, folder, or organization with a location.
+     *
+     * Example: `projects/my-example-project/locations/global`
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The parent resource where this
+     * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This
+     * resource must be a project, folder, or organization with a location.
+     *
+     * Example: `projects/my-example-project/locations/global`
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The parent resource where this
+     * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This
+     * resource must be a project, folder, or organization with a location.
+     *
+     * Example: `projects/my-example-project/locations/global`
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent resource where this
+     * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This
+     * resource must be a project, folder, or organization with a location.
+     *
+     * Example: `projects/my-example-project/locations/global`
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent resource where this
+     * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This
+     * resource must be a project, folder, or organization with a location.
+     *
+     * Example: `projects/my-example-project/locations/global`
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.cloud.policysimulator.v1.Replay replay_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.Replay, + com.google.cloud.policysimulator.v1.Replay.Builder, + com.google.cloud.policysimulator.v1.ReplayOrBuilder> + replayBuilder_; + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+     * Set `Replay.ReplayConfig` to configure the replay.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the replay field is set. + */ + public boolean hasReplay() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+     * Set `Replay.ReplayConfig` to configure the replay.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The replay. + */ + public com.google.cloud.policysimulator.v1.Replay getReplay() { + if (replayBuilder_ == null) { + return replay_ == null + ? com.google.cloud.policysimulator.v1.Replay.getDefaultInstance() + : replay_; + } else { + return replayBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+     * Set `Replay.ReplayConfig` to configure the replay.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setReplay(com.google.cloud.policysimulator.v1.Replay value) { + if (replayBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + replay_ = value; + } else { + replayBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+     * Set `Replay.ReplayConfig` to configure the replay.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setReplay(com.google.cloud.policysimulator.v1.Replay.Builder builderForValue) { + if (replayBuilder_ == null) { + replay_ = builderForValue.build(); + } else { + replayBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+     * Set `Replay.ReplayConfig` to configure the replay.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeReplay(com.google.cloud.policysimulator.v1.Replay value) { + if (replayBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && replay_ != null + && replay_ != com.google.cloud.policysimulator.v1.Replay.getDefaultInstance()) { + getReplayBuilder().mergeFrom(value); + } else { + replay_ = value; + } + } else { + replayBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+     * Set `Replay.ReplayConfig` to configure the replay.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearReplay() { + bitField0_ = (bitField0_ & ~0x00000002); + replay_ = null; + if (replayBuilder_ != null) { + replayBuilder_.dispose(); + replayBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+     * Set `Replay.ReplayConfig` to configure the replay.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.policysimulator.v1.Replay.Builder getReplayBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getReplayFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+     * Set `Replay.ReplayConfig` to configure the replay.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.policysimulator.v1.ReplayOrBuilder getReplayOrBuilder() { + if (replayBuilder_ != null) { + return replayBuilder_.getMessageOrBuilder(); + } else { + return replay_ == null + ? com.google.cloud.policysimulator.v1.Replay.getDefaultInstance() + : replay_; + } + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+     * Set `Replay.ReplayConfig` to configure the replay.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.Replay, + com.google.cloud.policysimulator.v1.Replay.Builder, + com.google.cloud.policysimulator.v1.ReplayOrBuilder> + getReplayFieldBuilder() { + if (replayBuilder_ == null) { + replayBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.Replay, + com.google.cloud.policysimulator.v1.Replay.Builder, + com.google.cloud.policysimulator.v1.ReplayOrBuilder>( + getReplay(), getParentForChildren(), isClean()); + replay_ = null; + } + return replayBuilder_; + } + + @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.policysimulator.v1.CreateReplayRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.CreateReplayRequest) + private static final com.google.cloud.policysimulator.v1.CreateReplayRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.CreateReplayRequest(); + } + + public static com.google.cloud.policysimulator.v1.CreateReplayRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateReplayRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.CreateReplayRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/CreateReplayRequestOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/CreateReplayRequestOrBuilder.java new file mode 100644 index 000000000000..62638c85346b --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/CreateReplayRequestOrBuilder.java @@ -0,0 +1,102 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface CreateReplayRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.CreateReplayRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent resource where this
+   * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This
+   * resource must be a project, folder, or organization with a location.
+   *
+   * Example: `projects/my-example-project/locations/global`
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent resource where this
+   * [Replay][google.cloud.policysimulator.v1.Replay] will be created. This
+   * resource must be a project, folder, or organization with a location.
+   *
+   * Example: `projects/my-example-project/locations/global`
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+   * Set `Replay.ReplayConfig` to configure the replay.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the replay field is set. + */ + boolean hasReplay(); + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+   * Set `Replay.ReplayConfig` to configure the replay.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The replay. + */ + com.google.cloud.policysimulator.v1.Replay getReplay(); + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create.
+   * Set `Replay.ReplayConfig` to configure the replay.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay replay = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.policysimulator.v1.ReplayOrBuilder getReplayOrBuilder(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedAccess.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedAccess.java new file mode 100644 index 000000000000..5b96eed43be6 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedAccess.java @@ -0,0 +1,1789 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Details about how a set of policies, listed in
+ * [ExplainedPolicy][google.cloud.policysimulator.v1.ExplainedPolicy], resulted
+ * in a certain [AccessState][google.cloud.policysimulator.v1.AccessState] when
+ * replaying an access tuple.
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ExplainedAccess} + */ +public final class ExplainedAccess extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.ExplainedAccess) + ExplainedAccessOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExplainedAccess.newBuilder() to construct. + private ExplainedAccess(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExplainedAccess() { + accessState_ = 0; + policies_ = java.util.Collections.emptyList(); + errors_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExplainedAccess(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ExplainedAccess_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ExplainedAccess_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ExplainedAccess.class, + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder.class); + } + + public static final int ACCESS_STATE_FIELD_NUMBER = 1; + private int accessState_ = 0; + /** + * + * + *
+   * Whether the principal in the access tuple has permission to access the
+   * resource in the access tuple under the given policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessState access_state = 1; + * + * @return The enum numeric value on the wire for accessState. + */ + @java.lang.Override + public int getAccessStateValue() { + return accessState_; + } + /** + * + * + *
+   * Whether the principal in the access tuple has permission to access the
+   * resource in the access tuple under the given policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessState access_state = 1; + * + * @return The accessState. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessState getAccessState() { + com.google.cloud.policysimulator.v1.AccessState result = + com.google.cloud.policysimulator.v1.AccessState.forNumber(accessState_); + return result == null ? com.google.cloud.policysimulator.v1.AccessState.UNRECOGNIZED : result; + } + + public static final int POLICIES_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private java.util.List policies_; + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + @java.lang.Override + public java.util.List getPoliciesList() { + return policies_; + } + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + @java.lang.Override + public java.util.List + getPoliciesOrBuilderList() { + return policies_; + } + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + @java.lang.Override + public int getPoliciesCount() { + return policies_.size(); + } + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedPolicy getPolicies(int index) { + return policies_.get(index); + } + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedPolicyOrBuilder getPoliciesOrBuilder( + int index) { + return policies_.get(index); + } + + public static final int ERRORS_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private java.util.List errors_; + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + @java.lang.Override + public java.util.List getErrorsList() { + return errors_; + } + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + @java.lang.Override + public java.util.List getErrorsOrBuilderList() { + return errors_; + } + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + @java.lang.Override + public int getErrorsCount() { + return errors_.size(); + } + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + @java.lang.Override + public com.google.rpc.Status getErrors(int index) { + return errors_.get(index); + } + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getErrorsOrBuilder(int index) { + return errors_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (accessState_ + != com.google.cloud.policysimulator.v1.AccessState.ACCESS_STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, accessState_); + } + for (int i = 0; i < policies_.size(); i++) { + output.writeMessage(2, policies_.get(i)); + } + for (int i = 0; i < errors_.size(); i++) { + output.writeMessage(3, errors_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (accessState_ + != com.google.cloud.policysimulator.v1.AccessState.ACCESS_STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, accessState_); + } + for (int i = 0; i < policies_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, policies_.get(i)); + } + for (int i = 0; i < errors_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, errors_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.ExplainedAccess)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.ExplainedAccess other = + (com.google.cloud.policysimulator.v1.ExplainedAccess) obj; + + if (accessState_ != other.accessState_) return false; + if (!getPoliciesList().equals(other.getPoliciesList())) return false; + if (!getErrorsList().equals(other.getErrorsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ACCESS_STATE_FIELD_NUMBER; + hash = (53 * hash) + accessState_; + if (getPoliciesCount() > 0) { + hash = (37 * hash) + POLICIES_FIELD_NUMBER; + hash = (53 * hash) + getPoliciesList().hashCode(); + } + if (getErrorsCount() > 0) { + hash = (37 * hash) + ERRORS_FIELD_NUMBER; + hash = (53 * hash) + getErrorsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.ExplainedAccess parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ExplainedAccess 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.policysimulator.v1.ExplainedAccess parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ExplainedAccess 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.policysimulator.v1.ExplainedAccess parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ExplainedAccess parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.ExplainedAccess parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ExplainedAccess 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.policysimulator.v1.ExplainedAccess parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ExplainedAccess 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.policysimulator.v1.ExplainedAccess parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ExplainedAccess 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.policysimulator.v1.ExplainedAccess prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Details about how a set of policies, listed in
+   * [ExplainedPolicy][google.cloud.policysimulator.v1.ExplainedPolicy], resulted
+   * in a certain [AccessState][google.cloud.policysimulator.v1.AccessState] when
+   * replaying an access tuple.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ExplainedAccess} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.ExplainedAccess) + com.google.cloud.policysimulator.v1.ExplainedAccessOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ExplainedAccess_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ExplainedAccess_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ExplainedAccess.class, + com.google.cloud.policysimulator.v1.ExplainedAccess.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.ExplainedAccess.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + accessState_ = 0; + if (policiesBuilder_ == null) { + policies_ = java.util.Collections.emptyList(); + } else { + policies_ = null; + policiesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (errorsBuilder_ == null) { + errors_ = java.util.Collections.emptyList(); + } else { + errors_ = null; + errorsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ExplainedAccess_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedAccess getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedAccess build() { + com.google.cloud.policysimulator.v1.ExplainedAccess result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedAccess buildPartial() { + com.google.cloud.policysimulator.v1.ExplainedAccess result = + new com.google.cloud.policysimulator.v1.ExplainedAccess(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.policysimulator.v1.ExplainedAccess result) { + if (policiesBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + policies_ = java.util.Collections.unmodifiableList(policies_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.policies_ = policies_; + } else { + result.policies_ = policiesBuilder_.build(); + } + if (errorsBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0)) { + errors_ = java.util.Collections.unmodifiableList(errors_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.errors_ = errors_; + } else { + result.errors_ = errorsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.ExplainedAccess result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.accessState_ = accessState_; + } + } + + @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.policysimulator.v1.ExplainedAccess) { + return mergeFrom((com.google.cloud.policysimulator.v1.ExplainedAccess) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.ExplainedAccess other) { + if (other == com.google.cloud.policysimulator.v1.ExplainedAccess.getDefaultInstance()) + return this; + if (other.accessState_ != 0) { + setAccessStateValue(other.getAccessStateValue()); + } + if (policiesBuilder_ == null) { + if (!other.policies_.isEmpty()) { + if (policies_.isEmpty()) { + policies_ = other.policies_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensurePoliciesIsMutable(); + policies_.addAll(other.policies_); + } + onChanged(); + } + } else { + if (!other.policies_.isEmpty()) { + if (policiesBuilder_.isEmpty()) { + policiesBuilder_.dispose(); + policiesBuilder_ = null; + policies_ = other.policies_; + bitField0_ = (bitField0_ & ~0x00000002); + policiesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getPoliciesFieldBuilder() + : null; + } else { + policiesBuilder_.addAllMessages(other.policies_); + } + } + } + if (errorsBuilder_ == null) { + if (!other.errors_.isEmpty()) { + if (errors_.isEmpty()) { + errors_ = other.errors_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureErrorsIsMutable(); + errors_.addAll(other.errors_); + } + onChanged(); + } + } else { + if (!other.errors_.isEmpty()) { + if (errorsBuilder_.isEmpty()) { + errorsBuilder_.dispose(); + errorsBuilder_ = null; + errors_ = other.errors_; + bitField0_ = (bitField0_ & ~0x00000004); + errorsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getErrorsFieldBuilder() + : null; + } else { + errorsBuilder_.addAllMessages(other.errors_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + accessState_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + com.google.cloud.policysimulator.v1.ExplainedPolicy m = + input.readMessage( + com.google.cloud.policysimulator.v1.ExplainedPolicy.parser(), + extensionRegistry); + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.add(m); + } else { + policiesBuilder_.addMessage(m); + } + break; + } // case 18 + case 26: + { + com.google.rpc.Status m = + input.readMessage(com.google.rpc.Status.parser(), extensionRegistry); + if (errorsBuilder_ == null) { + ensureErrorsIsMutable(); + errors_.add(m); + } else { + errorsBuilder_.addMessage(m); + } + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int accessState_ = 0; + /** + * + * + *
+     * Whether the principal in the access tuple has permission to access the
+     * resource in the access tuple under the given policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access_state = 1; + * + * @return The enum numeric value on the wire for accessState. + */ + @java.lang.Override + public int getAccessStateValue() { + return accessState_; + } + /** + * + * + *
+     * Whether the principal in the access tuple has permission to access the
+     * resource in the access tuple under the given policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access_state = 1; + * + * @param value The enum numeric value on the wire for accessState to set. + * @return This builder for chaining. + */ + public Builder setAccessStateValue(int value) { + accessState_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Whether the principal in the access tuple has permission to access the
+     * resource in the access tuple under the given policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access_state = 1; + * + * @return The accessState. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessState getAccessState() { + com.google.cloud.policysimulator.v1.AccessState result = + com.google.cloud.policysimulator.v1.AccessState.forNumber(accessState_); + return result == null ? com.google.cloud.policysimulator.v1.AccessState.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Whether the principal in the access tuple has permission to access the
+     * resource in the access tuple under the given policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access_state = 1; + * + * @param value The accessState to set. + * @return This builder for chaining. + */ + public Builder setAccessState(com.google.cloud.policysimulator.v1.AccessState value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + accessState_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Whether the principal in the access tuple has permission to access the
+     * resource in the access tuple under the given policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access_state = 1; + * + * @return This builder for chaining. + */ + public Builder clearAccessState() { + bitField0_ = (bitField0_ & ~0x00000001); + accessState_ = 0; + onChanged(); + return this; + } + + private java.util.List policies_ = + java.util.Collections.emptyList(); + + private void ensurePoliciesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + policies_ = + new java.util.ArrayList(policies_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.policysimulator.v1.ExplainedPolicy, + com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder, + com.google.cloud.policysimulator.v1.ExplainedPolicyOrBuilder> + policiesBuilder_; + + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public java.util.List getPoliciesList() { + if (policiesBuilder_ == null) { + return java.util.Collections.unmodifiableList(policies_); + } else { + return policiesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public int getPoliciesCount() { + if (policiesBuilder_ == null) { + return policies_.size(); + } else { + return policiesBuilder_.getCount(); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public com.google.cloud.policysimulator.v1.ExplainedPolicy getPolicies(int index) { + if (policiesBuilder_ == null) { + return policies_.get(index); + } else { + return policiesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public Builder setPolicies( + int index, com.google.cloud.policysimulator.v1.ExplainedPolicy value) { + if (policiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoliciesIsMutable(); + policies_.set(index, value); + onChanged(); + } else { + policiesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public Builder setPolicies( + int index, com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder builderForValue) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.set(index, builderForValue.build()); + onChanged(); + } else { + policiesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public Builder addPolicies(com.google.cloud.policysimulator.v1.ExplainedPolicy value) { + if (policiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoliciesIsMutable(); + policies_.add(value); + onChanged(); + } else { + policiesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public Builder addPolicies( + int index, com.google.cloud.policysimulator.v1.ExplainedPolicy value) { + if (policiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePoliciesIsMutable(); + policies_.add(index, value); + onChanged(); + } else { + policiesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public Builder addPolicies( + com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder builderForValue) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.add(builderForValue.build()); + onChanged(); + } else { + policiesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public Builder addPolicies( + int index, com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder builderForValue) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.add(index, builderForValue.build()); + onChanged(); + } else { + policiesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public Builder addAllPolicies( + java.lang.Iterable values) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, policies_); + onChanged(); + } else { + policiesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public Builder clearPolicies() { + if (policiesBuilder_ == null) { + policies_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + policiesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public Builder removePolicies(int index) { + if (policiesBuilder_ == null) { + ensurePoliciesIsMutable(); + policies_.remove(index); + onChanged(); + } else { + policiesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder getPoliciesBuilder( + int index) { + return getPoliciesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public com.google.cloud.policysimulator.v1.ExplainedPolicyOrBuilder getPoliciesOrBuilder( + int index) { + if (policiesBuilder_ == null) { + return policies_.get(index); + } else { + return policiesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public java.util.List + getPoliciesOrBuilderList() { + if (policiesBuilder_ != null) { + return policiesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(policies_); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder addPoliciesBuilder() { + return getPoliciesFieldBuilder() + .addBuilder(com.google.cloud.policysimulator.v1.ExplainedPolicy.getDefaultInstance()); + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder addPoliciesBuilder( + int index) { + return getPoliciesFieldBuilder() + .addBuilder( + index, com.google.cloud.policysimulator.v1.ExplainedPolicy.getDefaultInstance()); + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains the policies that led to that result.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + public java.util.List + getPoliciesBuilderList() { + return getPoliciesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.policysimulator.v1.ExplainedPolicy, + com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder, + com.google.cloud.policysimulator.v1.ExplainedPolicyOrBuilder> + getPoliciesFieldBuilder() { + if (policiesBuilder_ == null) { + policiesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.policysimulator.v1.ExplainedPolicy, + com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder, + com.google.cloud.policysimulator.v1.ExplainedPolicyOrBuilder>( + policies_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + policies_ = null; + } + return policiesBuilder_; + } + + private java.util.List errors_ = java.util.Collections.emptyList(); + + private void ensureErrorsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + errors_ = new java.util.ArrayList(errors_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + errorsBuilder_; + + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public java.util.List getErrorsList() { + if (errorsBuilder_ == null) { + return java.util.Collections.unmodifiableList(errors_); + } else { + return errorsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public int getErrorsCount() { + if (errorsBuilder_ == null) { + return errors_.size(); + } else { + return errorsBuilder_.getCount(); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public com.google.rpc.Status getErrors(int index) { + if (errorsBuilder_ == null) { + return errors_.get(index); + } else { + return errorsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public Builder setErrors(int index, com.google.rpc.Status value) { + if (errorsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureErrorsIsMutable(); + errors_.set(index, value); + onChanged(); + } else { + errorsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public Builder setErrors(int index, com.google.rpc.Status.Builder builderForValue) { + if (errorsBuilder_ == null) { + ensureErrorsIsMutable(); + errors_.set(index, builderForValue.build()); + onChanged(); + } else { + errorsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public Builder addErrors(com.google.rpc.Status value) { + if (errorsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureErrorsIsMutable(); + errors_.add(value); + onChanged(); + } else { + errorsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public Builder addErrors(int index, com.google.rpc.Status value) { + if (errorsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureErrorsIsMutable(); + errors_.add(index, value); + onChanged(); + } else { + errorsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public Builder addErrors(com.google.rpc.Status.Builder builderForValue) { + if (errorsBuilder_ == null) { + ensureErrorsIsMutable(); + errors_.add(builderForValue.build()); + onChanged(); + } else { + errorsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public Builder addErrors(int index, com.google.rpc.Status.Builder builderForValue) { + if (errorsBuilder_ == null) { + ensureErrorsIsMutable(); + errors_.add(index, builderForValue.build()); + onChanged(); + } else { + errorsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public Builder addAllErrors(java.lang.Iterable values) { + if (errorsBuilder_ == null) { + ensureErrorsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, errors_); + onChanged(); + } else { + errorsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public Builder clearErrors() { + if (errorsBuilder_ == null) { + errors_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + errorsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public Builder removeErrors(int index) { + if (errorsBuilder_ == null) { + ensureErrorsIsMutable(); + errors_.remove(index); + onChanged(); + } else { + errorsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public com.google.rpc.Status.Builder getErrorsBuilder(int index) { + return getErrorsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public com.google.rpc.StatusOrBuilder getErrorsOrBuilder(int index) { + if (errorsBuilder_ == null) { + return errors_.get(index); + } else { + return errorsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public java.util.List getErrorsOrBuilderList() { + if (errorsBuilder_ != null) { + return errorsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(errors_); + } + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public com.google.rpc.Status.Builder addErrorsBuilder() { + return getErrorsFieldBuilder().addBuilder(com.google.rpc.Status.getDefaultInstance()); + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public com.google.rpc.Status.Builder addErrorsBuilder(int index) { + return getErrorsFieldBuilder().addBuilder(index, com.google.rpc.Status.getDefaultInstance()); + } + /** + * + * + *
+     * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+     * `UNKNOWN`, this field contains a list of errors explaining why the result
+     * is `UNKNOWN`.
+     *
+     * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+     * omitted.
+     * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + public java.util.List getErrorsBuilderList() { + return getErrorsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getErrorsFieldBuilder() { + if (errorsBuilder_ == null) { + errorsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>( + errors_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); + errors_ = null; + } + return errorsBuilder_; + } + + @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.policysimulator.v1.ExplainedAccess) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.ExplainedAccess) + private static final com.google.cloud.policysimulator.v1.ExplainedAccess DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.ExplainedAccess(); + } + + public static com.google.cloud.policysimulator.v1.ExplainedAccess getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExplainedAccess parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedAccess getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedAccessOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedAccessOrBuilder.java new file mode 100644 index 000000000000..bae0b817ec0c --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedAccessOrBuilder.java @@ -0,0 +1,200 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface ExplainedAccessOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.ExplainedAccess) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Whether the principal in the access tuple has permission to access the
+   * resource in the access tuple under the given policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessState access_state = 1; + * + * @return The enum numeric value on the wire for accessState. + */ + int getAccessStateValue(); + /** + * + * + *
+   * Whether the principal in the access tuple has permission to access the
+   * resource in the access tuple under the given policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessState access_state = 1; + * + * @return The accessState. + */ + com.google.cloud.policysimulator.v1.AccessState getAccessState(); + + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + java.util.List getPoliciesList(); + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + com.google.cloud.policysimulator.v1.ExplainedPolicy getPolicies(int index); + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + int getPoliciesCount(); + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + java.util.List + getPoliciesOrBuilderList(); + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains the policies that led to that result.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ExplainedPolicy policies = 2; + */ + com.google.cloud.policysimulator.v1.ExplainedPolicyOrBuilder getPoliciesOrBuilder(int index); + + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + java.util.List getErrorsList(); + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + com.google.rpc.Status getErrors(int index); + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + int getErrorsCount(); + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + java.util.List getErrorsOrBuilderList(); + /** + * + * + *
+   * If the [AccessState][google.cloud.policysimulator.v1.AccessState] is
+   * `UNKNOWN`, this field contains a list of errors explaining why the result
+   * is `UNKNOWN`.
+   *
+   * If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is
+   * omitted.
+   * 
+ * + * repeated .google.rpc.Status errors = 3; + */ + com.google.rpc.StatusOrBuilder getErrorsOrBuilder(int index); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedPolicy.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedPolicy.java new file mode 100644 index 000000000000..ca1d89800a67 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedPolicy.java @@ -0,0 +1,2028 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/explanations.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Details about how a specific IAM [Policy][google.iam.v1.Policy] contributed
+ * to the access check.
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ExplainedPolicy} + */ +public final class ExplainedPolicy extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.ExplainedPolicy) + ExplainedPolicyOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExplainedPolicy.newBuilder() to construct. + private ExplainedPolicy(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExplainedPolicy() { + access_ = 0; + fullResourceName_ = ""; + bindingExplanations_ = java.util.Collections.emptyList(); + relevance_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExplainedPolicy(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ExplainedPolicy.class, + com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder.class); + } + + public static final int ACCESS_FIELD_NUMBER = 1; + private int access_ = 0; + /** + * + * + *
+   * Indicates whether _this policy_ provides the specified permission to the
+   * specified principal for the specified resource.
+   *
+   * This field does _not_ indicate whether the principal actually has the
+   * permission for the resource. There might be another policy that overrides
+   * this policy. To determine whether the principal actually has the
+   * permission, use the `access` field in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessState access = 1; + * + * @return The enum numeric value on the wire for access. + */ + @java.lang.Override + public int getAccessValue() { + return access_; + } + /** + * + * + *
+   * Indicates whether _this policy_ provides the specified permission to the
+   * specified principal for the specified resource.
+   *
+   * This field does _not_ indicate whether the principal actually has the
+   * permission for the resource. There might be another policy that overrides
+   * this policy. To determine whether the principal actually has the
+   * permission, use the `access` field in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessState access = 1; + * + * @return The access. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessState getAccess() { + com.google.cloud.policysimulator.v1.AccessState result = + com.google.cloud.policysimulator.v1.AccessState.forNumber(access_); + return result == null ? com.google.cloud.policysimulator.v1.AccessState.UNRECOGNIZED : result; + } + + public static final int FULL_RESOURCE_NAME_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object fullResourceName_ = ""; + /** + * + * + *
+   * The full resource name that identifies the resource. For example,
+   * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   *
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   * 
+ * + * string full_resource_name = 2; + * + * @return The fullResourceName. + */ + @java.lang.Override + public java.lang.String getFullResourceName() { + java.lang.Object ref = fullResourceName_; + 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(); + fullResourceName_ = s; + return s; + } + } + /** + * + * + *
+   * The full resource name that identifies the resource. For example,
+   * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   *
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   * 
+ * + * string full_resource_name = 2; + * + * @return The bytes for fullResourceName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFullResourceNameBytes() { + java.lang.Object ref = fullResourceName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + fullResourceName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int POLICY_FIELD_NUMBER = 3; + private com.google.iam.v1.Policy policy_; + /** + * + * + *
+   * The IAM policy attached to the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is empty.
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return Whether the policy field is set. + */ + @java.lang.Override + public boolean hasPolicy() { + return policy_ != null; + } + /** + * + * + *
+   * The IAM policy attached to the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is empty.
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return The policy. + */ + @java.lang.Override + public com.google.iam.v1.Policy getPolicy() { + return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_; + } + /** + * + * + *
+   * The IAM policy attached to the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is empty.
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + @java.lang.Override + public com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder() { + return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_; + } + + public static final int BINDING_EXPLANATIONS_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private java.util.List + bindingExplanations_; + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + @java.lang.Override + public java.util.List + getBindingExplanationsList() { + return bindingExplanations_; + } + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + @java.lang.Override + public java.util.List + getBindingExplanationsOrBuilderList() { + return bindingExplanations_; + } + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + @java.lang.Override + public int getBindingExplanationsCount() { + return bindingExplanations_.size(); + } + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanation getBindingExplanations(int index) { + return bindingExplanations_.get(index); + } + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.BindingExplanationOrBuilder + getBindingExplanationsOrBuilder(int index) { + return bindingExplanations_.get(index); + } + + public static final int RELEVANCE_FIELD_NUMBER = 5; + private int relevance_ = 0; + /** + * + * + *
+   * The relevance of this policy to the overall determination in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 5; + * + * @return The enum numeric value on the wire for relevance. + */ + @java.lang.Override + public int getRelevanceValue() { + return relevance_; + } + /** + * + * + *
+   * The relevance of this policy to the overall determination in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 5; + * + * @return The relevance. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.HeuristicRelevance getRelevance() { + com.google.cloud.policysimulator.v1.HeuristicRelevance result = + com.google.cloud.policysimulator.v1.HeuristicRelevance.forNumber(relevance_); + return result == null + ? com.google.cloud.policysimulator.v1.HeuristicRelevance.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (access_ + != com.google.cloud.policysimulator.v1.AccessState.ACCESS_STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, access_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(fullResourceName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, fullResourceName_); + } + if (policy_ != null) { + output.writeMessage(3, getPolicy()); + } + for (int i = 0; i < bindingExplanations_.size(); i++) { + output.writeMessage(4, bindingExplanations_.get(i)); + } + if (relevance_ + != com.google.cloud.policysimulator.v1.HeuristicRelevance.HEURISTIC_RELEVANCE_UNSPECIFIED + .getNumber()) { + output.writeEnum(5, relevance_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (access_ + != com.google.cloud.policysimulator.v1.AccessState.ACCESS_STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, access_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(fullResourceName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, fullResourceName_); + } + if (policy_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getPolicy()); + } + for (int i = 0; i < bindingExplanations_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(4, bindingExplanations_.get(i)); + } + if (relevance_ + != com.google.cloud.policysimulator.v1.HeuristicRelevance.HEURISTIC_RELEVANCE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, relevance_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.ExplainedPolicy)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.ExplainedPolicy other = + (com.google.cloud.policysimulator.v1.ExplainedPolicy) obj; + + if (access_ != other.access_) return false; + if (!getFullResourceName().equals(other.getFullResourceName())) return false; + if (hasPolicy() != other.hasPolicy()) return false; + if (hasPolicy()) { + if (!getPolicy().equals(other.getPolicy())) return false; + } + if (!getBindingExplanationsList().equals(other.getBindingExplanationsList())) return false; + if (relevance_ != other.relevance_) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ACCESS_FIELD_NUMBER; + hash = (53 * hash) + access_; + hash = (37 * hash) + FULL_RESOURCE_NAME_FIELD_NUMBER; + hash = (53 * hash) + getFullResourceName().hashCode(); + if (hasPolicy()) { + hash = (37 * hash) + POLICY_FIELD_NUMBER; + hash = (53 * hash) + getPolicy().hashCode(); + } + if (getBindingExplanationsCount() > 0) { + hash = (37 * hash) + BINDING_EXPLANATIONS_FIELD_NUMBER; + hash = (53 * hash) + getBindingExplanationsList().hashCode(); + } + hash = (37 * hash) + RELEVANCE_FIELD_NUMBER; + hash = (53 * hash) + relevance_; + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.ExplainedPolicy parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ExplainedPolicy 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.policysimulator.v1.ExplainedPolicy parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ExplainedPolicy 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.policysimulator.v1.ExplainedPolicy parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ExplainedPolicy parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.ExplainedPolicy parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ExplainedPolicy 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.policysimulator.v1.ExplainedPolicy parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ExplainedPolicy 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.policysimulator.v1.ExplainedPolicy parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ExplainedPolicy 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.policysimulator.v1.ExplainedPolicy prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Details about how a specific IAM [Policy][google.iam.v1.Policy] contributed
+   * to the access check.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ExplainedPolicy} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.ExplainedPolicy) + com.google.cloud.policysimulator.v1.ExplainedPolicyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ExplainedPolicy.class, + com.google.cloud.policysimulator.v1.ExplainedPolicy.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.ExplainedPolicy.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + access_ = 0; + fullResourceName_ = ""; + policy_ = null; + if (policyBuilder_ != null) { + policyBuilder_.dispose(); + policyBuilder_ = null; + } + if (bindingExplanationsBuilder_ == null) { + bindingExplanations_ = java.util.Collections.emptyList(); + } else { + bindingExplanations_ = null; + bindingExplanationsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + relevance_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.ExplanationsProto + .internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedPolicy getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.ExplainedPolicy.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedPolicy build() { + com.google.cloud.policysimulator.v1.ExplainedPolicy result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedPolicy buildPartial() { + com.google.cloud.policysimulator.v1.ExplainedPolicy result = + new com.google.cloud.policysimulator.v1.ExplainedPolicy(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.policysimulator.v1.ExplainedPolicy result) { + if (bindingExplanationsBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0)) { + bindingExplanations_ = java.util.Collections.unmodifiableList(bindingExplanations_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.bindingExplanations_ = bindingExplanations_; + } else { + result.bindingExplanations_ = bindingExplanationsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.ExplainedPolicy result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.access_ = access_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.fullResourceName_ = fullResourceName_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.policy_ = policyBuilder_ == null ? policy_ : policyBuilder_.build(); + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.relevance_ = relevance_; + } + } + + @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.policysimulator.v1.ExplainedPolicy) { + return mergeFrom((com.google.cloud.policysimulator.v1.ExplainedPolicy) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.ExplainedPolicy other) { + if (other == com.google.cloud.policysimulator.v1.ExplainedPolicy.getDefaultInstance()) + return this; + if (other.access_ != 0) { + setAccessValue(other.getAccessValue()); + } + if (!other.getFullResourceName().isEmpty()) { + fullResourceName_ = other.fullResourceName_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasPolicy()) { + mergePolicy(other.getPolicy()); + } + if (bindingExplanationsBuilder_ == null) { + if (!other.bindingExplanations_.isEmpty()) { + if (bindingExplanations_.isEmpty()) { + bindingExplanations_ = other.bindingExplanations_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureBindingExplanationsIsMutable(); + bindingExplanations_.addAll(other.bindingExplanations_); + } + onChanged(); + } + } else { + if (!other.bindingExplanations_.isEmpty()) { + if (bindingExplanationsBuilder_.isEmpty()) { + bindingExplanationsBuilder_.dispose(); + bindingExplanationsBuilder_ = null; + bindingExplanations_ = other.bindingExplanations_; + bitField0_ = (bitField0_ & ~0x00000008); + bindingExplanationsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getBindingExplanationsFieldBuilder() + : null; + } else { + bindingExplanationsBuilder_.addAllMessages(other.bindingExplanations_); + } + } + } + if (other.relevance_ != 0) { + setRelevanceValue(other.getRelevanceValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + access_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + fullResourceName_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage(getPolicyFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + com.google.cloud.policysimulator.v1.BindingExplanation m = + input.readMessage( + com.google.cloud.policysimulator.v1.BindingExplanation.parser(), + extensionRegistry); + if (bindingExplanationsBuilder_ == null) { + ensureBindingExplanationsIsMutable(); + bindingExplanations_.add(m); + } else { + bindingExplanationsBuilder_.addMessage(m); + } + break; + } // case 34 + case 40: + { + relevance_ = input.readEnum(); + bitField0_ |= 0x00000010; + break; + } // case 40 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int access_ = 0; + /** + * + * + *
+     * Indicates whether _this policy_ provides the specified permission to the
+     * specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another policy that overrides
+     * this policy. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access = 1; + * + * @return The enum numeric value on the wire for access. + */ + @java.lang.Override + public int getAccessValue() { + return access_; + } + /** + * + * + *
+     * Indicates whether _this policy_ provides the specified permission to the
+     * specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another policy that overrides
+     * this policy. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access = 1; + * + * @param value The enum numeric value on the wire for access to set. + * @return This builder for chaining. + */ + public Builder setAccessValue(int value) { + access_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates whether _this policy_ provides the specified permission to the
+     * specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another policy that overrides
+     * this policy. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access = 1; + * + * @return The access. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessState getAccess() { + com.google.cloud.policysimulator.v1.AccessState result = + com.google.cloud.policysimulator.v1.AccessState.forNumber(access_); + return result == null ? com.google.cloud.policysimulator.v1.AccessState.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Indicates whether _this policy_ provides the specified permission to the
+     * specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another policy that overrides
+     * this policy. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access = 1; + * + * @param value The access to set. + * @return This builder for chaining. + */ + public Builder setAccess(com.google.cloud.policysimulator.v1.AccessState value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + access_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates whether _this policy_ provides the specified permission to the
+     * specified principal for the specified resource.
+     *
+     * This field does _not_ indicate whether the principal actually has the
+     * permission for the resource. There might be another policy that overrides
+     * this policy. To determine whether the principal actually has the
+     * permission, use the `access` field in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessState access = 1; + * + * @return This builder for chaining. + */ + public Builder clearAccess() { + bitField0_ = (bitField0_ & ~0x00000001); + access_ = 0; + onChanged(); + return this; + } + + private java.lang.Object fullResourceName_ = ""; + /** + * + * + *
+     * The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2; + * + * @return The fullResourceName. + */ + public java.lang.String getFullResourceName() { + java.lang.Object ref = fullResourceName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + fullResourceName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2; + * + * @return The bytes for fullResourceName. + */ + public com.google.protobuf.ByteString getFullResourceNameBytes() { + java.lang.Object ref = fullResourceName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + fullResourceName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2; + * + * @param value The fullResourceName to set. + * @return This builder for chaining. + */ + public Builder setFullResourceName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + fullResourceName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2; + * + * @return This builder for chaining. + */ + public Builder clearFullResourceName() { + fullResourceName_ = getDefaultInstance().getFullResourceName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * The full resource name that identifies the resource. For example,
+     * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     *
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     * 
+ * + * string full_resource_name = 2; + * + * @param value The bytes for fullResourceName to set. + * @return This builder for chaining. + */ + public Builder setFullResourceNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + fullResourceName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.iam.v1.Policy policy_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v1.Policy, + com.google.iam.v1.Policy.Builder, + com.google.iam.v1.PolicyOrBuilder> + policyBuilder_; + /** + * + * + *
+     * The IAM policy attached to the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is empty.
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return Whether the policy field is set. + */ + public boolean hasPolicy() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * The IAM policy attached to the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is empty.
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return The policy. + */ + public com.google.iam.v1.Policy getPolicy() { + if (policyBuilder_ == null) { + return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_; + } else { + return policyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The IAM policy attached to the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is empty.
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public Builder setPolicy(com.google.iam.v1.Policy value) { + if (policyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + policy_ = value; + } else { + policyBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The IAM policy attached to the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is empty.
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public Builder setPolicy(com.google.iam.v1.Policy.Builder builderForValue) { + if (policyBuilder_ == null) { + policy_ = builderForValue.build(); + } else { + policyBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The IAM policy attached to the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is empty.
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public Builder mergePolicy(com.google.iam.v1.Policy value) { + if (policyBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && policy_ != null + && policy_ != com.google.iam.v1.Policy.getDefaultInstance()) { + getPolicyBuilder().mergeFrom(value); + } else { + policy_ = value; + } + } else { + policyBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The IAM policy attached to the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is empty.
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public Builder clearPolicy() { + bitField0_ = (bitField0_ & ~0x00000004); + policy_ = null; + if (policyBuilder_ != null) { + policyBuilder_.dispose(); + policyBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The IAM policy attached to the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is empty.
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public com.google.iam.v1.Policy.Builder getPolicyBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The IAM policy attached to the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is empty.
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + public com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder() { + if (policyBuilder_ != null) { + return policyBuilder_.getMessageOrBuilder(); + } else { + return policy_ == null ? com.google.iam.v1.Policy.getDefaultInstance() : policy_; + } + } + /** + * + * + *
+     * The IAM policy attached to the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is empty.
+     * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v1.Policy, + com.google.iam.v1.Policy.Builder, + com.google.iam.v1.PolicyOrBuilder> + getPolicyFieldBuilder() { + if (policyBuilder_ == null) { + policyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.iam.v1.Policy, + com.google.iam.v1.Policy.Builder, + com.google.iam.v1.PolicyOrBuilder>(getPolicy(), getParentForChildren(), isClean()); + policy_ = null; + } + return policyBuilder_; + } + + private java.util.List + bindingExplanations_ = java.util.Collections.emptyList(); + + private void ensureBindingExplanationsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + bindingExplanations_ = + new java.util.ArrayList( + bindingExplanations_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.policysimulator.v1.BindingExplanation, + com.google.cloud.policysimulator.v1.BindingExplanation.Builder, + com.google.cloud.policysimulator.v1.BindingExplanationOrBuilder> + bindingExplanationsBuilder_; + + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public java.util.List + getBindingExplanationsList() { + if (bindingExplanationsBuilder_ == null) { + return java.util.Collections.unmodifiableList(bindingExplanations_); + } else { + return bindingExplanationsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public int getBindingExplanationsCount() { + if (bindingExplanationsBuilder_ == null) { + return bindingExplanations_.size(); + } else { + return bindingExplanationsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public com.google.cloud.policysimulator.v1.BindingExplanation getBindingExplanations( + int index) { + if (bindingExplanationsBuilder_ == null) { + return bindingExplanations_.get(index); + } else { + return bindingExplanationsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public Builder setBindingExplanations( + int index, com.google.cloud.policysimulator.v1.BindingExplanation value) { + if (bindingExplanationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBindingExplanationsIsMutable(); + bindingExplanations_.set(index, value); + onChanged(); + } else { + bindingExplanationsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public Builder setBindingExplanations( + int index, com.google.cloud.policysimulator.v1.BindingExplanation.Builder builderForValue) { + if (bindingExplanationsBuilder_ == null) { + ensureBindingExplanationsIsMutable(); + bindingExplanations_.set(index, builderForValue.build()); + onChanged(); + } else { + bindingExplanationsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public Builder addBindingExplanations( + com.google.cloud.policysimulator.v1.BindingExplanation value) { + if (bindingExplanationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBindingExplanationsIsMutable(); + bindingExplanations_.add(value); + onChanged(); + } else { + bindingExplanationsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public Builder addBindingExplanations( + int index, com.google.cloud.policysimulator.v1.BindingExplanation value) { + if (bindingExplanationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBindingExplanationsIsMutable(); + bindingExplanations_.add(index, value); + onChanged(); + } else { + bindingExplanationsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public Builder addBindingExplanations( + com.google.cloud.policysimulator.v1.BindingExplanation.Builder builderForValue) { + if (bindingExplanationsBuilder_ == null) { + ensureBindingExplanationsIsMutable(); + bindingExplanations_.add(builderForValue.build()); + onChanged(); + } else { + bindingExplanationsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public Builder addBindingExplanations( + int index, com.google.cloud.policysimulator.v1.BindingExplanation.Builder builderForValue) { + if (bindingExplanationsBuilder_ == null) { + ensureBindingExplanationsIsMutable(); + bindingExplanations_.add(index, builderForValue.build()); + onChanged(); + } else { + bindingExplanationsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public Builder addAllBindingExplanations( + java.lang.Iterable + values) { + if (bindingExplanationsBuilder_ == null) { + ensureBindingExplanationsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, bindingExplanations_); + onChanged(); + } else { + bindingExplanationsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public Builder clearBindingExplanations() { + if (bindingExplanationsBuilder_ == null) { + bindingExplanations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + bindingExplanationsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public Builder removeBindingExplanations(int index) { + if (bindingExplanationsBuilder_ == null) { + ensureBindingExplanationsIsMutable(); + bindingExplanations_.remove(index); + onChanged(); + } else { + bindingExplanationsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public com.google.cloud.policysimulator.v1.BindingExplanation.Builder + getBindingExplanationsBuilder(int index) { + return getBindingExplanationsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public com.google.cloud.policysimulator.v1.BindingExplanationOrBuilder + getBindingExplanationsOrBuilder(int index) { + if (bindingExplanationsBuilder_ == null) { + return bindingExplanations_.get(index); + } else { + return bindingExplanationsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public java.util.List + getBindingExplanationsOrBuilderList() { + if (bindingExplanationsBuilder_ != null) { + return bindingExplanationsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(bindingExplanations_); + } + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public com.google.cloud.policysimulator.v1.BindingExplanation.Builder + addBindingExplanationsBuilder() { + return getBindingExplanationsFieldBuilder() + .addBuilder(com.google.cloud.policysimulator.v1.BindingExplanation.getDefaultInstance()); + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public com.google.cloud.policysimulator.v1.BindingExplanation.Builder + addBindingExplanationsBuilder(int index) { + return getBindingExplanationsFieldBuilder() + .addBuilder( + index, com.google.cloud.policysimulator.v1.BindingExplanation.getDefaultInstance()); + } + /** + * + * + *
+     * Details about how each binding in the policy affects the principal's
+     * ability, or inability, to use the permission for the resource.
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + public java.util.List + getBindingExplanationsBuilderList() { + return getBindingExplanationsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.policysimulator.v1.BindingExplanation, + com.google.cloud.policysimulator.v1.BindingExplanation.Builder, + com.google.cloud.policysimulator.v1.BindingExplanationOrBuilder> + getBindingExplanationsFieldBuilder() { + if (bindingExplanationsBuilder_ == null) { + bindingExplanationsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.policysimulator.v1.BindingExplanation, + com.google.cloud.policysimulator.v1.BindingExplanation.Builder, + com.google.cloud.policysimulator.v1.BindingExplanationOrBuilder>( + bindingExplanations_, + ((bitField0_ & 0x00000008) != 0), + getParentForChildren(), + isClean()); + bindingExplanations_ = null; + } + return bindingExplanationsBuilder_; + } + + private int relevance_ = 0; + /** + * + * + *
+     * The relevance of this policy to the overall determination in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 5; + * + * @return The enum numeric value on the wire for relevance. + */ + @java.lang.Override + public int getRelevanceValue() { + return relevance_; + } + /** + * + * + *
+     * The relevance of this policy to the overall determination in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 5; + * + * @param value The enum numeric value on the wire for relevance to set. + * @return This builder for chaining. + */ + public Builder setRelevanceValue(int value) { + relevance_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * The relevance of this policy to the overall determination in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 5; + * + * @return The relevance. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.HeuristicRelevance getRelevance() { + com.google.cloud.policysimulator.v1.HeuristicRelevance result = + com.google.cloud.policysimulator.v1.HeuristicRelevance.forNumber(relevance_); + return result == null + ? com.google.cloud.policysimulator.v1.HeuristicRelevance.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The relevance of this policy to the overall determination in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 5; + * + * @param value The relevance to set. + * @return This builder for chaining. + */ + public Builder setRelevance(com.google.cloud.policysimulator.v1.HeuristicRelevance value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + relevance_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The relevance of this policy to the overall determination in the
+     * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+     *
+     * If the user who created the
+     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+     * access to the policy, this field is omitted.
+     * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 5; + * + * @return This builder for chaining. + */ + public Builder clearRelevance() { + bitField0_ = (bitField0_ & ~0x00000010); + relevance_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.policysimulator.v1.ExplainedPolicy) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.ExplainedPolicy) + private static final com.google.cloud.policysimulator.v1.ExplainedPolicy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.ExplainedPolicy(); + } + + public static com.google.cloud.policysimulator.v1.ExplainedPolicy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExplainedPolicy parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ExplainedPolicy getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedPolicyOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedPolicyOrBuilder.java new file mode 100644 index 000000000000..65ee1bd8cf9d --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplainedPolicyOrBuilder.java @@ -0,0 +1,271 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/explanations.proto + +package com.google.cloud.policysimulator.v1; + +public interface ExplainedPolicyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.ExplainedPolicy) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Indicates whether _this policy_ provides the specified permission to the
+   * specified principal for the specified resource.
+   *
+   * This field does _not_ indicate whether the principal actually has the
+   * permission for the resource. There might be another policy that overrides
+   * this policy. To determine whether the principal actually has the
+   * permission, use the `access` field in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessState access = 1; + * + * @return The enum numeric value on the wire for access. + */ + int getAccessValue(); + /** + * + * + *
+   * Indicates whether _this policy_ provides the specified permission to the
+   * specified principal for the specified resource.
+   *
+   * This field does _not_ indicate whether the principal actually has the
+   * permission for the resource. There might be another policy that overrides
+   * this policy. To determine whether the principal actually has the
+   * permission, use the `access` field in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessState access = 1; + * + * @return The access. + */ + com.google.cloud.policysimulator.v1.AccessState getAccess(); + + /** + * + * + *
+   * The full resource name that identifies the resource. For example,
+   * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   *
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   * 
+ * + * string full_resource_name = 2; + * + * @return The fullResourceName. + */ + java.lang.String getFullResourceName(); + /** + * + * + *
+   * The full resource name that identifies the resource. For example,
+   * `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   *
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   * 
+ * + * string full_resource_name = 2; + * + * @return The bytes for fullResourceName. + */ + com.google.protobuf.ByteString getFullResourceNameBytes(); + + /** + * + * + *
+   * The IAM policy attached to the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is empty.
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return Whether the policy field is set. + */ + boolean hasPolicy(); + /** + * + * + *
+   * The IAM policy attached to the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is empty.
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + * + * @return The policy. + */ + com.google.iam.v1.Policy getPolicy(); + /** + * + * + *
+   * The IAM policy attached to the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is empty.
+   * 
+ * + * .google.iam.v1.Policy policy = 3; + */ + com.google.iam.v1.PolicyOrBuilder getPolicyOrBuilder(); + + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + java.util.List + getBindingExplanationsList(); + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + com.google.cloud.policysimulator.v1.BindingExplanation getBindingExplanations(int index); + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + int getBindingExplanationsCount(); + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + java.util.List + getBindingExplanationsOrBuilderList(); + /** + * + * + *
+   * Details about how each binding in the policy affects the principal's
+   * ability, or inability, to use the permission for the resource.
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.BindingExplanation binding_explanations = 4; + * + */ + com.google.cloud.policysimulator.v1.BindingExplanationOrBuilder getBindingExplanationsOrBuilder( + int index); + + /** + * + * + *
+   * The relevance of this policy to the overall determination in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 5; + * + * @return The enum numeric value on the wire for relevance. + */ + int getRelevanceValue(); + /** + * + * + *
+   * The relevance of this policy to the overall determination in the
+   * [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
+   *
+   * If the user who created the
+   * [Replay][google.cloud.policysimulator.v1.Replay] does not have
+   * access to the policy, this field is omitted.
+   * 
+ * + * .google.cloud.policysimulator.v1.HeuristicRelevance relevance = 5; + * + * @return The relevance. + */ + com.google.cloud.policysimulator.v1.HeuristicRelevance getRelevance(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplanationsProto.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplanationsProto.java new file mode 100644 index 000000000000..22433587456e --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ExplanationsProto.java @@ -0,0 +1,181 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/explanations.proto + +package com.google.cloud.policysimulator.v1; + +public final class ExplanationsProto { + private ExplanationsProto() {} + + 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_policysimulator_v1_AccessTuple_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_AccessTuple_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_BindingExplanation_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_BindingExplanation_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_BindingExplanation_MembershipsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_BindingExplanation_MembershipsEntry_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n2google/cloud/policysimulator/v1/explan" + + "ations.proto\022\037google.cloud.policysimulat" + + "or.v1\032\037google/api/field_behavior.proto\032\032" + + "google/iam/v1/policy.proto\032\026google/type/" + + "expr.proto\"b\n\013AccessTuple\022\027\n\tprincipal\030\001" + + " \001(\tB\004\342A\001\002\022 \n\022full_resource_name\030\002 \001(\tB\004" + + "\342A\001\002\022\030\n\npermission\030\003 \001(\tB\004\342A\001\002\"\255\002\n\017Expla" + + "inedPolicy\022<\n\006access\030\001 \001(\0162,.google.clou" + + "d.policysimulator.v1.AccessState\022\032\n\022full" + + "_resource_name\030\002 \001(\t\022%\n\006policy\030\003 \001(\0132\025.g" + + "oogle.iam.v1.Policy\022Q\n\024binding_explanati" + + "ons\030\004 \003(\01323.google.cloud.policysimulator" + + ".v1.BindingExplanation\022F\n\trelevance\030\005 \001(" + + "\01623.google.cloud.policysimulator.v1.Heur" + + "isticRelevance\"\333\010\n\022BindingExplanation\022B\n" + + "\006access\030\001 \001(\0162,.google.cloud.policysimul" + + "ator.v1.AccessStateB\004\342A\001\002\022\014\n\004role\030\002 \001(\t\022" + + "[\n\017role_permission\030\003 \001(\0162B.google.cloud." + + "policysimulator.v1.BindingExplanation.Ro" + + "lePermission\022V\n\031role_permission_relevanc" + + "e\030\004 \001(\01623.google.cloud.policysimulator.v" + + "1.HeuristicRelevance\022Y\n\013memberships\030\005 \003(" + + "\0132D.google.cloud.policysimulator.v1.Bind" + + "ingExplanation.MembershipsEntry\022F\n\trelev" + + "ance\030\006 \001(\01623.google.cloud.policysimulato" + + "r.v1.HeuristicRelevance\022$\n\tcondition\030\007 \001" + + "(\0132\021.google.type.Expr\032\261\001\n\023AnnotatedMembe" + + "rship\022R\n\nmembership\030\001 \001(\0162>.google.cloud" + + ".policysimulator.v1.BindingExplanation.M" + + "embership\022F\n\trelevance\030\002 \001(\01623.google.cl" + + "oud.policysimulator.v1.HeuristicRelevanc" + + "e\032{\n\020MembershipsEntry\022\013\n\003key\030\001 \001(\t\022V\n\005va" + + "lue\030\002 \001(\0132G.google.cloud.policysimulator" + + ".v1.BindingExplanation.AnnotatedMembersh" + + "ip:\0028\001\"\232\001\n\016RolePermission\022\037\n\033ROLE_PERMIS" + + "SION_UNSPECIFIED\020\000\022\034\n\030ROLE_PERMISSION_IN" + + "CLUDED\020\001\022 \n\034ROLE_PERMISSION_NOT_INCLUDED" + + "\020\002\022\'\n#ROLE_PERMISSION_UNKNOWN_INFO_DENIE" + + "D\020\003\"\246\001\n\nMembership\022\032\n\026MEMBERSHIP_UNSPECI" + + "FIED\020\000\022\027\n\023MEMBERSHIP_INCLUDED\020\001\022\033\n\027MEMBE" + + "RSHIP_NOT_INCLUDED\020\002\022\"\n\036MEMBERSHIP_UNKNO" + + "WN_INFO_DENIED\020\003\022\"\n\036MEMBERSHIP_UNKNOWN_U" + + "NSUPPORTED\020\004*{\n\013AccessState\022\034\n\030ACCESS_ST" + + "ATE_UNSPECIFIED\020\000\022\013\n\007GRANTED\020\001\022\017\n\013NOT_GR" + + "ANTED\020\002\022\027\n\023UNKNOWN_CONDITIONAL\020\003\022\027\n\023UNKN" + + "OWN_INFO_DENIED\020\004*O\n\022HeuristicRelevance\022" + + "#\n\037HEURISTIC_RELEVANCE_UNSPECIFIED\020\000\022\n\n\006" + + "NORMAL\020\001\022\010\n\004HIGH\020\002B\214\001\n#com.google.cloud." + + "policysimulator.v1B\021ExplanationsProtoP\001Z" + + "Mcloud.google.com/go/policysimulator/api" + + "v1/policysimulatorpb;policysimulatorpb\370\001" + + "\001b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.iam.v1.PolicyProto.getDescriptor(), + com.google.type.ExprProto.getDescriptor(), + }); + internal_static_google_cloud_policysimulator_v1_AccessTuple_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_policysimulator_v1_AccessTuple_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_AccessTuple_descriptor, + new java.lang.String[] { + "Principal", "FullResourceName", "Permission", + }); + internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_ExplainedPolicy_descriptor, + new java.lang.String[] { + "Access", "FullResourceName", "Policy", "BindingExplanations", "Relevance", + }); + internal_static_google_cloud_policysimulator_v1_BindingExplanation_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_policysimulator_v1_BindingExplanation_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_BindingExplanation_descriptor, + new java.lang.String[] { + "Access", + "Role", + "RolePermission", + "RolePermissionRelevance", + "Memberships", + "Relevance", + "Condition", + }); + internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_descriptor = + internal_static_google_cloud_policysimulator_v1_BindingExplanation_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_BindingExplanation_AnnotatedMembership_descriptor, + new java.lang.String[] { + "Membership", "Relevance", + }); + internal_static_google_cloud_policysimulator_v1_BindingExplanation_MembershipsEntry_descriptor = + internal_static_google_cloud_policysimulator_v1_BindingExplanation_descriptor + .getNestedTypes() + .get(1); + internal_static_google_cloud_policysimulator_v1_BindingExplanation_MembershipsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_BindingExplanation_MembershipsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.iam.v1.PolicyProto.getDescriptor(); + com.google.type.ExprProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/GetReplayRequest.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/GetReplayRequest.java new file mode 100644 index 000000000000..9fa736dc0523 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/GetReplayRequest.java @@ -0,0 +1,696 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Request message for
+ * [Simulator.GetReplay][google.cloud.policysimulator.v1.Simulator.GetReplay].
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.GetReplayRequest} + */ +public final class GetReplayRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.GetReplayRequest) + GetReplayRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetReplayRequest.newBuilder() to construct. + private GetReplayRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetReplayRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetReplayRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_GetReplayRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_GetReplayRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.GetReplayRequest.class, + com.google.cloud.policysimulator.v1.GetReplayRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay]
+   * to retrieve, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the `Replay`.
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay]
+   * to retrieve, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the `Replay`.
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.GetReplayRequest)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.GetReplayRequest other = + (com.google.cloud.policysimulator.v1.GetReplayRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.GetReplayRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.GetReplayRequest 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.policysimulator.v1.GetReplayRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.GetReplayRequest 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.policysimulator.v1.GetReplayRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.GetReplayRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.GetReplayRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.GetReplayRequest 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.policysimulator.v1.GetReplayRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.GetReplayRequest 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.policysimulator.v1.GetReplayRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.GetReplayRequest 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.policysimulator.v1.GetReplayRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [Simulator.GetReplay][google.cloud.policysimulator.v1.Simulator.GetReplay].
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.GetReplayRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.GetReplayRequest) + com.google.cloud.policysimulator.v1.GetReplayRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_GetReplayRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_GetReplayRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.GetReplayRequest.class, + com.google.cloud.policysimulator.v1.GetReplayRequest.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.GetReplayRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_GetReplayRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.GetReplayRequest getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.GetReplayRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.GetReplayRequest build() { + com.google.cloud.policysimulator.v1.GetReplayRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.GetReplayRequest buildPartial() { + com.google.cloud.policysimulator.v1.GetReplayRequest result = + new com.google.cloud.policysimulator.v1.GetReplayRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.GetReplayRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @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.policysimulator.v1.GetReplayRequest) { + return mergeFrom((com.google.cloud.policysimulator.v1.GetReplayRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.GetReplayRequest other) { + if (other == com.google.cloud.policysimulator.v1.GetReplayRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay]
+     * to retrieve, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the `Replay`.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay]
+     * to retrieve, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the `Replay`.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay]
+     * to retrieve, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the `Replay`.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay]
+     * to retrieve, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the `Replay`.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay]
+     * to retrieve, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the `Replay`.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + 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.policysimulator.v1.GetReplayRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.GetReplayRequest) + private static final com.google.cloud.policysimulator.v1.GetReplayRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.GetReplayRequest(); + } + + public static com.google.cloud.policysimulator.v1.GetReplayRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetReplayRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.GetReplayRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/GetReplayRequestOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/GetReplayRequestOrBuilder.java new file mode 100644 index 000000000000..65bee285a696 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/GetReplayRequestOrBuilder.java @@ -0,0 +1,70 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface GetReplayRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.GetReplayRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay]
+   * to retrieve, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the `Replay`.
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay]
+   * to retrieve, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the `Replay`.
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/HeuristicRelevance.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/HeuristicRelevance.java new file mode 100644 index 000000000000..844d0776af5d --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/HeuristicRelevance.java @@ -0,0 +1,186 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/explanations.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * The extent to which a single data point, such as the existence of a binding
+ * or whether a binding includes a specific principal, contributes to an overall
+ * determination.
+ * 
+ * + * Protobuf enum {@code google.cloud.policysimulator.v1.HeuristicRelevance} + */ +public enum HeuristicRelevance implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Default value. This value is unused.
+   * 
+ * + * HEURISTIC_RELEVANCE_UNSPECIFIED = 0; + */ + HEURISTIC_RELEVANCE_UNSPECIFIED(0), + /** + * + * + *
+   * The data point has a limited effect on the result. Changing the data point
+   * is unlikely to affect the overall determination.
+   * 
+ * + * NORMAL = 1; + */ + NORMAL(1), + /** + * + * + *
+   * The data point has a strong effect on the result. Changing the data point
+   * is likely to affect the overall determination.
+   * 
+ * + * HIGH = 2; + */ + HIGH(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Default value. This value is unused.
+   * 
+ * + * HEURISTIC_RELEVANCE_UNSPECIFIED = 0; + */ + public static final int HEURISTIC_RELEVANCE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * The data point has a limited effect on the result. Changing the data point
+   * is unlikely to affect the overall determination.
+   * 
+ * + * NORMAL = 1; + */ + public static final int NORMAL_VALUE = 1; + /** + * + * + *
+   * The data point has a strong effect on the result. Changing the data point
+   * is likely to affect the overall determination.
+   * 
+ * + * HIGH = 2; + */ + public static final int HIGH_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 HeuristicRelevance 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 HeuristicRelevance forNumber(int value) { + switch (value) { + case 0: + return HEURISTIC_RELEVANCE_UNSPECIFIED; + case 1: + return NORMAL; + case 2: + return HIGH; + 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 HeuristicRelevance findValueByNumber(int number) { + return HeuristicRelevance.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ExplanationsProto.getDescriptor() + .getEnumTypes() + .get(1); + } + + private static final HeuristicRelevance[] VALUES = values(); + + public static HeuristicRelevance 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 HeuristicRelevance(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.policysimulator.v1.HeuristicRelevance) +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsRequest.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsRequest.java new file mode 100644 index 000000000000..76cca7dcd27d --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsRequest.java @@ -0,0 +1,1020 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Request message for
+ * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults].
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ListReplayResultsRequest} + */ +public final class ListReplayResultsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.ListReplayResultsRequest) + ListReplayResultsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListReplayResultsRequest.newBuilder() to construct. + private ListReplayResultsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListReplayResultsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListReplayResultsRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ListReplayResultsRequest.class, + com.google.cloud.policysimulator.v1.ListReplayResultsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose
+   * results are listed, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`
+   *
+   * Example:
+   * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose
+   * results are listed, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`
+   *
+   * Example:
+   * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_ = 0; + /** + * + * + *
+   * The maximum number of
+   * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects to
+   * return. Defaults to 5000.
+   *
+   * The maximum value is 5000; values above 5000 are rounded down to 5000.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** + * + * + *
+   * A page token, received from a previous
+   * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]
+   * call. Provide this token to retrieve the next page of results.
+   *
+   * When paginating, all other parameters provided to
+   * [Simulator.ListReplayResults[] must match the call that provided the page
+   * token.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A page token, received from a previous
+   * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]
+   * call. Provide this token to retrieve the next page of results.
+   *
+   * When paginating, all other parameters provided to
+   * [Simulator.ListReplayResults[] must match the call that provided the page
+   * token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.ListReplayResultsRequest)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.ListReplayResultsRequest other = + (com.google.cloud.policysimulator.v1.ListReplayResultsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsRequest 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.policysimulator.v1.ListReplayResultsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsRequest 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.policysimulator.v1.ListReplayResultsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsRequest 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.policysimulator.v1.ListReplayResultsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsRequest 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.policysimulator.v1.ListReplayResultsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsRequest 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.policysimulator.v1.ListReplayResultsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults].
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ListReplayResultsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.ListReplayResultsRequest) + com.google.cloud.policysimulator.v1.ListReplayResultsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ListReplayResultsRequest.class, + com.google.cloud.policysimulator.v1.ListReplayResultsRequest.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.ListReplayResultsRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + pageSize_ = 0; + pageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ListReplayResultsRequest + getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.ListReplayResultsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ListReplayResultsRequest build() { + com.google.cloud.policysimulator.v1.ListReplayResultsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ListReplayResultsRequest buildPartial() { + com.google.cloud.policysimulator.v1.ListReplayResultsRequest result = + new com.google.cloud.policysimulator.v1.ListReplayResultsRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.policysimulator.v1.ListReplayResultsRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } + } + + @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.policysimulator.v1.ListReplayResultsRequest) { + return mergeFrom((com.google.cloud.policysimulator.v1.ListReplayResultsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.ListReplayResultsRequest other) { + if (other + == com.google.cloud.policysimulator.v1.ListReplayResultsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose
+     * results are listed, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`
+     *
+     * Example:
+     * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose
+     * results are listed, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`
+     *
+     * Example:
+     * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose
+     * results are listed, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`
+     *
+     * Example:
+     * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose
+     * results are listed, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`
+     *
+     * Example:
+     * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose
+     * results are listed, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`
+     *
+     * Example:
+     * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * The maximum number of
+     * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects to
+     * return. Defaults to 5000.
+     *
+     * The maximum value is 5000; values above 5000 are rounded down to 5000.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * The maximum number of
+     * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects to
+     * return. Defaults to 5000.
+     *
+     * The maximum value is 5000; values above 5000 are rounded down to 5000.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The maximum number of
+     * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects to
+     * return. Defaults to 5000.
+     *
+     * The maximum value is 5000; values above 5000 are rounded down to 5000.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + bitField0_ = (bitField0_ & ~0x00000002); + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A page token, received from a previous
+     * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]
+     * call. Provide this token to retrieve the next page of results.
+     *
+     * When paginating, all other parameters provided to
+     * [Simulator.ListReplayResults[] must match the call that provided the page
+     * token.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A page token, received from a previous
+     * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]
+     * call. Provide this token to retrieve the next page of results.
+     *
+     * When paginating, all other parameters provided to
+     * [Simulator.ListReplayResults[] must match the call that provided the page
+     * token.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A page token, received from a previous
+     * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]
+     * call. Provide this token to retrieve the next page of results.
+     *
+     * When paginating, all other parameters provided to
+     * [Simulator.ListReplayResults[] must match the call that provided the page
+     * token.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + pageToken_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * A page token, received from a previous
+     * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]
+     * call. Provide this token to retrieve the next page of results.
+     *
+     * When paginating, all other parameters provided to
+     * [Simulator.ListReplayResults[] must match the call that provided the page
+     * token.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token, received from a previous
+     * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]
+     * call. Provide this token to retrieve the next page of results.
+     *
+     * When paginating, all other parameters provided to
+     * [Simulator.ListReplayResults[] must match the call that provided the page
+     * token.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + pageToken_ = value; + bitField0_ |= 0x00000004; + 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.policysimulator.v1.ListReplayResultsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.ListReplayResultsRequest) + private static final com.google.cloud.policysimulator.v1.ListReplayResultsRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.ListReplayResultsRequest(); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListReplayResultsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ListReplayResultsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsRequestOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsRequestOrBuilder.java new file mode 100644 index 000000000000..f111755921e8 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsRequestOrBuilder.java @@ -0,0 +1,120 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface ListReplayResultsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.ListReplayResultsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose
+   * results are listed, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`
+   *
+   * Example:
+   * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose
+   * results are listed, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`
+   *
+   * Example:
+   * `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The maximum number of
+   * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects to
+   * return. Defaults to 5000.
+   *
+   * The maximum value is 5000; values above 5000 are rounded down to 5000.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A page token, received from a previous
+   * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]
+   * call. Provide this token to retrieve the next page of results.
+   *
+   * When paginating, all other parameters provided to
+   * [Simulator.ListReplayResults[] must match the call that provided the page
+   * token.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A page token, received from a previous
+   * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]
+   * call. Provide this token to retrieve the next page of results.
+   *
+   * When paginating, all other parameters provided to
+   * [Simulator.ListReplayResults[] must match the call that provided the page
+   * token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsResponse.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsResponse.java new file mode 100644 index 000000000000..7b1efcb8e3c5 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsResponse.java @@ -0,0 +1,1151 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Response message for
+ * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults].
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ListReplayResultsResponse} + */ +public final class ListReplayResultsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.ListReplayResultsResponse) + ListReplayResultsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListReplayResultsResponse.newBuilder() to construct. + private ListReplayResultsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListReplayResultsResponse() { + replayResults_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListReplayResultsResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ListReplayResultsResponse.class, + com.google.cloud.policysimulator.v1.ListReplayResultsResponse.Builder.class); + } + + public static final int REPLAY_RESULTS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List replayResults_; + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + @java.lang.Override + public java.util.List getReplayResultsList() { + return replayResults_; + } + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + @java.lang.Override + public java.util.List + getReplayResultsOrBuilderList() { + return replayResults_; + } + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + @java.lang.Override + public int getReplayResultsCount() { + return replayResults_.size(); + } + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayResult getReplayResults(int index) { + return replayResults_.get(index); + } + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayResultOrBuilder getReplayResultsOrBuilder( + int index) { + return replayResults_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+   * A token that you can use to retrieve the next page of
+   * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If
+   * this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token that you can use to retrieve the next page of
+   * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If
+   * this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < replayResults_.size(); i++) { + output.writeMessage(1, replayResults_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < replayResults_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, replayResults_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.ListReplayResultsResponse)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.ListReplayResultsResponse other = + (com.google.cloud.policysimulator.v1.ListReplayResultsResponse) obj; + + if (!getReplayResultsList().equals(other.getReplayResultsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getReplayResultsCount() > 0) { + hash = (37 * hash) + REPLAY_RESULTS_FIELD_NUMBER; + hash = (53 * hash) + getReplayResultsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsResponse 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.policysimulator.v1.ListReplayResultsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsResponse 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.policysimulator.v1.ListReplayResultsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsResponse 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.policysimulator.v1.ListReplayResultsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsResponse 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.policysimulator.v1.ListReplayResultsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsResponse 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.policysimulator.v1.ListReplayResultsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for
+   * [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults].
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ListReplayResultsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.ListReplayResultsResponse) + com.google.cloud.policysimulator.v1.ListReplayResultsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ListReplayResultsResponse.class, + com.google.cloud.policysimulator.v1.ListReplayResultsResponse.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.ListReplayResultsResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (replayResultsBuilder_ == null) { + replayResults_ = java.util.Collections.emptyList(); + } else { + replayResults_ = null; + replayResultsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ListReplayResultsResponse + getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.ListReplayResultsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ListReplayResultsResponse build() { + com.google.cloud.policysimulator.v1.ListReplayResultsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ListReplayResultsResponse buildPartial() { + com.google.cloud.policysimulator.v1.ListReplayResultsResponse result = + new com.google.cloud.policysimulator.v1.ListReplayResultsResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.policysimulator.v1.ListReplayResultsResponse result) { + if (replayResultsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + replayResults_ = java.util.Collections.unmodifiableList(replayResults_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.replayResults_ = replayResults_; + } else { + result.replayResults_ = replayResultsBuilder_.build(); + } + } + + private void buildPartial0( + com.google.cloud.policysimulator.v1.ListReplayResultsResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } + } + + @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.policysimulator.v1.ListReplayResultsResponse) { + return mergeFrom((com.google.cloud.policysimulator.v1.ListReplayResultsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.ListReplayResultsResponse other) { + if (other + == com.google.cloud.policysimulator.v1.ListReplayResultsResponse.getDefaultInstance()) + return this; + if (replayResultsBuilder_ == null) { + if (!other.replayResults_.isEmpty()) { + if (replayResults_.isEmpty()) { + replayResults_ = other.replayResults_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureReplayResultsIsMutable(); + replayResults_.addAll(other.replayResults_); + } + onChanged(); + } + } else { + if (!other.replayResults_.isEmpty()) { + if (replayResultsBuilder_.isEmpty()) { + replayResultsBuilder_.dispose(); + replayResultsBuilder_ = null; + replayResults_ = other.replayResults_; + bitField0_ = (bitField0_ & ~0x00000001); + replayResultsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getReplayResultsFieldBuilder() + : null; + } else { + replayResultsBuilder_.addAllMessages(other.replayResults_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.policysimulator.v1.ReplayResult m = + input.readMessage( + com.google.cloud.policysimulator.v1.ReplayResult.parser(), + extensionRegistry); + if (replayResultsBuilder_ == null) { + ensureReplayResultsIsMutable(); + replayResults_.add(m); + } else { + replayResultsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List replayResults_ = + java.util.Collections.emptyList(); + + private void ensureReplayResultsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + replayResults_ = + new java.util.ArrayList( + replayResults_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.policysimulator.v1.ReplayResult, + com.google.cloud.policysimulator.v1.ReplayResult.Builder, + com.google.cloud.policysimulator.v1.ReplayResultOrBuilder> + replayResultsBuilder_; + + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public java.util.List getReplayResultsList() { + if (replayResultsBuilder_ == null) { + return java.util.Collections.unmodifiableList(replayResults_); + } else { + return replayResultsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public int getReplayResultsCount() { + if (replayResultsBuilder_ == null) { + return replayResults_.size(); + } else { + return replayResultsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public com.google.cloud.policysimulator.v1.ReplayResult getReplayResults(int index) { + if (replayResultsBuilder_ == null) { + return replayResults_.get(index); + } else { + return replayResultsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public Builder setReplayResults( + int index, com.google.cloud.policysimulator.v1.ReplayResult value) { + if (replayResultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureReplayResultsIsMutable(); + replayResults_.set(index, value); + onChanged(); + } else { + replayResultsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public Builder setReplayResults( + int index, com.google.cloud.policysimulator.v1.ReplayResult.Builder builderForValue) { + if (replayResultsBuilder_ == null) { + ensureReplayResultsIsMutable(); + replayResults_.set(index, builderForValue.build()); + onChanged(); + } else { + replayResultsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public Builder addReplayResults(com.google.cloud.policysimulator.v1.ReplayResult value) { + if (replayResultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureReplayResultsIsMutable(); + replayResults_.add(value); + onChanged(); + } else { + replayResultsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public Builder addReplayResults( + int index, com.google.cloud.policysimulator.v1.ReplayResult value) { + if (replayResultsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureReplayResultsIsMutable(); + replayResults_.add(index, value); + onChanged(); + } else { + replayResultsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public Builder addReplayResults( + com.google.cloud.policysimulator.v1.ReplayResult.Builder builderForValue) { + if (replayResultsBuilder_ == null) { + ensureReplayResultsIsMutable(); + replayResults_.add(builderForValue.build()); + onChanged(); + } else { + replayResultsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public Builder addReplayResults( + int index, com.google.cloud.policysimulator.v1.ReplayResult.Builder builderForValue) { + if (replayResultsBuilder_ == null) { + ensureReplayResultsIsMutable(); + replayResults_.add(index, builderForValue.build()); + onChanged(); + } else { + replayResultsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public Builder addAllReplayResults( + java.lang.Iterable values) { + if (replayResultsBuilder_ == null) { + ensureReplayResultsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, replayResults_); + onChanged(); + } else { + replayResultsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public Builder clearReplayResults() { + if (replayResultsBuilder_ == null) { + replayResults_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + replayResultsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public Builder removeReplayResults(int index) { + if (replayResultsBuilder_ == null) { + ensureReplayResultsIsMutable(); + replayResults_.remove(index); + onChanged(); + } else { + replayResultsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public com.google.cloud.policysimulator.v1.ReplayResult.Builder getReplayResultsBuilder( + int index) { + return getReplayResultsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public com.google.cloud.policysimulator.v1.ReplayResultOrBuilder getReplayResultsOrBuilder( + int index) { + if (replayResultsBuilder_ == null) { + return replayResults_.get(index); + } else { + return replayResultsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public java.util.List + getReplayResultsOrBuilderList() { + if (replayResultsBuilder_ != null) { + return replayResultsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(replayResults_); + } + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public com.google.cloud.policysimulator.v1.ReplayResult.Builder addReplayResultsBuilder() { + return getReplayResultsFieldBuilder() + .addBuilder(com.google.cloud.policysimulator.v1.ReplayResult.getDefaultInstance()); + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public com.google.cloud.policysimulator.v1.ReplayResult.Builder addReplayResultsBuilder( + int index) { + return getReplayResultsFieldBuilder() + .addBuilder(index, com.google.cloud.policysimulator.v1.ReplayResult.getDefaultInstance()); + } + /** + * + * + *
+     * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + public java.util.List + getReplayResultsBuilderList() { + return getReplayResultsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.policysimulator.v1.ReplayResult, + com.google.cloud.policysimulator.v1.ReplayResult.Builder, + com.google.cloud.policysimulator.v1.ReplayResultOrBuilder> + getReplayResultsFieldBuilder() { + if (replayResultsBuilder_ == null) { + replayResultsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.policysimulator.v1.ReplayResult, + com.google.cloud.policysimulator.v1.ReplayResult.Builder, + com.google.cloud.policysimulator.v1.ReplayResultOrBuilder>( + replayResults_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + replayResults_ = null; + } + return replayResultsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token that you can use to retrieve the next page of
+     * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If
+     * this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token that you can use to retrieve the next page of
+     * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If
+     * this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token that you can use to retrieve the next page of
+     * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If
+     * this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * A token that you can use to retrieve the next page of
+     * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If
+     * this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * A token that you can use to retrieve the next page of
+     * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If
+     * this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + nextPageToken_ = value; + bitField0_ |= 0x00000002; + 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.policysimulator.v1.ListReplayResultsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.ListReplayResultsResponse) + private static final com.google.cloud.policysimulator.v1.ListReplayResultsResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.ListReplayResultsResponse(); + } + + public static com.google.cloud.policysimulator.v1.ListReplayResultsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListReplayResultsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ListReplayResultsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsResponseOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsResponseOrBuilder.java new file mode 100644 index 000000000000..b1f78feaa2f7 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ListReplayResultsResponseOrBuilder.java @@ -0,0 +1,106 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface ListReplayResultsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.ListReplayResultsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + java.util.List getReplayResultsList(); + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + com.google.cloud.policysimulator.v1.ReplayResult getReplayResults(int index); + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + int getReplayResultsCount(); + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + java.util.List + getReplayResultsOrBuilderList(); + /** + * + * + *
+   * The results of running a [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * repeated .google.cloud.policysimulator.v1.ReplayResult replay_results = 1; + */ + com.google.cloud.policysimulator.v1.ReplayResultOrBuilder getReplayResultsOrBuilder(int index); + + /** + * + * + *
+   * A token that you can use to retrieve the next page of
+   * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If
+   * this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token that you can use to retrieve the next page of
+   * [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If
+   * this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/Replay.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/Replay.java new file mode 100644 index 000000000000..be3baa75d997 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/Replay.java @@ -0,0 +1,3073 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * A resource describing a `Replay`, or simulation.
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.Replay} + */ +public final class Replay extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.Replay) + ReplayOrBuilder { + private static final long serialVersionUID = 0L; + // Use Replay.newBuilder() to construct. + private Replay(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Replay() { + name_ = ""; + state_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Replay(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.Replay.class, + com.google.cloud.policysimulator.v1.Replay.Builder.class); + } + + /** + * + * + *
+   * The current state of the [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * Protobuf enum {@code google.cloud.policysimulator.v1.Replay.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * The `Replay` has not started yet.
+     * 
+ * + * PENDING = 1; + */ + PENDING(1), + /** + * + * + *
+     * The `Replay` is currently running.
+     * 
+ * + * RUNNING = 2; + */ + RUNNING(2), + /** + * + * + *
+     * The `Replay` has successfully completed.
+     * 
+ * + * SUCCEEDED = 3; + */ + SUCCEEDED(3), + /** + * + * + *
+     * The `Replay` has finished with an error.
+     * 
+ * + * FAILED = 4; + */ + FAILED(4), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Default value. This value is unused.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * The `Replay` has not started yet.
+     * 
+ * + * PENDING = 1; + */ + public static final int PENDING_VALUE = 1; + /** + * + * + *
+     * The `Replay` is currently running.
+     * 
+ * + * RUNNING = 2; + */ + public static final int RUNNING_VALUE = 2; + /** + * + * + *
+     * The `Replay` has successfully completed.
+     * 
+ * + * SUCCEEDED = 3; + */ + public static final int SUCCEEDED_VALUE = 3; + /** + * + * + *
+     * The `Replay` has finished with an error.
+     * 
+ * + * FAILED = 4; + */ + public static final int FAILED_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State 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 State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return PENDING; + case 2: + return RUNNING; + case 3: + return SUCCEEDED; + case 4: + return FAILED; + 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 State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.Replay.getDescriptor().getEnumTypes().get(0); + } + + private static final State[] VALUES = values(); + + public static State 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 State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.policysimulator.v1.Replay.State) + } + + public interface ResultsSummaryOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.Replay.ResultsSummary) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The total number of log entries replayed.
+     * 
+ * + * int32 log_count = 1; + * + * @return The logCount. + */ + int getLogCount(); + + /** + * + * + *
+     * The number of replayed log entries with no difference between
+     * baseline and simulated policies.
+     * 
+ * + * int32 unchanged_count = 2; + * + * @return The unchangedCount. + */ + int getUnchangedCount(); + + /** + * + * + *
+     * The number of replayed log entries with a difference between baseline and
+     * simulated policies.
+     * 
+ * + * int32 difference_count = 3; + * + * @return The differenceCount. + */ + int getDifferenceCount(); + + /** + * + * + *
+     * The number of log entries that could not be replayed.
+     * 
+ * + * int32 error_count = 4; + * + * @return The errorCount. + */ + int getErrorCount(); + + /** + * + * + *
+     * The date of the oldest log entry replayed.
+     * 
+ * + * .google.type.Date oldest_date = 5; + * + * @return Whether the oldestDate field is set. + */ + boolean hasOldestDate(); + /** + * + * + *
+     * The date of the oldest log entry replayed.
+     * 
+ * + * .google.type.Date oldest_date = 5; + * + * @return The oldestDate. + */ + com.google.type.Date getOldestDate(); + /** + * + * + *
+     * The date of the oldest log entry replayed.
+     * 
+ * + * .google.type.Date oldest_date = 5; + */ + com.google.type.DateOrBuilder getOldestDateOrBuilder(); + + /** + * + * + *
+     * The date of the newest log entry replayed.
+     * 
+ * + * .google.type.Date newest_date = 6; + * + * @return Whether the newestDate field is set. + */ + boolean hasNewestDate(); + /** + * + * + *
+     * The date of the newest log entry replayed.
+     * 
+ * + * .google.type.Date newest_date = 6; + * + * @return The newestDate. + */ + com.google.type.Date getNewestDate(); + /** + * + * + *
+     * The date of the newest log entry replayed.
+     * 
+ * + * .google.type.Date newest_date = 6; + */ + com.google.type.DateOrBuilder getNewestDateOrBuilder(); + } + /** + * + * + *
+   * Summary statistics about the replayed log entries.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.Replay.ResultsSummary} + */ + public static final class ResultsSummary extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.Replay.ResultsSummary) + ResultsSummaryOrBuilder { + private static final long serialVersionUID = 0L; + // Use ResultsSummary.newBuilder() to construct. + private ResultsSummary(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ResultsSummary() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ResultsSummary(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.Replay.ResultsSummary.class, + com.google.cloud.policysimulator.v1.Replay.ResultsSummary.Builder.class); + } + + public static final int LOG_COUNT_FIELD_NUMBER = 1; + private int logCount_ = 0; + /** + * + * + *
+     * The total number of log entries replayed.
+     * 
+ * + * int32 log_count = 1; + * + * @return The logCount. + */ + @java.lang.Override + public int getLogCount() { + return logCount_; + } + + public static final int UNCHANGED_COUNT_FIELD_NUMBER = 2; + private int unchangedCount_ = 0; + /** + * + * + *
+     * The number of replayed log entries with no difference between
+     * baseline and simulated policies.
+     * 
+ * + * int32 unchanged_count = 2; + * + * @return The unchangedCount. + */ + @java.lang.Override + public int getUnchangedCount() { + return unchangedCount_; + } + + public static final int DIFFERENCE_COUNT_FIELD_NUMBER = 3; + private int differenceCount_ = 0; + /** + * + * + *
+     * The number of replayed log entries with a difference between baseline and
+     * simulated policies.
+     * 
+ * + * int32 difference_count = 3; + * + * @return The differenceCount. + */ + @java.lang.Override + public int getDifferenceCount() { + return differenceCount_; + } + + public static final int ERROR_COUNT_FIELD_NUMBER = 4; + private int errorCount_ = 0; + /** + * + * + *
+     * The number of log entries that could not be replayed.
+     * 
+ * + * int32 error_count = 4; + * + * @return The errorCount. + */ + @java.lang.Override + public int getErrorCount() { + return errorCount_; + } + + public static final int OLDEST_DATE_FIELD_NUMBER = 5; + private com.google.type.Date oldestDate_; + /** + * + * + *
+     * The date of the oldest log entry replayed.
+     * 
+ * + * .google.type.Date oldest_date = 5; + * + * @return Whether the oldestDate field is set. + */ + @java.lang.Override + public boolean hasOldestDate() { + return oldestDate_ != null; + } + /** + * + * + *
+     * The date of the oldest log entry replayed.
+     * 
+ * + * .google.type.Date oldest_date = 5; + * + * @return The oldestDate. + */ + @java.lang.Override + public com.google.type.Date getOldestDate() { + return oldestDate_ == null ? com.google.type.Date.getDefaultInstance() : oldestDate_; + } + /** + * + * + *
+     * The date of the oldest log entry replayed.
+     * 
+ * + * .google.type.Date oldest_date = 5; + */ + @java.lang.Override + public com.google.type.DateOrBuilder getOldestDateOrBuilder() { + return oldestDate_ == null ? com.google.type.Date.getDefaultInstance() : oldestDate_; + } + + public static final int NEWEST_DATE_FIELD_NUMBER = 6; + private com.google.type.Date newestDate_; + /** + * + * + *
+     * The date of the newest log entry replayed.
+     * 
+ * + * .google.type.Date newest_date = 6; + * + * @return Whether the newestDate field is set. + */ + @java.lang.Override + public boolean hasNewestDate() { + return newestDate_ != null; + } + /** + * + * + *
+     * The date of the newest log entry replayed.
+     * 
+ * + * .google.type.Date newest_date = 6; + * + * @return The newestDate. + */ + @java.lang.Override + public com.google.type.Date getNewestDate() { + return newestDate_ == null ? com.google.type.Date.getDefaultInstance() : newestDate_; + } + /** + * + * + *
+     * The date of the newest log entry replayed.
+     * 
+ * + * .google.type.Date newest_date = 6; + */ + @java.lang.Override + public com.google.type.DateOrBuilder getNewestDateOrBuilder() { + return newestDate_ == null ? com.google.type.Date.getDefaultInstance() : newestDate_; + } + + 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 (logCount_ != 0) { + output.writeInt32(1, logCount_); + } + if (unchangedCount_ != 0) { + output.writeInt32(2, unchangedCount_); + } + if (differenceCount_ != 0) { + output.writeInt32(3, differenceCount_); + } + if (errorCount_ != 0) { + output.writeInt32(4, errorCount_); + } + if (oldestDate_ != null) { + output.writeMessage(5, getOldestDate()); + } + if (newestDate_ != null) { + output.writeMessage(6, getNewestDate()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (logCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, logCount_); + } + if (unchangedCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, unchangedCount_); + } + if (differenceCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, differenceCount_); + } + if (errorCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, errorCount_); + } + if (oldestDate_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getOldestDate()); + } + if (newestDate_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getNewestDate()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.Replay.ResultsSummary)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.Replay.ResultsSummary other = + (com.google.cloud.policysimulator.v1.Replay.ResultsSummary) obj; + + if (getLogCount() != other.getLogCount()) return false; + if (getUnchangedCount() != other.getUnchangedCount()) return false; + if (getDifferenceCount() != other.getDifferenceCount()) return false; + if (getErrorCount() != other.getErrorCount()) return false; + if (hasOldestDate() != other.hasOldestDate()) return false; + if (hasOldestDate()) { + if (!getOldestDate().equals(other.getOldestDate())) return false; + } + if (hasNewestDate() != other.hasNewestDate()) return false; + if (hasNewestDate()) { + if (!getNewestDate().equals(other.getNewestDate())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LOG_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getLogCount(); + hash = (37 * hash) + UNCHANGED_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getUnchangedCount(); + hash = (37 * hash) + DIFFERENCE_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getDifferenceCount(); + hash = (37 * hash) + ERROR_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getErrorCount(); + if (hasOldestDate()) { + hash = (37 * hash) + OLDEST_DATE_FIELD_NUMBER; + hash = (53 * hash) + getOldestDate().hashCode(); + } + if (hasNewestDate()) { + hash = (37 * hash) + NEWEST_DATE_FIELD_NUMBER; + hash = (53 * hash) + getNewestDate().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.Replay.ResultsSummary parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.Replay.ResultsSummary 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.policysimulator.v1.Replay.ResultsSummary parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.Replay.ResultsSummary 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.policysimulator.v1.Replay.ResultsSummary parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.Replay.ResultsSummary parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.Replay.ResultsSummary parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.Replay.ResultsSummary 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.policysimulator.v1.Replay.ResultsSummary parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.Replay.ResultsSummary 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.policysimulator.v1.Replay.ResultsSummary parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.Replay.ResultsSummary 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.policysimulator.v1.Replay.ResultsSummary 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; + } + /** + * + * + *
+     * Summary statistics about the replayed log entries.
+     * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.Replay.ResultsSummary} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.Replay.ResultsSummary) + com.google.cloud.policysimulator.v1.Replay.ResultsSummaryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.Replay.ResultsSummary.class, + com.google.cloud.policysimulator.v1.Replay.ResultsSummary.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.Replay.ResultsSummary.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + logCount_ = 0; + unchangedCount_ = 0; + differenceCount_ = 0; + errorCount_ = 0; + oldestDate_ = null; + if (oldestDateBuilder_ != null) { + oldestDateBuilder_.dispose(); + oldestDateBuilder_ = null; + } + newestDate_ = null; + if (newestDateBuilder_ != null) { + newestDateBuilder_.dispose(); + newestDateBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay.ResultsSummary getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.Replay.ResultsSummary.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay.ResultsSummary build() { + com.google.cloud.policysimulator.v1.Replay.ResultsSummary result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay.ResultsSummary buildPartial() { + com.google.cloud.policysimulator.v1.Replay.ResultsSummary result = + new com.google.cloud.policysimulator.v1.Replay.ResultsSummary(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.Replay.ResultsSummary result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.logCount_ = logCount_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.unchangedCount_ = unchangedCount_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.differenceCount_ = differenceCount_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.errorCount_ = errorCount_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.oldestDate_ = + oldestDateBuilder_ == null ? oldestDate_ : oldestDateBuilder_.build(); + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.newestDate_ = + newestDateBuilder_ == null ? newestDate_ : newestDateBuilder_.build(); + } + } + + @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.policysimulator.v1.Replay.ResultsSummary) { + return mergeFrom((com.google.cloud.policysimulator.v1.Replay.ResultsSummary) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.Replay.ResultsSummary other) { + if (other == com.google.cloud.policysimulator.v1.Replay.ResultsSummary.getDefaultInstance()) + return this; + if (other.getLogCount() != 0) { + setLogCount(other.getLogCount()); + } + if (other.getUnchangedCount() != 0) { + setUnchangedCount(other.getUnchangedCount()); + } + if (other.getDifferenceCount() != 0) { + setDifferenceCount(other.getDifferenceCount()); + } + if (other.getErrorCount() != 0) { + setErrorCount(other.getErrorCount()); + } + if (other.hasOldestDate()) { + mergeOldestDate(other.getOldestDate()); + } + if (other.hasNewestDate()) { + mergeNewestDate(other.getNewestDate()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + logCount_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: + { + unchangedCount_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 24: + { + differenceCount_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: + { + errorCount_ = input.readInt32(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 42: + { + input.readMessage(getOldestDateFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 42 + case 50: + { + input.readMessage(getNewestDateFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int logCount_; + /** + * + * + *
+       * The total number of log entries replayed.
+       * 
+ * + * int32 log_count = 1; + * + * @return The logCount. + */ + @java.lang.Override + public int getLogCount() { + return logCount_; + } + /** + * + * + *
+       * The total number of log entries replayed.
+       * 
+ * + * int32 log_count = 1; + * + * @param value The logCount to set. + * @return This builder for chaining. + */ + public Builder setLogCount(int value) { + + logCount_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * The total number of log entries replayed.
+       * 
+ * + * int32 log_count = 1; + * + * @return This builder for chaining. + */ + public Builder clearLogCount() { + bitField0_ = (bitField0_ & ~0x00000001); + logCount_ = 0; + onChanged(); + return this; + } + + private int unchangedCount_; + /** + * + * + *
+       * The number of replayed log entries with no difference between
+       * baseline and simulated policies.
+       * 
+ * + * int32 unchanged_count = 2; + * + * @return The unchangedCount. + */ + @java.lang.Override + public int getUnchangedCount() { + return unchangedCount_; + } + /** + * + * + *
+       * The number of replayed log entries with no difference between
+       * baseline and simulated policies.
+       * 
+ * + * int32 unchanged_count = 2; + * + * @param value The unchangedCount to set. + * @return This builder for chaining. + */ + public Builder setUnchangedCount(int value) { + + unchangedCount_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * The number of replayed log entries with no difference between
+       * baseline and simulated policies.
+       * 
+ * + * int32 unchanged_count = 2; + * + * @return This builder for chaining. + */ + public Builder clearUnchangedCount() { + bitField0_ = (bitField0_ & ~0x00000002); + unchangedCount_ = 0; + onChanged(); + return this; + } + + private int differenceCount_; + /** + * + * + *
+       * The number of replayed log entries with a difference between baseline and
+       * simulated policies.
+       * 
+ * + * int32 difference_count = 3; + * + * @return The differenceCount. + */ + @java.lang.Override + public int getDifferenceCount() { + return differenceCount_; + } + /** + * + * + *
+       * The number of replayed log entries with a difference between baseline and
+       * simulated policies.
+       * 
+ * + * int32 difference_count = 3; + * + * @param value The differenceCount to set. + * @return This builder for chaining. + */ + public Builder setDifferenceCount(int value) { + + differenceCount_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+       * The number of replayed log entries with a difference between baseline and
+       * simulated policies.
+       * 
+ * + * int32 difference_count = 3; + * + * @return This builder for chaining. + */ + public Builder clearDifferenceCount() { + bitField0_ = (bitField0_ & ~0x00000004); + differenceCount_ = 0; + onChanged(); + return this; + } + + private int errorCount_; + /** + * + * + *
+       * The number of log entries that could not be replayed.
+       * 
+ * + * int32 error_count = 4; + * + * @return The errorCount. + */ + @java.lang.Override + public int getErrorCount() { + return errorCount_; + } + /** + * + * + *
+       * The number of log entries that could not be replayed.
+       * 
+ * + * int32 error_count = 4; + * + * @param value The errorCount to set. + * @return This builder for chaining. + */ + public Builder setErrorCount(int value) { + + errorCount_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+       * The number of log entries that could not be replayed.
+       * 
+ * + * int32 error_count = 4; + * + * @return This builder for chaining. + */ + public Builder clearErrorCount() { + bitField0_ = (bitField0_ & ~0x00000008); + errorCount_ = 0; + onChanged(); + return this; + } + + private com.google.type.Date oldestDate_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Date, com.google.type.Date.Builder, com.google.type.DateOrBuilder> + oldestDateBuilder_; + /** + * + * + *
+       * The date of the oldest log entry replayed.
+       * 
+ * + * .google.type.Date oldest_date = 5; + * + * @return Whether the oldestDate field is set. + */ + public boolean hasOldestDate() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + * + * + *
+       * The date of the oldest log entry replayed.
+       * 
+ * + * .google.type.Date oldest_date = 5; + * + * @return The oldestDate. + */ + public com.google.type.Date getOldestDate() { + if (oldestDateBuilder_ == null) { + return oldestDate_ == null ? com.google.type.Date.getDefaultInstance() : oldestDate_; + } else { + return oldestDateBuilder_.getMessage(); + } + } + /** + * + * + *
+       * The date of the oldest log entry replayed.
+       * 
+ * + * .google.type.Date oldest_date = 5; + */ + public Builder setOldestDate(com.google.type.Date value) { + if (oldestDateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + oldestDate_ = value; + } else { + oldestDateBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+       * The date of the oldest log entry replayed.
+       * 
+ * + * .google.type.Date oldest_date = 5; + */ + public Builder setOldestDate(com.google.type.Date.Builder builderForValue) { + if (oldestDateBuilder_ == null) { + oldestDate_ = builderForValue.build(); + } else { + oldestDateBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+       * The date of the oldest log entry replayed.
+       * 
+ * + * .google.type.Date oldest_date = 5; + */ + public Builder mergeOldestDate(com.google.type.Date value) { + if (oldestDateBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) + && oldestDate_ != null + && oldestDate_ != com.google.type.Date.getDefaultInstance()) { + getOldestDateBuilder().mergeFrom(value); + } else { + oldestDate_ = value; + } + } else { + oldestDateBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+       * The date of the oldest log entry replayed.
+       * 
+ * + * .google.type.Date oldest_date = 5; + */ + public Builder clearOldestDate() { + bitField0_ = (bitField0_ & ~0x00000010); + oldestDate_ = null; + if (oldestDateBuilder_ != null) { + oldestDateBuilder_.dispose(); + oldestDateBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+       * The date of the oldest log entry replayed.
+       * 
+ * + * .google.type.Date oldest_date = 5; + */ + public com.google.type.Date.Builder getOldestDateBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return getOldestDateFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * The date of the oldest log entry replayed.
+       * 
+ * + * .google.type.Date oldest_date = 5; + */ + public com.google.type.DateOrBuilder getOldestDateOrBuilder() { + if (oldestDateBuilder_ != null) { + return oldestDateBuilder_.getMessageOrBuilder(); + } else { + return oldestDate_ == null ? com.google.type.Date.getDefaultInstance() : oldestDate_; + } + } + /** + * + * + *
+       * The date of the oldest log entry replayed.
+       * 
+ * + * .google.type.Date oldest_date = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Date, com.google.type.Date.Builder, com.google.type.DateOrBuilder> + getOldestDateFieldBuilder() { + if (oldestDateBuilder_ == null) { + oldestDateBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Date, + com.google.type.Date.Builder, + com.google.type.DateOrBuilder>( + getOldestDate(), getParentForChildren(), isClean()); + oldestDate_ = null; + } + return oldestDateBuilder_; + } + + private com.google.type.Date newestDate_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Date, com.google.type.Date.Builder, com.google.type.DateOrBuilder> + newestDateBuilder_; + /** + * + * + *
+       * The date of the newest log entry replayed.
+       * 
+ * + * .google.type.Date newest_date = 6; + * + * @return Whether the newestDate field is set. + */ + public boolean hasNewestDate() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + * + * + *
+       * The date of the newest log entry replayed.
+       * 
+ * + * .google.type.Date newest_date = 6; + * + * @return The newestDate. + */ + public com.google.type.Date getNewestDate() { + if (newestDateBuilder_ == null) { + return newestDate_ == null ? com.google.type.Date.getDefaultInstance() : newestDate_; + } else { + return newestDateBuilder_.getMessage(); + } + } + /** + * + * + *
+       * The date of the newest log entry replayed.
+       * 
+ * + * .google.type.Date newest_date = 6; + */ + public Builder setNewestDate(com.google.type.Date value) { + if (newestDateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + newestDate_ = value; + } else { + newestDateBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+       * The date of the newest log entry replayed.
+       * 
+ * + * .google.type.Date newest_date = 6; + */ + public Builder setNewestDate(com.google.type.Date.Builder builderForValue) { + if (newestDateBuilder_ == null) { + newestDate_ = builderForValue.build(); + } else { + newestDateBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+       * The date of the newest log entry replayed.
+       * 
+ * + * .google.type.Date newest_date = 6; + */ + public Builder mergeNewestDate(com.google.type.Date value) { + if (newestDateBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && newestDate_ != null + && newestDate_ != com.google.type.Date.getDefaultInstance()) { + getNewestDateBuilder().mergeFrom(value); + } else { + newestDate_ = value; + } + } else { + newestDateBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+       * The date of the newest log entry replayed.
+       * 
+ * + * .google.type.Date newest_date = 6; + */ + public Builder clearNewestDate() { + bitField0_ = (bitField0_ & ~0x00000020); + newestDate_ = null; + if (newestDateBuilder_ != null) { + newestDateBuilder_.dispose(); + newestDateBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+       * The date of the newest log entry replayed.
+       * 
+ * + * .google.type.Date newest_date = 6; + */ + public com.google.type.Date.Builder getNewestDateBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return getNewestDateFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * The date of the newest log entry replayed.
+       * 
+ * + * .google.type.Date newest_date = 6; + */ + public com.google.type.DateOrBuilder getNewestDateOrBuilder() { + if (newestDateBuilder_ != null) { + return newestDateBuilder_.getMessageOrBuilder(); + } else { + return newestDate_ == null ? com.google.type.Date.getDefaultInstance() : newestDate_; + } + } + /** + * + * + *
+       * The date of the newest log entry replayed.
+       * 
+ * + * .google.type.Date newest_date = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Date, com.google.type.Date.Builder, com.google.type.DateOrBuilder> + getNewestDateFieldBuilder() { + if (newestDateBuilder_ == null) { + newestDateBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Date, + com.google.type.Date.Builder, + com.google.type.DateOrBuilder>( + getNewestDate(), getParentForChildren(), isClean()); + newestDate_ = null; + } + return newestDateBuilder_; + } + + @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.policysimulator.v1.Replay.ResultsSummary) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.Replay.ResultsSummary) + private static final com.google.cloud.policysimulator.v1.Replay.ResultsSummary DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.Replay.ResultsSummary(); + } + + public static com.google.cloud.policysimulator.v1.Replay.ResultsSummary getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ResultsSummary parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay.ResultsSummary getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Output only. The resource name of the `Replay`, which has the following
+   * format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the Replay.
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The resource name of the `Replay`, which has the following
+   * format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the Replay.
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATE_FIELD_NUMBER = 2; + private int state_ = 0; + /** + * + * + *
+   * Output only. The current state of the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * Output only. The current state of the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay.State getState() { + com.google.cloud.policysimulator.v1.Replay.State result = + com.google.cloud.policysimulator.v1.Replay.State.forNumber(state_); + return result == null ? com.google.cloud.policysimulator.v1.Replay.State.UNRECOGNIZED : result; + } + + public static final int CONFIG_FIELD_NUMBER = 3; + private com.google.cloud.policysimulator.v1.ReplayConfig config_; + /** + * + * + *
+   * Required. The configuration used for the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the config field is set. + */ + @java.lang.Override + public boolean hasConfig() { + return config_ != null; + } + /** + * + * + *
+   * Required. The configuration used for the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The config. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayConfig getConfig() { + return config_ == null + ? com.google.cloud.policysimulator.v1.ReplayConfig.getDefaultInstance() + : config_; + } + /** + * + * + *
+   * Required. The configuration used for the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayConfigOrBuilder getConfigOrBuilder() { + return config_ == null + ? com.google.cloud.policysimulator.v1.ReplayConfig.getDefaultInstance() + : config_; + } + + public static final int RESULTS_SUMMARY_FIELD_NUMBER = 5; + private com.google.cloud.policysimulator.v1.Replay.ResultsSummary resultsSummary_; + /** + * + * + *
+   * Output only. Summary statistics about the replayed log entries.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the resultsSummary field is set. + */ + @java.lang.Override + public boolean hasResultsSummary() { + return resultsSummary_ != null; + } + /** + * + * + *
+   * Output only. Summary statistics about the replayed log entries.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The resultsSummary. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay.ResultsSummary getResultsSummary() { + return resultsSummary_ == null + ? com.google.cloud.policysimulator.v1.Replay.ResultsSummary.getDefaultInstance() + : resultsSummary_; + } + /** + * + * + *
+   * Output only. Summary statistics about the replayed log entries.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay.ResultsSummaryOrBuilder + getResultsSummaryOrBuilder() { + return resultsSummary_ == null + ? com.google.cloud.policysimulator.v1.Replay.ResultsSummary.getDefaultInstance() + : resultsSummary_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (state_ != com.google.cloud.policysimulator.v1.Replay.State.STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(2, state_); + } + if (config_ != null) { + output.writeMessage(3, getConfig()); + } + if (resultsSummary_ != null) { + output.writeMessage(5, getResultsSummary()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (state_ != com.google.cloud.policysimulator.v1.Replay.State.STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, state_); + } + if (config_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getConfig()); + } + if (resultsSummary_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getResultsSummary()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.Replay)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.Replay other = + (com.google.cloud.policysimulator.v1.Replay) obj; + + if (!getName().equals(other.getName())) return false; + if (state_ != other.state_) return false; + if (hasConfig() != other.hasConfig()) return false; + if (hasConfig()) { + if (!getConfig().equals(other.getConfig())) return false; + } + if (hasResultsSummary() != other.hasResultsSummary()) return false; + if (hasResultsSummary()) { + if (!getResultsSummary().equals(other.getResultsSummary())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasConfig()) { + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + } + if (hasResultsSummary()) { + hash = (37 * hash) + RESULTS_SUMMARY_FIELD_NUMBER; + hash = (53 * hash) + getResultsSummary().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.Replay parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.Replay 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.policysimulator.v1.Replay parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.Replay 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.policysimulator.v1.Replay parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.Replay parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.Replay parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.Replay 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.policysimulator.v1.Replay parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.Replay 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.policysimulator.v1.Replay parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.Replay 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.policysimulator.v1.Replay prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A resource describing a `Replay`, or simulation.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.Replay} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.Replay) + com.google.cloud.policysimulator.v1.ReplayOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.Replay.class, + com.google.cloud.policysimulator.v1.Replay.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.Replay.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + state_ = 0; + config_ = null; + if (configBuilder_ != null) { + configBuilder_.dispose(); + configBuilder_ = null; + } + resultsSummary_ = null; + if (resultsSummaryBuilder_ != null) { + resultsSummaryBuilder_.dispose(); + resultsSummaryBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_Replay_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.Replay.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay build() { + com.google.cloud.policysimulator.v1.Replay result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay buildPartial() { + com.google.cloud.policysimulator.v1.Replay result = + new com.google.cloud.policysimulator.v1.Replay(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.Replay result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.state_ = state_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.config_ = configBuilder_ == null ? config_ : configBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.resultsSummary_ = + resultsSummaryBuilder_ == null ? resultsSummary_ : resultsSummaryBuilder_.build(); + } + } + + @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.policysimulator.v1.Replay) { + return mergeFrom((com.google.cloud.policysimulator.v1.Replay) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.Replay other) { + if (other == com.google.cloud.policysimulator.v1.Replay.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasConfig()) { + mergeConfig(other.getConfig()); + } + if (other.hasResultsSummary()) { + mergeResultsSummary(other.getResultsSummary()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + input.readMessage(getConfigFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 42: + { + input.readMessage(getResultsSummaryFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The resource name of the `Replay`, which has the following
+     * format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the Replay.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the `Replay`, which has the following
+     * format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the Replay.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the `Replay`, which has the following
+     * format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the Replay.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the `Replay`, which has the following
+     * format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the Replay.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the `Replay`, which has the following
+     * format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the Replay.
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int state_ = 0; + /** + * + * + *
+     * Output only. The current state of the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * Output only. The current state of the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The current state of the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay.State getState() { + com.google.cloud.policysimulator.v1.Replay.State result = + com.google.cloud.policysimulator.v1.Replay.State.forNumber(state_); + return result == null + ? com.google.cloud.policysimulator.v1.Replay.State.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Output only. The current state of the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.cloud.policysimulator.v1.Replay.State value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The current state of the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000002); + state_ = 0; + onChanged(); + return this; + } + + private com.google.cloud.policysimulator.v1.ReplayConfig config_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ReplayConfig, + com.google.cloud.policysimulator.v1.ReplayConfig.Builder, + com.google.cloud.policysimulator.v1.ReplayConfigOrBuilder> + configBuilder_; + /** + * + * + *
+     * Required. The configuration used for the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the config field is set. + */ + public boolean hasConfig() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Required. The configuration used for the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The config. + */ + public com.google.cloud.policysimulator.v1.ReplayConfig getConfig() { + if (configBuilder_ == null) { + return config_ == null + ? com.google.cloud.policysimulator.v1.ReplayConfig.getDefaultInstance() + : config_; + } else { + return configBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The configuration used for the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setConfig(com.google.cloud.policysimulator.v1.ReplayConfig value) { + if (configBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + } else { + configBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The configuration used for the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setConfig( + com.google.cloud.policysimulator.v1.ReplayConfig.Builder builderForValue) { + if (configBuilder_ == null) { + config_ = builderForValue.build(); + } else { + configBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The configuration used for the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeConfig(com.google.cloud.policysimulator.v1.ReplayConfig value) { + if (configBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && config_ != null + && config_ != com.google.cloud.policysimulator.v1.ReplayConfig.getDefaultInstance()) { + getConfigBuilder().mergeFrom(value); + } else { + config_ = value; + } + } else { + configBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The configuration used for the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearConfig() { + bitField0_ = (bitField0_ & ~0x00000004); + config_ = null; + if (configBuilder_ != null) { + configBuilder_.dispose(); + configBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The configuration used for the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.policysimulator.v1.ReplayConfig.Builder getConfigBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The configuration used for the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.policysimulator.v1.ReplayConfigOrBuilder getConfigOrBuilder() { + if (configBuilder_ != null) { + return configBuilder_.getMessageOrBuilder(); + } else { + return config_ == null + ? com.google.cloud.policysimulator.v1.ReplayConfig.getDefaultInstance() + : config_; + } + } + /** + * + * + *
+     * Required. The configuration used for the `Replay`.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ReplayConfig, + com.google.cloud.policysimulator.v1.ReplayConfig.Builder, + com.google.cloud.policysimulator.v1.ReplayConfigOrBuilder> + getConfigFieldBuilder() { + if (configBuilder_ == null) { + configBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ReplayConfig, + com.google.cloud.policysimulator.v1.ReplayConfig.Builder, + com.google.cloud.policysimulator.v1.ReplayConfigOrBuilder>( + getConfig(), getParentForChildren(), isClean()); + config_ = null; + } + return configBuilder_; + } + + private com.google.cloud.policysimulator.v1.Replay.ResultsSummary resultsSummary_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.Replay.ResultsSummary, + com.google.cloud.policysimulator.v1.Replay.ResultsSummary.Builder, + com.google.cloud.policysimulator.v1.Replay.ResultsSummaryOrBuilder> + resultsSummaryBuilder_; + /** + * + * + *
+     * Output only. Summary statistics about the replayed log entries.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the resultsSummary field is set. + */ + public boolean hasResultsSummary() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * Output only. Summary statistics about the replayed log entries.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The resultsSummary. + */ + public com.google.cloud.policysimulator.v1.Replay.ResultsSummary getResultsSummary() { + if (resultsSummaryBuilder_ == null) { + return resultsSummary_ == null + ? com.google.cloud.policysimulator.v1.Replay.ResultsSummary.getDefaultInstance() + : resultsSummary_; + } else { + return resultsSummaryBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Summary statistics about the replayed log entries.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setResultsSummary( + com.google.cloud.policysimulator.v1.Replay.ResultsSummary value) { + if (resultsSummaryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + resultsSummary_ = value; + } else { + resultsSummaryBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Summary statistics about the replayed log entries.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setResultsSummary( + com.google.cloud.policysimulator.v1.Replay.ResultsSummary.Builder builderForValue) { + if (resultsSummaryBuilder_ == null) { + resultsSummary_ = builderForValue.build(); + } else { + resultsSummaryBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Summary statistics about the replayed log entries.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeResultsSummary( + com.google.cloud.policysimulator.v1.Replay.ResultsSummary value) { + if (resultsSummaryBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && resultsSummary_ != null + && resultsSummary_ + != com.google.cloud.policysimulator.v1.Replay.ResultsSummary.getDefaultInstance()) { + getResultsSummaryBuilder().mergeFrom(value); + } else { + resultsSummary_ = value; + } + } else { + resultsSummaryBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Summary statistics about the replayed log entries.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearResultsSummary() { + bitField0_ = (bitField0_ & ~0x00000008); + resultsSummary_ = null; + if (resultsSummaryBuilder_ != null) { + resultsSummaryBuilder_.dispose(); + resultsSummaryBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Summary statistics about the replayed log entries.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.policysimulator.v1.Replay.ResultsSummary.Builder + getResultsSummaryBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getResultsSummaryFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Summary statistics about the replayed log entries.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.policysimulator.v1.Replay.ResultsSummaryOrBuilder + getResultsSummaryOrBuilder() { + if (resultsSummaryBuilder_ != null) { + return resultsSummaryBuilder_.getMessageOrBuilder(); + } else { + return resultsSummary_ == null + ? com.google.cloud.policysimulator.v1.Replay.ResultsSummary.getDefaultInstance() + : resultsSummary_; + } + } + /** + * + * + *
+     * Output only. Summary statistics about the replayed log entries.
+     * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.Replay.ResultsSummary, + com.google.cloud.policysimulator.v1.Replay.ResultsSummary.Builder, + com.google.cloud.policysimulator.v1.Replay.ResultsSummaryOrBuilder> + getResultsSummaryFieldBuilder() { + if (resultsSummaryBuilder_ == null) { + resultsSummaryBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.Replay.ResultsSummary, + com.google.cloud.policysimulator.v1.Replay.ResultsSummary.Builder, + com.google.cloud.policysimulator.v1.Replay.ResultsSummaryOrBuilder>( + getResultsSummary(), getParentForChildren(), isClean()); + resultsSummary_ = null; + } + return resultsSummaryBuilder_; + } + + @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.policysimulator.v1.Replay) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.Replay) + private static final com.google.cloud.policysimulator.v1.Replay DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.Replay(); + } + + public static com.google.cloud.policysimulator.v1.Replay getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Replay parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.Replay getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayConfig.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayConfig.java new file mode 100644 index 000000000000..25308c772e76 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayConfig.java @@ -0,0 +1,1239 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * The configuration used for a
+ * [Replay][google.cloud.policysimulator.v1.Replay].
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ReplayConfig} + */ +public final class ReplayConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.ReplayConfig) + ReplayConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReplayConfig.newBuilder() to construct. + private ReplayConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReplayConfig() { + logSource_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReplayConfig(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayConfig_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetPolicyOverlay(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ReplayConfig.class, + com.google.cloud.policysimulator.v1.ReplayConfig.Builder.class); + } + + /** + * + * + *
+   * The source of the logs to use for a
+   * [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * Protobuf enum {@code google.cloud.policysimulator.v1.ReplayConfig.LogSource} + */ + public enum LogSource implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * An unspecified log source.
+     * If the log source is unspecified, the
+     * [Replay][google.cloud.policysimulator.v1.Replay] defaults to using
+     * `RECENT_ACCESSES`.
+     * 
+ * + * LOG_SOURCE_UNSPECIFIED = 0; + */ + LOG_SOURCE_UNSPECIFIED(0), + /** + * + * + *
+     * All access logs from the last 90 days. These logs may not include logs
+     * from the most recent 7 days.
+     * 
+ * + * RECENT_ACCESSES = 1; + */ + RECENT_ACCESSES(1), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * An unspecified log source.
+     * If the log source is unspecified, the
+     * [Replay][google.cloud.policysimulator.v1.Replay] defaults to using
+     * `RECENT_ACCESSES`.
+     * 
+ * + * LOG_SOURCE_UNSPECIFIED = 0; + */ + public static final int LOG_SOURCE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * All access logs from the last 90 days. These logs may not include logs
+     * from the most recent 7 days.
+     * 
+ * + * RECENT_ACCESSES = 1; + */ + public static final int RECENT_ACCESSES_VALUE = 1; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static LogSource 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 LogSource forNumber(int value) { + switch (value) { + case 0: + return LOG_SOURCE_UNSPECIFIED; + case 1: + return RECENT_ACCESSES; + 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 LogSource findValueByNumber(int number) { + return LogSource.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.ReplayConfig.getDescriptor().getEnumTypes().get(0); + } + + private static final LogSource[] VALUES = values(); + + public static LogSource 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 LogSource(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.policysimulator.v1.ReplayConfig.LogSource) + } + + public static final int POLICY_OVERLAY_FIELD_NUMBER = 1; + + private static final class PolicyOverlayDefaultEntryHolder { + static final com.google.protobuf.MapEntry + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayConfig_PolicyOverlayEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.iam.v1.Policy.getDefaultInstance()); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField policyOverlay_; + + private com.google.protobuf.MapField + internalGetPolicyOverlay() { + if (policyOverlay_ == null) { + return com.google.protobuf.MapField.emptyMapField( + PolicyOverlayDefaultEntryHolder.defaultEntry); + } + return policyOverlay_; + } + + public int getPolicyOverlayCount() { + return internalGetPolicyOverlay().getMap().size(); + } + /** + * + * + *
+   * A mapping of the resources that you want to simulate policies for and the
+   * policies that you want to simulate.
+   *
+   * Keys are the full resource names for the resources. For example,
+   * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   *
+   * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+   * that you want to simulate.
+   *
+   * Replays automatically take into account any IAM policies inherited through
+   * the resource hierarchy, and any policies set on descendant resources. You
+   * do not need to include these policies in the policy overlay.
+   * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + @java.lang.Override + public boolean containsPolicyOverlay(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetPolicyOverlay().getMap().containsKey(key); + } + /** Use {@link #getPolicyOverlayMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getPolicyOverlay() { + return getPolicyOverlayMap(); + } + /** + * + * + *
+   * A mapping of the resources that you want to simulate policies for and the
+   * policies that you want to simulate.
+   *
+   * Keys are the full resource names for the resources. For example,
+   * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   *
+   * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+   * that you want to simulate.
+   *
+   * Replays automatically take into account any IAM policies inherited through
+   * the resource hierarchy, and any policies set on descendant resources. You
+   * do not need to include these policies in the policy overlay.
+   * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + @java.lang.Override + public java.util.Map getPolicyOverlayMap() { + return internalGetPolicyOverlay().getMap(); + } + /** + * + * + *
+   * A mapping of the resources that you want to simulate policies for and the
+   * policies that you want to simulate.
+   *
+   * Keys are the full resource names for the resources. For example,
+   * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   *
+   * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+   * that you want to simulate.
+   *
+   * Replays automatically take into account any IAM policies inherited through
+   * the resource hierarchy, and any policies set on descendant resources. You
+   * do not need to include these policies in the policy overlay.
+   * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + @java.lang.Override + public /* nullable */ com.google.iam.v1.Policy getPolicyOverlayOrDefault( + java.lang.String key, + /* nullable */ + com.google.iam.v1.Policy defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetPolicyOverlay().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * A mapping of the resources that you want to simulate policies for and the
+   * policies that you want to simulate.
+   *
+   * Keys are the full resource names for the resources. For example,
+   * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   *
+   * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+   * that you want to simulate.
+   *
+   * Replays automatically take into account any IAM policies inherited through
+   * the resource hierarchy, and any policies set on descendant resources. You
+   * do not need to include these policies in the policy overlay.
+   * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + @java.lang.Override + public com.google.iam.v1.Policy getPolicyOverlayOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetPolicyOverlay().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int LOG_SOURCE_FIELD_NUMBER = 2; + private int logSource_ = 0; + /** + * + * + *
+   * The logs to use as input for the
+   * [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayConfig.LogSource log_source = 2; + * + * @return The enum numeric value on the wire for logSource. + */ + @java.lang.Override + public int getLogSourceValue() { + return logSource_; + } + /** + * + * + *
+   * The logs to use as input for the
+   * [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayConfig.LogSource log_source = 2; + * + * @return The logSource. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayConfig.LogSource getLogSource() { + com.google.cloud.policysimulator.v1.ReplayConfig.LogSource result = + com.google.cloud.policysimulator.v1.ReplayConfig.LogSource.forNumber(logSource_); + return result == null + ? com.google.cloud.policysimulator.v1.ReplayConfig.LogSource.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetPolicyOverlay(), PolicyOverlayDefaultEntryHolder.defaultEntry, 1); + if (logSource_ + != com.google.cloud.policysimulator.v1.ReplayConfig.LogSource.LOG_SOURCE_UNSPECIFIED + .getNumber()) { + output.writeEnum(2, logSource_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry entry : + internalGetPolicyOverlay().getMap().entrySet()) { + com.google.protobuf.MapEntry policyOverlay__ = + PolicyOverlayDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, policyOverlay__); + } + if (logSource_ + != com.google.cloud.policysimulator.v1.ReplayConfig.LogSource.LOG_SOURCE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, logSource_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.ReplayConfig)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.ReplayConfig other = + (com.google.cloud.policysimulator.v1.ReplayConfig) obj; + + if (!internalGetPolicyOverlay().equals(other.internalGetPolicyOverlay())) return false; + if (logSource_ != other.logSource_) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (!internalGetPolicyOverlay().getMap().isEmpty()) { + hash = (37 * hash) + POLICY_OVERLAY_FIELD_NUMBER; + hash = (53 * hash) + internalGetPolicyOverlay().hashCode(); + } + hash = (37 * hash) + LOG_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + logSource_; + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.ReplayConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayConfig 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.policysimulator.v1.ReplayConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayConfig 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.policysimulator.v1.ReplayConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.ReplayConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayConfig 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.policysimulator.v1.ReplayConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayConfig 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.policysimulator.v1.ReplayConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayConfig 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.policysimulator.v1.ReplayConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The configuration used for a
+   * [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ReplayConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.ReplayConfig) + com.google.cloud.policysimulator.v1.ReplayConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayConfig_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetPolicyOverlay(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 1: + return internalGetMutablePolicyOverlay(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ReplayConfig.class, + com.google.cloud.policysimulator.v1.ReplayConfig.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.ReplayConfig.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + internalGetMutablePolicyOverlay().clear(); + logSource_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayConfig getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.ReplayConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayConfig build() { + com.google.cloud.policysimulator.v1.ReplayConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayConfig buildPartial() { + com.google.cloud.policysimulator.v1.ReplayConfig result = + new com.google.cloud.policysimulator.v1.ReplayConfig(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.ReplayConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.policyOverlay_ = internalGetPolicyOverlay(); + result.policyOverlay_.makeImmutable(); + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.logSource_ = logSource_; + } + } + + @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.policysimulator.v1.ReplayConfig) { + return mergeFrom((com.google.cloud.policysimulator.v1.ReplayConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.ReplayConfig other) { + if (other == com.google.cloud.policysimulator.v1.ReplayConfig.getDefaultInstance()) + return this; + internalGetMutablePolicyOverlay().mergeFrom(other.internalGetPolicyOverlay()); + bitField0_ |= 0x00000001; + if (other.logSource_ != 0) { + setLogSourceValue(other.getLogSourceValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.MapEntry + policyOverlay__ = + input.readMessage( + PolicyOverlayDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutablePolicyOverlay() + .getMutableMap() + .put(policyOverlay__.getKey(), policyOverlay__.getValue()); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + logSource_ = input.readEnum(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.MapField policyOverlay_; + + private com.google.protobuf.MapField + internalGetPolicyOverlay() { + if (policyOverlay_ == null) { + return com.google.protobuf.MapField.emptyMapField( + PolicyOverlayDefaultEntryHolder.defaultEntry); + } + return policyOverlay_; + } + + private com.google.protobuf.MapField + internalGetMutablePolicyOverlay() { + if (policyOverlay_ == null) { + policyOverlay_ = + com.google.protobuf.MapField.newMapField(PolicyOverlayDefaultEntryHolder.defaultEntry); + } + if (!policyOverlay_.isMutable()) { + policyOverlay_ = policyOverlay_.copy(); + } + bitField0_ |= 0x00000001; + onChanged(); + return policyOverlay_; + } + + public int getPolicyOverlayCount() { + return internalGetPolicyOverlay().getMap().size(); + } + /** + * + * + *
+     * A mapping of the resources that you want to simulate policies for and the
+     * policies that you want to simulate.
+     *
+     * Keys are the full resource names for the resources. For example,
+     * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     *
+     * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+     * that you want to simulate.
+     *
+     * Replays automatically take into account any IAM policies inherited through
+     * the resource hierarchy, and any policies set on descendant resources. You
+     * do not need to include these policies in the policy overlay.
+     * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + @java.lang.Override + public boolean containsPolicyOverlay(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetPolicyOverlay().getMap().containsKey(key); + } + /** Use {@link #getPolicyOverlayMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getPolicyOverlay() { + return getPolicyOverlayMap(); + } + /** + * + * + *
+     * A mapping of the resources that you want to simulate policies for and the
+     * policies that you want to simulate.
+     *
+     * Keys are the full resource names for the resources. For example,
+     * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     *
+     * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+     * that you want to simulate.
+     *
+     * Replays automatically take into account any IAM policies inherited through
+     * the resource hierarchy, and any policies set on descendant resources. You
+     * do not need to include these policies in the policy overlay.
+     * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + @java.lang.Override + public java.util.Map getPolicyOverlayMap() { + return internalGetPolicyOverlay().getMap(); + } + /** + * + * + *
+     * A mapping of the resources that you want to simulate policies for and the
+     * policies that you want to simulate.
+     *
+     * Keys are the full resource names for the resources. For example,
+     * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     *
+     * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+     * that you want to simulate.
+     *
+     * Replays automatically take into account any IAM policies inherited through
+     * the resource hierarchy, and any policies set on descendant resources. You
+     * do not need to include these policies in the policy overlay.
+     * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + @java.lang.Override + public /* nullable */ com.google.iam.v1.Policy getPolicyOverlayOrDefault( + java.lang.String key, + /* nullable */ + com.google.iam.v1.Policy defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetPolicyOverlay().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * A mapping of the resources that you want to simulate policies for and the
+     * policies that you want to simulate.
+     *
+     * Keys are the full resource names for the resources. For example,
+     * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     *
+     * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+     * that you want to simulate.
+     *
+     * Replays automatically take into account any IAM policies inherited through
+     * the resource hierarchy, and any policies set on descendant resources. You
+     * do not need to include these policies in the policy overlay.
+     * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + @java.lang.Override + public com.google.iam.v1.Policy getPolicyOverlayOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = + internalGetPolicyOverlay().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearPolicyOverlay() { + bitField0_ = (bitField0_ & ~0x00000001); + internalGetMutablePolicyOverlay().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * A mapping of the resources that you want to simulate policies for and the
+     * policies that you want to simulate.
+     *
+     * Keys are the full resource names for the resources. For example,
+     * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     *
+     * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+     * that you want to simulate.
+     *
+     * Replays automatically take into account any IAM policies inherited through
+     * the resource hierarchy, and any policies set on descendant resources. You
+     * do not need to include these policies in the policy overlay.
+     * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + public Builder removePolicyOverlay(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutablePolicyOverlay().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutablePolicyOverlay() { + bitField0_ |= 0x00000001; + return internalGetMutablePolicyOverlay().getMutableMap(); + } + /** + * + * + *
+     * A mapping of the resources that you want to simulate policies for and the
+     * policies that you want to simulate.
+     *
+     * Keys are the full resource names for the resources. For example,
+     * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     *
+     * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+     * that you want to simulate.
+     *
+     * Replays automatically take into account any IAM policies inherited through
+     * the resource hierarchy, and any policies set on descendant resources. You
+     * do not need to include these policies in the policy overlay.
+     * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + public Builder putPolicyOverlay(java.lang.String key, com.google.iam.v1.Policy value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutablePolicyOverlay().getMutableMap().put(key, value); + bitField0_ |= 0x00000001; + return this; + } + /** + * + * + *
+     * A mapping of the resources that you want to simulate policies for and the
+     * policies that you want to simulate.
+     *
+     * Keys are the full resource names for the resources. For example,
+     * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+     * For examples of full resource names for Google Cloud services, see
+     * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+     *
+     * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+     * that you want to simulate.
+     *
+     * Replays automatically take into account any IAM policies inherited through
+     * the resource hierarchy, and any policies set on descendant resources. You
+     * do not need to include these policies in the policy overlay.
+     * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + public Builder putAllPolicyOverlay( + java.util.Map values) { + internalGetMutablePolicyOverlay().getMutableMap().putAll(values); + bitField0_ |= 0x00000001; + return this; + } + + private int logSource_ = 0; + /** + * + * + *
+     * The logs to use as input for the
+     * [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayConfig.LogSource log_source = 2; + * + * @return The enum numeric value on the wire for logSource. + */ + @java.lang.Override + public int getLogSourceValue() { + return logSource_; + } + /** + * + * + *
+     * The logs to use as input for the
+     * [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayConfig.LogSource log_source = 2; + * + * @param value The enum numeric value on the wire for logSource to set. + * @return This builder for chaining. + */ + public Builder setLogSourceValue(int value) { + logSource_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The logs to use as input for the
+     * [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayConfig.LogSource log_source = 2; + * + * @return The logSource. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayConfig.LogSource getLogSource() { + com.google.cloud.policysimulator.v1.ReplayConfig.LogSource result = + com.google.cloud.policysimulator.v1.ReplayConfig.LogSource.forNumber(logSource_); + return result == null + ? com.google.cloud.policysimulator.v1.ReplayConfig.LogSource.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The logs to use as input for the
+     * [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayConfig.LogSource log_source = 2; + * + * @param value The logSource to set. + * @return This builder for chaining. + */ + public Builder setLogSource(com.google.cloud.policysimulator.v1.ReplayConfig.LogSource value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + logSource_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The logs to use as input for the
+     * [Replay][google.cloud.policysimulator.v1.Replay].
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayConfig.LogSource log_source = 2; + * + * @return This builder for chaining. + */ + public Builder clearLogSource() { + bitField0_ = (bitField0_ & ~0x00000002); + logSource_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.policysimulator.v1.ReplayConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.ReplayConfig) + private static final com.google.cloud.policysimulator.v1.ReplayConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.ReplayConfig(); + } + + public static com.google.cloud.policysimulator.v1.ReplayConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReplayConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayConfigOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayConfigOrBuilder.java new file mode 100644 index 000000000000..637199e7e1b8 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayConfigOrBuilder.java @@ -0,0 +1,175 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface ReplayConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.ReplayConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A mapping of the resources that you want to simulate policies for and the
+   * policies that you want to simulate.
+   *
+   * Keys are the full resource names for the resources. For example,
+   * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   *
+   * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+   * that you want to simulate.
+   *
+   * Replays automatically take into account any IAM policies inherited through
+   * the resource hierarchy, and any policies set on descendant resources. You
+   * do not need to include these policies in the policy overlay.
+   * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + int getPolicyOverlayCount(); + /** + * + * + *
+   * A mapping of the resources that you want to simulate policies for and the
+   * policies that you want to simulate.
+   *
+   * Keys are the full resource names for the resources. For example,
+   * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   *
+   * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+   * that you want to simulate.
+   *
+   * Replays automatically take into account any IAM policies inherited through
+   * the resource hierarchy, and any policies set on descendant resources. You
+   * do not need to include these policies in the policy overlay.
+   * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + boolean containsPolicyOverlay(java.lang.String key); + /** Use {@link #getPolicyOverlayMap()} instead. */ + @java.lang.Deprecated + java.util.Map getPolicyOverlay(); + /** + * + * + *
+   * A mapping of the resources that you want to simulate policies for and the
+   * policies that you want to simulate.
+   *
+   * Keys are the full resource names for the resources. For example,
+   * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   *
+   * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+   * that you want to simulate.
+   *
+   * Replays automatically take into account any IAM policies inherited through
+   * the resource hierarchy, and any policies set on descendant resources. You
+   * do not need to include these policies in the policy overlay.
+   * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + java.util.Map getPolicyOverlayMap(); + /** + * + * + *
+   * A mapping of the resources that you want to simulate policies for and the
+   * policies that you want to simulate.
+   *
+   * Keys are the full resource names for the resources. For example,
+   * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   *
+   * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+   * that you want to simulate.
+   *
+   * Replays automatically take into account any IAM policies inherited through
+   * the resource hierarchy, and any policies set on descendant resources. You
+   * do not need to include these policies in the policy overlay.
+   * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + /* nullable */ + com.google.iam.v1.Policy getPolicyOverlayOrDefault( + java.lang.String key, + /* nullable */ + com.google.iam.v1.Policy defaultValue); + /** + * + * + *
+   * A mapping of the resources that you want to simulate policies for and the
+   * policies that you want to simulate.
+   *
+   * Keys are the full resource names for the resources. For example,
+   * `//cloudresourcemanager.googleapis.com/projects/my-project`.
+   * For examples of full resource names for Google Cloud services, see
+   * https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
+   *
+   * Values are [Policy][google.iam.v1.Policy] objects representing the policies
+   * that you want to simulate.
+   *
+   * Replays automatically take into account any IAM policies inherited through
+   * the resource hierarchy, and any policies set on descendant resources. You
+   * do not need to include these policies in the policy overlay.
+   * 
+ * + * map<string, .google.iam.v1.Policy> policy_overlay = 1; + */ + com.google.iam.v1.Policy getPolicyOverlayOrThrow(java.lang.String key); + + /** + * + * + *
+   * The logs to use as input for the
+   * [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayConfig.LogSource log_source = 2; + * + * @return The enum numeric value on the wire for logSource. + */ + int getLogSourceValue(); + /** + * + * + *
+   * The logs to use as input for the
+   * [Replay][google.cloud.policysimulator.v1.Replay].
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayConfig.LogSource log_source = 2; + * + * @return The logSource. + */ + com.google.cloud.policysimulator.v1.ReplayConfig.LogSource getLogSource(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayDiff.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayDiff.java new file mode 100644 index 000000000000..107e5f1df2b3 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayDiff.java @@ -0,0 +1,772 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * The difference between the results of evaluating an access tuple under
+ * the current (baseline) policies and under the proposed (simulated) policies.
+ * This difference explains how a principal's access could change if the
+ * proposed policies were applied.
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ReplayDiff} + */ +public final class ReplayDiff extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.ReplayDiff) + ReplayDiffOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReplayDiff.newBuilder() to construct. + private ReplayDiff(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReplayDiff() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReplayDiff(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayDiff_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayDiff_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ReplayDiff.class, + com.google.cloud.policysimulator.v1.ReplayDiff.Builder.class); + } + + public static final int ACCESS_DIFF_FIELD_NUMBER = 2; + private com.google.cloud.policysimulator.v1.AccessStateDiff accessDiff_; + /** + * + * + *
+   * A summary and comparison of the principal's access under the current
+   * (baseline) policies and the proposed (simulated) policies for a single
+   * access tuple.
+   *
+   * The evaluation of the principal's access is reported in the
+   * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + * + * @return Whether the accessDiff field is set. + */ + @java.lang.Override + public boolean hasAccessDiff() { + return accessDiff_ != null; + } + /** + * + * + *
+   * A summary and comparison of the principal's access under the current
+   * (baseline) policies and the proposed (simulated) policies for a single
+   * access tuple.
+   *
+   * The evaluation of the principal's access is reported in the
+   * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + * + * @return The accessDiff. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessStateDiff getAccessDiff() { + return accessDiff_ == null + ? com.google.cloud.policysimulator.v1.AccessStateDiff.getDefaultInstance() + : accessDiff_; + } + /** + * + * + *
+   * A summary and comparison of the principal's access under the current
+   * (baseline) policies and the proposed (simulated) policies for a single
+   * access tuple.
+   *
+   * The evaluation of the principal's access is reported in the
+   * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessStateDiffOrBuilder getAccessDiffOrBuilder() { + return accessDiff_ == null + ? com.google.cloud.policysimulator.v1.AccessStateDiff.getDefaultInstance() + : accessDiff_; + } + + 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 (accessDiff_ != null) { + output.writeMessage(2, getAccessDiff()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (accessDiff_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getAccessDiff()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.ReplayDiff)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.ReplayDiff other = + (com.google.cloud.policysimulator.v1.ReplayDiff) obj; + + if (hasAccessDiff() != other.hasAccessDiff()) return false; + if (hasAccessDiff()) { + if (!getAccessDiff().equals(other.getAccessDiff())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasAccessDiff()) { + hash = (37 * hash) + ACCESS_DIFF_FIELD_NUMBER; + hash = (53 * hash) + getAccessDiff().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.ReplayDiff parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayDiff 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.policysimulator.v1.ReplayDiff parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayDiff 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.policysimulator.v1.ReplayDiff parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayDiff parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.ReplayDiff parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayDiff 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.policysimulator.v1.ReplayDiff parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayDiff 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.policysimulator.v1.ReplayDiff parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayDiff 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.policysimulator.v1.ReplayDiff prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The difference between the results of evaluating an access tuple under
+   * the current (baseline) policies and under the proposed (simulated) policies.
+   * This difference explains how a principal's access could change if the
+   * proposed policies were applied.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ReplayDiff} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.ReplayDiff) + com.google.cloud.policysimulator.v1.ReplayDiffOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayDiff_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayDiff_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ReplayDiff.class, + com.google.cloud.policysimulator.v1.ReplayDiff.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.ReplayDiff.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + accessDiff_ = null; + if (accessDiffBuilder_ != null) { + accessDiffBuilder_.dispose(); + accessDiffBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayDiff_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayDiff getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.ReplayDiff.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayDiff build() { + com.google.cloud.policysimulator.v1.ReplayDiff result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayDiff buildPartial() { + com.google.cloud.policysimulator.v1.ReplayDiff result = + new com.google.cloud.policysimulator.v1.ReplayDiff(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.ReplayDiff result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.accessDiff_ = accessDiffBuilder_ == null ? accessDiff_ : accessDiffBuilder_.build(); + } + } + + @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.policysimulator.v1.ReplayDiff) { + return mergeFrom((com.google.cloud.policysimulator.v1.ReplayDiff) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.ReplayDiff other) { + if (other == com.google.cloud.policysimulator.v1.ReplayDiff.getDefaultInstance()) return this; + if (other.hasAccessDiff()) { + mergeAccessDiff(other.getAccessDiff()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 18: + { + input.readMessage(getAccessDiffFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.cloud.policysimulator.v1.AccessStateDiff accessDiff_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.AccessStateDiff, + com.google.cloud.policysimulator.v1.AccessStateDiff.Builder, + com.google.cloud.policysimulator.v1.AccessStateDiffOrBuilder> + accessDiffBuilder_; + /** + * + * + *
+     * A summary and comparison of the principal's access under the current
+     * (baseline) policies and the proposed (simulated) policies for a single
+     * access tuple.
+     *
+     * The evaluation of the principal's access is reported in the
+     * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + * + * @return Whether the accessDiff field is set. + */ + public boolean hasAccessDiff() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * A summary and comparison of the principal's access under the current
+     * (baseline) policies and the proposed (simulated) policies for a single
+     * access tuple.
+     *
+     * The evaluation of the principal's access is reported in the
+     * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + * + * @return The accessDiff. + */ + public com.google.cloud.policysimulator.v1.AccessStateDiff getAccessDiff() { + if (accessDiffBuilder_ == null) { + return accessDiff_ == null + ? com.google.cloud.policysimulator.v1.AccessStateDiff.getDefaultInstance() + : accessDiff_; + } else { + return accessDiffBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A summary and comparison of the principal's access under the current
+     * (baseline) policies and the proposed (simulated) policies for a single
+     * access tuple.
+     *
+     * The evaluation of the principal's access is reported in the
+     * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + */ + public Builder setAccessDiff(com.google.cloud.policysimulator.v1.AccessStateDiff value) { + if (accessDiffBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + accessDiff_ = value; + } else { + accessDiffBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * A summary and comparison of the principal's access under the current
+     * (baseline) policies and the proposed (simulated) policies for a single
+     * access tuple.
+     *
+     * The evaluation of the principal's access is reported in the
+     * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + */ + public Builder setAccessDiff( + com.google.cloud.policysimulator.v1.AccessStateDiff.Builder builderForValue) { + if (accessDiffBuilder_ == null) { + accessDiff_ = builderForValue.build(); + } else { + accessDiffBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * A summary and comparison of the principal's access under the current
+     * (baseline) policies and the proposed (simulated) policies for a single
+     * access tuple.
+     *
+     * The evaluation of the principal's access is reported in the
+     * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + */ + public Builder mergeAccessDiff(com.google.cloud.policysimulator.v1.AccessStateDiff value) { + if (accessDiffBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && accessDiff_ != null + && accessDiff_ + != com.google.cloud.policysimulator.v1.AccessStateDiff.getDefaultInstance()) { + getAccessDiffBuilder().mergeFrom(value); + } else { + accessDiff_ = value; + } + } else { + accessDiffBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * A summary and comparison of the principal's access under the current
+     * (baseline) policies and the proposed (simulated) policies for a single
+     * access tuple.
+     *
+     * The evaluation of the principal's access is reported in the
+     * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + */ + public Builder clearAccessDiff() { + bitField0_ = (bitField0_ & ~0x00000001); + accessDiff_ = null; + if (accessDiffBuilder_ != null) { + accessDiffBuilder_.dispose(); + accessDiffBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * A summary and comparison of the principal's access under the current
+     * (baseline) policies and the proposed (simulated) policies for a single
+     * access tuple.
+     *
+     * The evaluation of the principal's access is reported in the
+     * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + */ + public com.google.cloud.policysimulator.v1.AccessStateDiff.Builder getAccessDiffBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getAccessDiffFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A summary and comparison of the principal's access under the current
+     * (baseline) policies and the proposed (simulated) policies for a single
+     * access tuple.
+     *
+     * The evaluation of the principal's access is reported in the
+     * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + */ + public com.google.cloud.policysimulator.v1.AccessStateDiffOrBuilder getAccessDiffOrBuilder() { + if (accessDiffBuilder_ != null) { + return accessDiffBuilder_.getMessageOrBuilder(); + } else { + return accessDiff_ == null + ? com.google.cloud.policysimulator.v1.AccessStateDiff.getDefaultInstance() + : accessDiff_; + } + } + /** + * + * + *
+     * A summary and comparison of the principal's access under the current
+     * (baseline) policies and the proposed (simulated) policies for a single
+     * access tuple.
+     *
+     * The evaluation of the principal's access is reported in the
+     * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.AccessStateDiff, + com.google.cloud.policysimulator.v1.AccessStateDiff.Builder, + com.google.cloud.policysimulator.v1.AccessStateDiffOrBuilder> + getAccessDiffFieldBuilder() { + if (accessDiffBuilder_ == null) { + accessDiffBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.AccessStateDiff, + com.google.cloud.policysimulator.v1.AccessStateDiff.Builder, + com.google.cloud.policysimulator.v1.AccessStateDiffOrBuilder>( + getAccessDiff(), getParentForChildren(), isClean()); + accessDiff_ = null; + } + return accessDiffBuilder_; + } + + @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.policysimulator.v1.ReplayDiff) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.ReplayDiff) + private static final com.google.cloud.policysimulator.v1.ReplayDiff DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.ReplayDiff(); + } + + public static com.google.cloud.policysimulator.v1.ReplayDiff getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReplayDiff parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayDiff getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayDiffOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayDiffOrBuilder.java new file mode 100644 index 000000000000..ba332c8a6f89 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayDiffOrBuilder.java @@ -0,0 +1,75 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface ReplayDiffOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.ReplayDiff) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A summary and comparison of the principal's access under the current
+   * (baseline) policies and the proposed (simulated) policies for a single
+   * access tuple.
+   *
+   * The evaluation of the principal's access is reported in the
+   * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + * + * @return Whether the accessDiff field is set. + */ + boolean hasAccessDiff(); + /** + * + * + *
+   * A summary and comparison of the principal's access under the current
+   * (baseline) policies and the proposed (simulated) policies for a single
+   * access tuple.
+   *
+   * The evaluation of the principal's access is reported in the
+   * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + * + * @return The accessDiff. + */ + com.google.cloud.policysimulator.v1.AccessStateDiff getAccessDiff(); + /** + * + * + *
+   * A summary and comparison of the principal's access under the current
+   * (baseline) policies and the proposed (simulated) policies for a single
+   * access tuple.
+   *
+   * The evaluation of the principal's access is reported in the
+   * [AccessState][google.cloud.policysimulator.v1.AccessState] field.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessStateDiff access_diff = 2; + */ + com.google.cloud.policysimulator.v1.AccessStateDiffOrBuilder getAccessDiffOrBuilder(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayName.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayName.java new file mode 100644 index 000000000000..a9a0d320bffb --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayName.java @@ -0,0 +1,450 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.pathtemplate.ValidationException; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class ReplayName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_REPLAY = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/replays/{replay}"); + private static final PathTemplate FOLDER_LOCATION_REPLAY = + PathTemplate.createWithoutUrlEncoding( + "folders/{folder}/locations/{location}/replays/{replay}"); + private static final PathTemplate ORGANIZATION_LOCATION_REPLAY = + PathTemplate.createWithoutUrlEncoding( + "organizations/{organization}/locations/{location}/replays/{replay}"); + private volatile Map fieldValuesMap; + private PathTemplate pathTemplate; + private String fixedValue; + private final String project; + private final String location; + private final String replay; + private final String folder; + private final String organization; + + @Deprecated + protected ReplayName() { + project = null; + location = null; + replay = null; + folder = null; + organization = null; + } + + private ReplayName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + replay = Preconditions.checkNotNull(builder.getReplay()); + folder = null; + organization = null; + pathTemplate = PROJECT_LOCATION_REPLAY; + } + + private ReplayName(FolderLocationReplayBuilder builder) { + folder = Preconditions.checkNotNull(builder.getFolder()); + location = Preconditions.checkNotNull(builder.getLocation()); + replay = Preconditions.checkNotNull(builder.getReplay()); + project = null; + organization = null; + pathTemplate = FOLDER_LOCATION_REPLAY; + } + + private ReplayName(OrganizationLocationReplayBuilder builder) { + organization = Preconditions.checkNotNull(builder.getOrganization()); + location = Preconditions.checkNotNull(builder.getLocation()); + replay = Preconditions.checkNotNull(builder.getReplay()); + project = null; + folder = null; + pathTemplate = ORGANIZATION_LOCATION_REPLAY; + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getReplay() { + return replay; + } + + public String getFolder() { + return folder; + } + + public String getOrganization() { + return organization; + } + + public static Builder newBuilder() { + return new Builder(); + } + + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static Builder newProjectLocationReplayBuilder() { + return new Builder(); + } + + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static FolderLocationReplayBuilder newFolderLocationReplayBuilder() { + return new FolderLocationReplayBuilder(); + } + + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static OrganizationLocationReplayBuilder newOrganizationLocationReplayBuilder() { + return new OrganizationLocationReplayBuilder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ReplayName of(String project, String location, String replay) { + return newBuilder().setProject(project).setLocation(location).setReplay(replay).build(); + } + + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static ReplayName ofProjectLocationReplayName( + String project, String location, String replay) { + return newBuilder().setProject(project).setLocation(location).setReplay(replay).build(); + } + + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static ReplayName ofFolderLocationReplayName( + String folder, String location, String replay) { + return newFolderLocationReplayBuilder() + .setFolder(folder) + .setLocation(location) + .setReplay(replay) + .build(); + } + + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static ReplayName ofOrganizationLocationReplayName( + String organization, String location, String replay) { + return newOrganizationLocationReplayBuilder() + .setOrganization(organization) + .setLocation(location) + .setReplay(replay) + .build(); + } + + public static String format(String project, String location, String replay) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setReplay(replay) + .build() + .toString(); + } + + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatProjectLocationReplayName( + String project, String location, String replay) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setReplay(replay) + .build() + .toString(); + } + + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatFolderLocationReplayName( + String folder, String location, String replay) { + return newFolderLocationReplayBuilder() + .setFolder(folder) + .setLocation(location) + .setReplay(replay) + .build() + .toString(); + } + + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatOrganizationLocationReplayName( + String organization, String location, String replay) { + return newOrganizationLocationReplayBuilder() + .setOrganization(organization) + .setLocation(location) + .setReplay(replay) + .build() + .toString(); + } + + public static ReplayName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + if (PROJECT_LOCATION_REPLAY.matches(formattedString)) { + Map matchMap = PROJECT_LOCATION_REPLAY.match(formattedString); + return ofProjectLocationReplayName( + matchMap.get("project"), matchMap.get("location"), matchMap.get("replay")); + } else if (FOLDER_LOCATION_REPLAY.matches(formattedString)) { + Map matchMap = FOLDER_LOCATION_REPLAY.match(formattedString); + return ofFolderLocationReplayName( + matchMap.get("folder"), matchMap.get("location"), matchMap.get("replay")); + } else if (ORGANIZATION_LOCATION_REPLAY.matches(formattedString)) { + Map matchMap = ORGANIZATION_LOCATION_REPLAY.match(formattedString); + return ofOrganizationLocationReplayName( + matchMap.get("organization"), matchMap.get("location"), matchMap.get("replay")); + } + throw new ValidationException("ReplayName.parse: formattedString not in valid format"); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (ReplayName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_REPLAY.matches(formattedString) + || FOLDER_LOCATION_REPLAY.matches(formattedString) + || ORGANIZATION_LOCATION_REPLAY.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (replay != null) { + fieldMapBuilder.put("replay", replay); + } + if (folder != null) { + fieldMapBuilder.put("folder", folder); + } + if (organization != null) { + fieldMapBuilder.put("organization", organization); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ReplayName that = ((ReplayName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.replay, that.replay) + && Objects.equals(this.folder, that.folder) + && Objects.equals(this.organization, that.organization); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(replay); + h *= 1000003; + h ^= Objects.hashCode(folder); + h *= 1000003; + h ^= Objects.hashCode(organization); + return h; + } + + /** Builder for projects/{project}/locations/{location}/replays/{replay}. */ + public static class Builder { + private String project; + private String location; + private String replay; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getReplay() { + return replay; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setReplay(String replay) { + this.replay = replay; + return this; + } + + private Builder(ReplayName replayName) { + Preconditions.checkArgument( + Objects.equals(replayName.pathTemplate, PROJECT_LOCATION_REPLAY), + "toBuilder is only supported when ReplayName has the pattern of projects/{project}/locations/{location}/replays/{replay}"); + this.project = replayName.project; + this.location = replayName.location; + this.replay = replayName.replay; + } + + public ReplayName build() { + return new ReplayName(this); + } + } + + /** Builder for folders/{folder}/locations/{location}/replays/{replay}. */ + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static class FolderLocationReplayBuilder { + private String folder; + private String location; + private String replay; + + protected FolderLocationReplayBuilder() {} + + public String getFolder() { + return folder; + } + + public String getLocation() { + return location; + } + + public String getReplay() { + return replay; + } + + public FolderLocationReplayBuilder setFolder(String folder) { + this.folder = folder; + return this; + } + + public FolderLocationReplayBuilder setLocation(String location) { + this.location = location; + return this; + } + + public FolderLocationReplayBuilder setReplay(String replay) { + this.replay = replay; + return this; + } + + public ReplayName build() { + return new ReplayName(this); + } + } + + /** Builder for organizations/{organization}/locations/{location}/replays/{replay}. */ + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static class OrganizationLocationReplayBuilder { + private String organization; + private String location; + private String replay; + + protected OrganizationLocationReplayBuilder() {} + + public String getOrganization() { + return organization; + } + + public String getLocation() { + return location; + } + + public String getReplay() { + return replay; + } + + public OrganizationLocationReplayBuilder setOrganization(String organization) { + this.organization = organization; + return this; + } + + public OrganizationLocationReplayBuilder setLocation(String location) { + this.location = location; + return this; + } + + public OrganizationLocationReplayBuilder setReplay(String replay) { + this.replay = replay; + return this; + } + + public ReplayName build() { + return new ReplayName(this); + } + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayOperationMetadata.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayOperationMetadata.java new file mode 100644 index 000000000000..7a1d1d6f3306 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayOperationMetadata.java @@ -0,0 +1,698 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * Metadata about a Replay operation.
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ReplayOperationMetadata} + */ +public final class ReplayOperationMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.ReplayOperationMetadata) + ReplayOperationMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReplayOperationMetadata.newBuilder() to construct. + private ReplayOperationMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReplayOperationMetadata() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReplayOperationMetadata(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ReplayOperationMetadata.class, + com.google.cloud.policysimulator.v1.ReplayOperationMetadata.Builder.class); + } + + public static final int START_TIME_FIELD_NUMBER = 1; + private com.google.protobuf.Timestamp startTime_; + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return Whether the startTime field is set. + */ + @java.lang.Override + public boolean hasStartTime() { + return startTime_ != null; + } + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return The startTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getStartTime() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + + 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 (startTime_ != null) { + output.writeMessage(1, getStartTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (startTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getStartTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.ReplayOperationMetadata)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.ReplayOperationMetadata other = + (com.google.cloud.policysimulator.v1.ReplayOperationMetadata) obj; + + if (hasStartTime() != other.hasStartTime()) return false; + if (hasStartTime()) { + if (!getStartTime().equals(other.getStartTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasStartTime()) { + hash = (37 * hash) + START_TIME_FIELD_NUMBER; + hash = (53 * hash) + getStartTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.ReplayOperationMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayOperationMetadata 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.policysimulator.v1.ReplayOperationMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayOperationMetadata 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.policysimulator.v1.ReplayOperationMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayOperationMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.ReplayOperationMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayOperationMetadata 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.policysimulator.v1.ReplayOperationMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayOperationMetadata 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.policysimulator.v1.ReplayOperationMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayOperationMetadata 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.policysimulator.v1.ReplayOperationMetadata 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; + } + /** + * + * + *
+   * Metadata about a Replay operation.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ReplayOperationMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.ReplayOperationMetadata) + com.google.cloud.policysimulator.v1.ReplayOperationMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ReplayOperationMetadata.class, + com.google.cloud.policysimulator.v1.ReplayOperationMetadata.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.ReplayOperationMetadata.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + startTime_ = null; + if (startTimeBuilder_ != null) { + startTimeBuilder_.dispose(); + startTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayOperationMetadata getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.ReplayOperationMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayOperationMetadata build() { + com.google.cloud.policysimulator.v1.ReplayOperationMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayOperationMetadata buildPartial() { + com.google.cloud.policysimulator.v1.ReplayOperationMetadata result = + new com.google.cloud.policysimulator.v1.ReplayOperationMetadata(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.ReplayOperationMetadata result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.startTime_ = startTimeBuilder_ == null ? startTime_ : startTimeBuilder_.build(); + } + } + + @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.policysimulator.v1.ReplayOperationMetadata) { + return mergeFrom((com.google.cloud.policysimulator.v1.ReplayOperationMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.ReplayOperationMetadata other) { + if (other == com.google.cloud.policysimulator.v1.ReplayOperationMetadata.getDefaultInstance()) + return this; + if (other.hasStartTime()) { + mergeStartTime(other.getStartTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getStartTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.Timestamp startTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + startTimeBuilder_; + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + if (startTimeBuilder_ == null) { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } else { + return startTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder setStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startTime_ = value; + } else { + startTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (startTimeBuilder_ == null) { + startTime_ = builderForValue.build(); + } else { + startTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder mergeStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && startTime_ != null + && startTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getStartTimeBuilder().mergeFrom(value); + } else { + startTime_ = value; + } + } else { + startTimeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public Builder clearStartTime() { + bitField0_ = (bitField0_ & ~0x00000001); + startTime_ = null; + if (startTimeBuilder_ != null) { + startTimeBuilder_.dispose(); + startTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getStartTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + if (startTimeBuilder_ != null) { + return startTimeBuilder_.getMessageOrBuilder(); + } else { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + } + /** + * + * + *
+     * Time when the request was received.
+     * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getStartTimeFieldBuilder() { + if (startTimeBuilder_ == null) { + startTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getStartTime(), getParentForChildren(), isClean()); + startTime_ = null; + } + return startTimeBuilder_; + } + + @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.policysimulator.v1.ReplayOperationMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.ReplayOperationMetadata) + private static final com.google.cloud.policysimulator.v1.ReplayOperationMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.ReplayOperationMetadata(); + } + + public static com.google.cloud.policysimulator.v1.ReplayOperationMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReplayOperationMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayOperationMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayOperationMetadataOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayOperationMetadataOrBuilder.java new file mode 100644 index 000000000000..ffd4d7e9f98d --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayOperationMetadataOrBuilder.java @@ -0,0 +1,60 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface ReplayOperationMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.ReplayOperationMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return Whether the startTime field is set. + */ + boolean hasStartTime(); + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + * + * @return The startTime. + */ + com.google.protobuf.Timestamp getStartTime(); + /** + * + * + *
+   * Time when the request was received.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 1; + */ + com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayOrBuilder.java new file mode 100644 index 000000000000..d509087ea20b --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayOrBuilder.java @@ -0,0 +1,177 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface ReplayOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.Replay) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The resource name of the `Replay`, which has the following
+   * format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the Replay.
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The resource name of the `Replay`, which has the following
+   * format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the Replay.
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36`
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. The current state of the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * Output only. The current state of the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.cloud.policysimulator.v1.Replay.State getState(); + + /** + * + * + *
+   * Required. The configuration used for the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the config field is set. + */ + boolean hasConfig(); + /** + * + * + *
+   * Required. The configuration used for the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The config. + */ + com.google.cloud.policysimulator.v1.ReplayConfig getConfig(); + /** + * + * + *
+   * Required. The configuration used for the `Replay`.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.ReplayConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.policysimulator.v1.ReplayConfigOrBuilder getConfigOrBuilder(); + + /** + * + * + *
+   * Output only. Summary statistics about the replayed log entries.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the resultsSummary field is set. + */ + boolean hasResultsSummary(); + /** + * + * + *
+   * Output only. Summary statistics about the replayed log entries.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The resultsSummary. + */ + com.google.cloud.policysimulator.v1.Replay.ResultsSummary getResultsSummary(); + /** + * + * + *
+   * Output only. Summary statistics about the replayed log entries.
+   * 
+ * + * + * .google.cloud.policysimulator.v1.Replay.ResultsSummary results_summary = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.policysimulator.v1.Replay.ResultsSummaryOrBuilder getResultsSummaryOrBuilder(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayResult.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayResult.java new file mode 100644 index 000000000000..e9198ca2a91d --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayResult.java @@ -0,0 +1,2172 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +/** + * + * + *
+ * The result of replaying a single access tuple against a simulated state.
+ * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ReplayResult} + */ +public final class ReplayResult extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.policysimulator.v1.ReplayResult) + ReplayResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReplayResult.newBuilder() to construct. + private ReplayResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReplayResult() { + name_ = ""; + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReplayResult(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ReplayResult.class, + com.google.cloud.policysimulator.v1.ReplayResult.Builder.class); + } + + private int resultCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object result_; + + public enum ResultCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + DIFF(5), + ERROR(6), + RESULT_NOT_SET(0); + private final int value; + + private ResultCase(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 ResultCase valueOf(int value) { + return forNumber(value); + } + + public static ResultCase forNumber(int value) { + switch (value) { + case 5: + return DIFF; + case 6: + return ERROR; + case 0: + return RESULT_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ResultCase getResultCase() { + return ResultCase.forNumber(resultCase_); + } + + public static final int DIFF_FIELD_NUMBER = 5; + /** + * + * + *
+   * The difference between the principal's access under the current
+   * (baseline) policies and the principal's access under the proposed
+   * (simulated) policies.
+   *
+   * This field is only included for access tuples that were successfully
+   * replayed and had different results under the current policies and the
+   * proposed policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + * + * @return Whether the diff field is set. + */ + @java.lang.Override + public boolean hasDiff() { + return resultCase_ == 5; + } + /** + * + * + *
+   * The difference between the principal's access under the current
+   * (baseline) policies and the principal's access under the proposed
+   * (simulated) policies.
+   *
+   * This field is only included for access tuples that were successfully
+   * replayed and had different results under the current policies and the
+   * proposed policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + * + * @return The diff. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayDiff getDiff() { + if (resultCase_ == 5) { + return (com.google.cloud.policysimulator.v1.ReplayDiff) result_; + } + return com.google.cloud.policysimulator.v1.ReplayDiff.getDefaultInstance(); + } + /** + * + * + *
+   * The difference between the principal's access under the current
+   * (baseline) policies and the principal's access under the proposed
+   * (simulated) policies.
+   *
+   * This field is only included for access tuples that were successfully
+   * replayed and had different results under the current policies and the
+   * proposed policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayDiffOrBuilder getDiffOrBuilder() { + if (resultCase_ == 5) { + return (com.google.cloud.policysimulator.v1.ReplayDiff) result_; + } + return com.google.cloud.policysimulator.v1.ReplayDiff.getDefaultInstance(); + } + + public static final int ERROR_FIELD_NUMBER = 6; + /** + * + * + *
+   * The error that caused the access tuple replay to fail.
+   *
+   * This field is only included for access tuples that were not replayed
+   * successfully.
+   * 
+ * + * .google.rpc.Status error = 6; + * + * @return Whether the error field is set. + */ + @java.lang.Override + public boolean hasError() { + return resultCase_ == 6; + } + /** + * + * + *
+   * The error that caused the access tuple replay to fail.
+   *
+   * This field is only included for access tuples that were not replayed
+   * successfully.
+   * 
+ * + * .google.rpc.Status error = 6; + * + * @return The error. + */ + @java.lang.Override + public com.google.rpc.Status getError() { + if (resultCase_ == 6) { + return (com.google.rpc.Status) result_; + } + return com.google.rpc.Status.getDefaultInstance(); + } + /** + * + * + *
+   * The error that caused the access tuple replay to fail.
+   *
+   * This field is only included for access tuples that were not replayed
+   * successfully.
+   * 
+ * + * .google.rpc.Status error = 6; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getErrorOrBuilder() { + if (resultCase_ == 6) { + return (com.google.rpc.Status) result_; + } + return com.google.rpc.Status.getDefaultInstance(); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * The resource name of the `ReplayResult`, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the [Replay][google.cloud.policysimulator.v1.Replay].
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The resource name of the `ReplayResult`, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the [Replay][google.cloud.policysimulator.v1.Replay].
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARENT_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple
+   * was included in.
+   * 
+ * + * string parent = 2 [(.google.api.resource_reference) = { ... } + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple
+   * was included in.
+   * 
+ * + * string parent = 2 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ACCESS_TUPLE_FIELD_NUMBER = 3; + private com.google.cloud.policysimulator.v1.AccessTuple accessTuple_; + /** + * + * + *
+   * The access tuple that was replayed. This field includes information about
+   * the principal, resource, and permission that were involved in the access
+   * attempt.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + * + * @return Whether the accessTuple field is set. + */ + @java.lang.Override + public boolean hasAccessTuple() { + return accessTuple_ != null; + } + /** + * + * + *
+   * The access tuple that was replayed. This field includes information about
+   * the principal, resource, and permission that were involved in the access
+   * attempt.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + * + * @return The accessTuple. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessTuple getAccessTuple() { + return accessTuple_ == null + ? com.google.cloud.policysimulator.v1.AccessTuple.getDefaultInstance() + : accessTuple_; + } + /** + * + * + *
+   * The access tuple that was replayed. This field includes information about
+   * the principal, resource, and permission that were involved in the access
+   * attempt.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.AccessTupleOrBuilder getAccessTupleOrBuilder() { + return accessTuple_ == null + ? com.google.cloud.policysimulator.v1.AccessTuple.getDefaultInstance() + : accessTuple_; + } + + public static final int LAST_SEEN_DATE_FIELD_NUMBER = 4; + private com.google.type.Date lastSeenDate_; + /** + * + * + *
+   * The latest date this access tuple was seen in the logs.
+   * 
+ * + * .google.type.Date last_seen_date = 4; + * + * @return Whether the lastSeenDate field is set. + */ + @java.lang.Override + public boolean hasLastSeenDate() { + return lastSeenDate_ != null; + } + /** + * + * + *
+   * The latest date this access tuple was seen in the logs.
+   * 
+ * + * .google.type.Date last_seen_date = 4; + * + * @return The lastSeenDate. + */ + @java.lang.Override + public com.google.type.Date getLastSeenDate() { + return lastSeenDate_ == null ? com.google.type.Date.getDefaultInstance() : lastSeenDate_; + } + /** + * + * + *
+   * The latest date this access tuple was seen in the logs.
+   * 
+ * + * .google.type.Date last_seen_date = 4; + */ + @java.lang.Override + public com.google.type.DateOrBuilder getLastSeenDateOrBuilder() { + return lastSeenDate_ == null ? com.google.type.Date.getDefaultInstance() : lastSeenDate_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, parent_); + } + if (accessTuple_ != null) { + output.writeMessage(3, getAccessTuple()); + } + if (lastSeenDate_ != null) { + output.writeMessage(4, getLastSeenDate()); + } + if (resultCase_ == 5) { + output.writeMessage(5, (com.google.cloud.policysimulator.v1.ReplayDiff) result_); + } + if (resultCase_ == 6) { + output.writeMessage(6, (com.google.rpc.Status) result_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, parent_); + } + if (accessTuple_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getAccessTuple()); + } + if (lastSeenDate_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getLastSeenDate()); + } + if (resultCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.cloud.policysimulator.v1.ReplayDiff) result_); + } + if (resultCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.rpc.Status) result_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.policysimulator.v1.ReplayResult)) { + return super.equals(obj); + } + com.google.cloud.policysimulator.v1.ReplayResult other = + (com.google.cloud.policysimulator.v1.ReplayResult) obj; + + if (!getName().equals(other.getName())) return false; + if (!getParent().equals(other.getParent())) return false; + if (hasAccessTuple() != other.hasAccessTuple()) return false; + if (hasAccessTuple()) { + if (!getAccessTuple().equals(other.getAccessTuple())) return false; + } + if (hasLastSeenDate() != other.hasLastSeenDate()) return false; + if (hasLastSeenDate()) { + if (!getLastSeenDate().equals(other.getLastSeenDate())) return false; + } + if (!getResultCase().equals(other.getResultCase())) return false; + switch (resultCase_) { + case 5: + if (!getDiff().equals(other.getDiff())) return false; + break; + case 6: + if (!getError().equals(other.getError())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasAccessTuple()) { + hash = (37 * hash) + ACCESS_TUPLE_FIELD_NUMBER; + hash = (53 * hash) + getAccessTuple().hashCode(); + } + if (hasLastSeenDate()) { + hash = (37 * hash) + LAST_SEEN_DATE_FIELD_NUMBER; + hash = (53 * hash) + getLastSeenDate().hashCode(); + } + switch (resultCase_) { + case 5: + hash = (37 * hash) + DIFF_FIELD_NUMBER; + hash = (53 * hash) + getDiff().hashCode(); + break; + case 6: + hash = (37 * hash) + ERROR_FIELD_NUMBER; + hash = (53 * hash) + getError().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.policysimulator.v1.ReplayResult parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayResult 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.policysimulator.v1.ReplayResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayResult 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.policysimulator.v1.ReplayResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.policysimulator.v1.ReplayResult parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.policysimulator.v1.ReplayResult parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayResult 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.policysimulator.v1.ReplayResult parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayResult 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.policysimulator.v1.ReplayResult parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.policysimulator.v1.ReplayResult 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.policysimulator.v1.ReplayResult prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The result of replaying a single access tuple against a simulated state.
+   * 
+ * + * Protobuf type {@code google.cloud.policysimulator.v1.ReplayResult} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.policysimulator.v1.ReplayResult) + com.google.cloud.policysimulator.v1.ReplayResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.policysimulator.v1.ReplayResult.class, + com.google.cloud.policysimulator.v1.ReplayResult.Builder.class); + } + + // Construct using com.google.cloud.policysimulator.v1.ReplayResult.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (diffBuilder_ != null) { + diffBuilder_.clear(); + } + if (errorBuilder_ != null) { + errorBuilder_.clear(); + } + name_ = ""; + parent_ = ""; + accessTuple_ = null; + if (accessTupleBuilder_ != null) { + accessTupleBuilder_.dispose(); + accessTupleBuilder_ = null; + } + lastSeenDate_ = null; + if (lastSeenDateBuilder_ != null) { + lastSeenDateBuilder_.dispose(); + lastSeenDateBuilder_ = null; + } + resultCase_ = 0; + result_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.policysimulator.v1.SimulatorProto + .internal_static_google_cloud_policysimulator_v1_ReplayResult_descriptor; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayResult getDefaultInstanceForType() { + return com.google.cloud.policysimulator.v1.ReplayResult.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayResult build() { + com.google.cloud.policysimulator.v1.ReplayResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayResult buildPartial() { + com.google.cloud.policysimulator.v1.ReplayResult result = + new com.google.cloud.policysimulator.v1.ReplayResult(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.policysimulator.v1.ReplayResult result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.accessTuple_ = + accessTupleBuilder_ == null ? accessTuple_ : accessTupleBuilder_.build(); + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.lastSeenDate_ = + lastSeenDateBuilder_ == null ? lastSeenDate_ : lastSeenDateBuilder_.build(); + } + } + + private void buildPartialOneofs(com.google.cloud.policysimulator.v1.ReplayResult result) { + result.resultCase_ = resultCase_; + result.result_ = this.result_; + if (resultCase_ == 5 && diffBuilder_ != null) { + result.result_ = diffBuilder_.build(); + } + if (resultCase_ == 6 && errorBuilder_ != null) { + result.result_ = errorBuilder_.build(); + } + } + + @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.policysimulator.v1.ReplayResult) { + return mergeFrom((com.google.cloud.policysimulator.v1.ReplayResult) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.policysimulator.v1.ReplayResult other) { + if (other == com.google.cloud.policysimulator.v1.ReplayResult.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (other.hasAccessTuple()) { + mergeAccessTuple(other.getAccessTuple()); + } + if (other.hasLastSeenDate()) { + mergeLastSeenDate(other.getLastSeenDate()); + } + switch (other.getResultCase()) { + case DIFF: + { + mergeDiff(other.getDiff()); + break; + } + case ERROR: + { + mergeError(other.getError()); + break; + } + case RESULT_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 10 + case 18: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 18 + case 26: + { + input.readMessage(getAccessTupleFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 26 + case 34: + { + input.readMessage(getLastSeenDateFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 34 + case 42: + { + input.readMessage(getDiffFieldBuilder().getBuilder(), extensionRegistry); + resultCase_ = 5; + break; + } // case 42 + case 50: + { + input.readMessage(getErrorFieldBuilder().getBuilder(), extensionRegistry); + resultCase_ = 6; + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int resultCase_ = 0; + private java.lang.Object result_; + + public ResultCase getResultCase() { + return ResultCase.forNumber(resultCase_); + } + + public Builder clearResult() { + resultCase_ = 0; + result_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ReplayDiff, + com.google.cloud.policysimulator.v1.ReplayDiff.Builder, + com.google.cloud.policysimulator.v1.ReplayDiffOrBuilder> + diffBuilder_; + /** + * + * + *
+     * The difference between the principal's access under the current
+     * (baseline) policies and the principal's access under the proposed
+     * (simulated) policies.
+     *
+     * This field is only included for access tuples that were successfully
+     * replayed and had different results under the current policies and the
+     * proposed policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + * + * @return Whether the diff field is set. + */ + @java.lang.Override + public boolean hasDiff() { + return resultCase_ == 5; + } + /** + * + * + *
+     * The difference between the principal's access under the current
+     * (baseline) policies and the principal's access under the proposed
+     * (simulated) policies.
+     *
+     * This field is only included for access tuples that were successfully
+     * replayed and had different results under the current policies and the
+     * proposed policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + * + * @return The diff. + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayDiff getDiff() { + if (diffBuilder_ == null) { + if (resultCase_ == 5) { + return (com.google.cloud.policysimulator.v1.ReplayDiff) result_; + } + return com.google.cloud.policysimulator.v1.ReplayDiff.getDefaultInstance(); + } else { + if (resultCase_ == 5) { + return diffBuilder_.getMessage(); + } + return com.google.cloud.policysimulator.v1.ReplayDiff.getDefaultInstance(); + } + } + /** + * + * + *
+     * The difference between the principal's access under the current
+     * (baseline) policies and the principal's access under the proposed
+     * (simulated) policies.
+     *
+     * This field is only included for access tuples that were successfully
+     * replayed and had different results under the current policies and the
+     * proposed policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + */ + public Builder setDiff(com.google.cloud.policysimulator.v1.ReplayDiff value) { + if (diffBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + result_ = value; + onChanged(); + } else { + diffBuilder_.setMessage(value); + } + resultCase_ = 5; + return this; + } + /** + * + * + *
+     * The difference between the principal's access under the current
+     * (baseline) policies and the principal's access under the proposed
+     * (simulated) policies.
+     *
+     * This field is only included for access tuples that were successfully
+     * replayed and had different results under the current policies and the
+     * proposed policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + */ + public Builder setDiff(com.google.cloud.policysimulator.v1.ReplayDiff.Builder builderForValue) { + if (diffBuilder_ == null) { + result_ = builderForValue.build(); + onChanged(); + } else { + diffBuilder_.setMessage(builderForValue.build()); + } + resultCase_ = 5; + return this; + } + /** + * + * + *
+     * The difference between the principal's access under the current
+     * (baseline) policies and the principal's access under the proposed
+     * (simulated) policies.
+     *
+     * This field is only included for access tuples that were successfully
+     * replayed and had different results under the current policies and the
+     * proposed policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + */ + public Builder mergeDiff(com.google.cloud.policysimulator.v1.ReplayDiff value) { + if (diffBuilder_ == null) { + if (resultCase_ == 5 + && result_ != com.google.cloud.policysimulator.v1.ReplayDiff.getDefaultInstance()) { + result_ = + com.google.cloud.policysimulator.v1.ReplayDiff.newBuilder( + (com.google.cloud.policysimulator.v1.ReplayDiff) result_) + .mergeFrom(value) + .buildPartial(); + } else { + result_ = value; + } + onChanged(); + } else { + if (resultCase_ == 5) { + diffBuilder_.mergeFrom(value); + } else { + diffBuilder_.setMessage(value); + } + } + resultCase_ = 5; + return this; + } + /** + * + * + *
+     * The difference between the principal's access under the current
+     * (baseline) policies and the principal's access under the proposed
+     * (simulated) policies.
+     *
+     * This field is only included for access tuples that were successfully
+     * replayed and had different results under the current policies and the
+     * proposed policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + */ + public Builder clearDiff() { + if (diffBuilder_ == null) { + if (resultCase_ == 5) { + resultCase_ = 0; + result_ = null; + onChanged(); + } + } else { + if (resultCase_ == 5) { + resultCase_ = 0; + result_ = null; + } + diffBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The difference between the principal's access under the current
+     * (baseline) policies and the principal's access under the proposed
+     * (simulated) policies.
+     *
+     * This field is only included for access tuples that were successfully
+     * replayed and had different results under the current policies and the
+     * proposed policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + */ + public com.google.cloud.policysimulator.v1.ReplayDiff.Builder getDiffBuilder() { + return getDiffFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The difference between the principal's access under the current
+     * (baseline) policies and the principal's access under the proposed
+     * (simulated) policies.
+     *
+     * This field is only included for access tuples that were successfully
+     * replayed and had different results under the current policies and the
+     * proposed policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + */ + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayDiffOrBuilder getDiffOrBuilder() { + if ((resultCase_ == 5) && (diffBuilder_ != null)) { + return diffBuilder_.getMessageOrBuilder(); + } else { + if (resultCase_ == 5) { + return (com.google.cloud.policysimulator.v1.ReplayDiff) result_; + } + return com.google.cloud.policysimulator.v1.ReplayDiff.getDefaultInstance(); + } + } + /** + * + * + *
+     * The difference between the principal's access under the current
+     * (baseline) policies and the principal's access under the proposed
+     * (simulated) policies.
+     *
+     * This field is only included for access tuples that were successfully
+     * replayed and had different results under the current policies and the
+     * proposed policies.
+     * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ReplayDiff, + com.google.cloud.policysimulator.v1.ReplayDiff.Builder, + com.google.cloud.policysimulator.v1.ReplayDiffOrBuilder> + getDiffFieldBuilder() { + if (diffBuilder_ == null) { + if (!(resultCase_ == 5)) { + result_ = com.google.cloud.policysimulator.v1.ReplayDiff.getDefaultInstance(); + } + diffBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.ReplayDiff, + com.google.cloud.policysimulator.v1.ReplayDiff.Builder, + com.google.cloud.policysimulator.v1.ReplayDiffOrBuilder>( + (com.google.cloud.policysimulator.v1.ReplayDiff) result_, + getParentForChildren(), + isClean()); + result_ = null; + } + resultCase_ = 5; + onChanged(); + return diffBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + errorBuilder_; + /** + * + * + *
+     * The error that caused the access tuple replay to fail.
+     *
+     * This field is only included for access tuples that were not replayed
+     * successfully.
+     * 
+ * + * .google.rpc.Status error = 6; + * + * @return Whether the error field is set. + */ + @java.lang.Override + public boolean hasError() { + return resultCase_ == 6; + } + /** + * + * + *
+     * The error that caused the access tuple replay to fail.
+     *
+     * This field is only included for access tuples that were not replayed
+     * successfully.
+     * 
+ * + * .google.rpc.Status error = 6; + * + * @return The error. + */ + @java.lang.Override + public com.google.rpc.Status getError() { + if (errorBuilder_ == null) { + if (resultCase_ == 6) { + return (com.google.rpc.Status) result_; + } + return com.google.rpc.Status.getDefaultInstance(); + } else { + if (resultCase_ == 6) { + return errorBuilder_.getMessage(); + } + return com.google.rpc.Status.getDefaultInstance(); + } + } + /** + * + * + *
+     * The error that caused the access tuple replay to fail.
+     *
+     * This field is only included for access tuples that were not replayed
+     * successfully.
+     * 
+ * + * .google.rpc.Status error = 6; + */ + public Builder setError(com.google.rpc.Status value) { + if (errorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + result_ = value; + onChanged(); + } else { + errorBuilder_.setMessage(value); + } + resultCase_ = 6; + return this; + } + /** + * + * + *
+     * The error that caused the access tuple replay to fail.
+     *
+     * This field is only included for access tuples that were not replayed
+     * successfully.
+     * 
+ * + * .google.rpc.Status error = 6; + */ + public Builder setError(com.google.rpc.Status.Builder builderForValue) { + if (errorBuilder_ == null) { + result_ = builderForValue.build(); + onChanged(); + } else { + errorBuilder_.setMessage(builderForValue.build()); + } + resultCase_ = 6; + return this; + } + /** + * + * + *
+     * The error that caused the access tuple replay to fail.
+     *
+     * This field is only included for access tuples that were not replayed
+     * successfully.
+     * 
+ * + * .google.rpc.Status error = 6; + */ + public Builder mergeError(com.google.rpc.Status value) { + if (errorBuilder_ == null) { + if (resultCase_ == 6 && result_ != com.google.rpc.Status.getDefaultInstance()) { + result_ = + com.google.rpc.Status.newBuilder((com.google.rpc.Status) result_) + .mergeFrom(value) + .buildPartial(); + } else { + result_ = value; + } + onChanged(); + } else { + if (resultCase_ == 6) { + errorBuilder_.mergeFrom(value); + } else { + errorBuilder_.setMessage(value); + } + } + resultCase_ = 6; + return this; + } + /** + * + * + *
+     * The error that caused the access tuple replay to fail.
+     *
+     * This field is only included for access tuples that were not replayed
+     * successfully.
+     * 
+ * + * .google.rpc.Status error = 6; + */ + public Builder clearError() { + if (errorBuilder_ == null) { + if (resultCase_ == 6) { + resultCase_ = 0; + result_ = null; + onChanged(); + } + } else { + if (resultCase_ == 6) { + resultCase_ = 0; + result_ = null; + } + errorBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The error that caused the access tuple replay to fail.
+     *
+     * This field is only included for access tuples that were not replayed
+     * successfully.
+     * 
+ * + * .google.rpc.Status error = 6; + */ + public com.google.rpc.Status.Builder getErrorBuilder() { + return getErrorFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The error that caused the access tuple replay to fail.
+     *
+     * This field is only included for access tuples that were not replayed
+     * successfully.
+     * 
+ * + * .google.rpc.Status error = 6; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getErrorOrBuilder() { + if ((resultCase_ == 6) && (errorBuilder_ != null)) { + return errorBuilder_.getMessageOrBuilder(); + } else { + if (resultCase_ == 6) { + return (com.google.rpc.Status) result_; + } + return com.google.rpc.Status.getDefaultInstance(); + } + } + /** + * + * + *
+     * The error that caused the access tuple replay to fail.
+     *
+     * This field is only included for access tuples that were not replayed
+     * successfully.
+     * 
+ * + * .google.rpc.Status error = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getErrorFieldBuilder() { + if (errorBuilder_ == null) { + if (!(resultCase_ == 6)) { + result_ = com.google.rpc.Status.getDefaultInstance(); + } + errorBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>( + (com.google.rpc.Status) result_, getParentForChildren(), isClean()); + result_ = null; + } + resultCase_ = 6; + onChanged(); + return errorBuilder_; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The resource name of the `ReplayResult`, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the [Replay][google.cloud.policysimulator.v1.Replay].
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource name of the `ReplayResult`, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the [Replay][google.cloud.policysimulator.v1.Replay].
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource name of the `ReplayResult`, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the [Replay][google.cloud.policysimulator.v1.Replay].
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
+     * 
+ * + * string name = 1; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name of the `ReplayResult`, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the [Replay][google.cloud.policysimulator.v1.Replay].
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name of the `ReplayResult`, in the following format:
+     *
+     * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`,
+     * where `{resource-id}` is the ID of the project, folder, or organization
+     * that owns the [Replay][google.cloud.policysimulator.v1.Replay].
+     *
+     * Example:
+     * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
+     * 
+ * + * string name = 1; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple
+     * was included in.
+     * 
+ * + * string parent = 2 [(.google.api.resource_reference) = { ... } + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple
+     * was included in.
+     * 
+ * + * string parent = 2 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple
+     * was included in.
+     * 
+ * + * string parent = 2 [(.google.api.resource_reference) = { ... } + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple
+     * was included in.
+     * 
+ * + * string parent = 2 [(.google.api.resource_reference) = { ... } + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * + * + *
+     * The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple
+     * was included in.
+     * 
+ * + * string parent = 2 [(.google.api.resource_reference) = { ... } + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private com.google.cloud.policysimulator.v1.AccessTuple accessTuple_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.AccessTuple, + com.google.cloud.policysimulator.v1.AccessTuple.Builder, + com.google.cloud.policysimulator.v1.AccessTupleOrBuilder> + accessTupleBuilder_; + /** + * + * + *
+     * The access tuple that was replayed. This field includes information about
+     * the principal, resource, and permission that were involved in the access
+     * attempt.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + * + * @return Whether the accessTuple field is set. + */ + public boolean hasAccessTuple() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + * + * + *
+     * The access tuple that was replayed. This field includes information about
+     * the principal, resource, and permission that were involved in the access
+     * attempt.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + * + * @return The accessTuple. + */ + public com.google.cloud.policysimulator.v1.AccessTuple getAccessTuple() { + if (accessTupleBuilder_ == null) { + return accessTuple_ == null + ? com.google.cloud.policysimulator.v1.AccessTuple.getDefaultInstance() + : accessTuple_; + } else { + return accessTupleBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The access tuple that was replayed. This field includes information about
+     * the principal, resource, and permission that were involved in the access
+     * attempt.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + */ + public Builder setAccessTuple(com.google.cloud.policysimulator.v1.AccessTuple value) { + if (accessTupleBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + accessTuple_ = value; + } else { + accessTupleBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * The access tuple that was replayed. This field includes information about
+     * the principal, resource, and permission that were involved in the access
+     * attempt.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + */ + public Builder setAccessTuple( + com.google.cloud.policysimulator.v1.AccessTuple.Builder builderForValue) { + if (accessTupleBuilder_ == null) { + accessTuple_ = builderForValue.build(); + } else { + accessTupleBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * The access tuple that was replayed. This field includes information about
+     * the principal, resource, and permission that were involved in the access
+     * attempt.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + */ + public Builder mergeAccessTuple(com.google.cloud.policysimulator.v1.AccessTuple value) { + if (accessTupleBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) + && accessTuple_ != null + && accessTuple_ + != com.google.cloud.policysimulator.v1.AccessTuple.getDefaultInstance()) { + getAccessTupleBuilder().mergeFrom(value); + } else { + accessTuple_ = value; + } + } else { + accessTupleBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * The access tuple that was replayed. This field includes information about
+     * the principal, resource, and permission that were involved in the access
+     * attempt.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + */ + public Builder clearAccessTuple() { + bitField0_ = (bitField0_ & ~0x00000010); + accessTuple_ = null; + if (accessTupleBuilder_ != null) { + accessTupleBuilder_.dispose(); + accessTupleBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The access tuple that was replayed. This field includes information about
+     * the principal, resource, and permission that were involved in the access
+     * attempt.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + */ + public com.google.cloud.policysimulator.v1.AccessTuple.Builder getAccessTupleBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return getAccessTupleFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The access tuple that was replayed. This field includes information about
+     * the principal, resource, and permission that were involved in the access
+     * attempt.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + */ + public com.google.cloud.policysimulator.v1.AccessTupleOrBuilder getAccessTupleOrBuilder() { + if (accessTupleBuilder_ != null) { + return accessTupleBuilder_.getMessageOrBuilder(); + } else { + return accessTuple_ == null + ? com.google.cloud.policysimulator.v1.AccessTuple.getDefaultInstance() + : accessTuple_; + } + } + /** + * + * + *
+     * The access tuple that was replayed. This field includes information about
+     * the principal, resource, and permission that were involved in the access
+     * attempt.
+     * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.AccessTuple, + com.google.cloud.policysimulator.v1.AccessTuple.Builder, + com.google.cloud.policysimulator.v1.AccessTupleOrBuilder> + getAccessTupleFieldBuilder() { + if (accessTupleBuilder_ == null) { + accessTupleBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.policysimulator.v1.AccessTuple, + com.google.cloud.policysimulator.v1.AccessTuple.Builder, + com.google.cloud.policysimulator.v1.AccessTupleOrBuilder>( + getAccessTuple(), getParentForChildren(), isClean()); + accessTuple_ = null; + } + return accessTupleBuilder_; + } + + private com.google.type.Date lastSeenDate_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Date, com.google.type.Date.Builder, com.google.type.DateOrBuilder> + lastSeenDateBuilder_; + /** + * + * + *
+     * The latest date this access tuple was seen in the logs.
+     * 
+ * + * .google.type.Date last_seen_date = 4; + * + * @return Whether the lastSeenDate field is set. + */ + public boolean hasLastSeenDate() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + * + * + *
+     * The latest date this access tuple was seen in the logs.
+     * 
+ * + * .google.type.Date last_seen_date = 4; + * + * @return The lastSeenDate. + */ + public com.google.type.Date getLastSeenDate() { + if (lastSeenDateBuilder_ == null) { + return lastSeenDate_ == null ? com.google.type.Date.getDefaultInstance() : lastSeenDate_; + } else { + return lastSeenDateBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The latest date this access tuple was seen in the logs.
+     * 
+ * + * .google.type.Date last_seen_date = 4; + */ + public Builder setLastSeenDate(com.google.type.Date value) { + if (lastSeenDateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + lastSeenDate_ = value; + } else { + lastSeenDateBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * The latest date this access tuple was seen in the logs.
+     * 
+ * + * .google.type.Date last_seen_date = 4; + */ + public Builder setLastSeenDate(com.google.type.Date.Builder builderForValue) { + if (lastSeenDateBuilder_ == null) { + lastSeenDate_ = builderForValue.build(); + } else { + lastSeenDateBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * The latest date this access tuple was seen in the logs.
+     * 
+ * + * .google.type.Date last_seen_date = 4; + */ + public Builder mergeLastSeenDate(com.google.type.Date value) { + if (lastSeenDateBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && lastSeenDate_ != null + && lastSeenDate_ != com.google.type.Date.getDefaultInstance()) { + getLastSeenDateBuilder().mergeFrom(value); + } else { + lastSeenDate_ = value; + } + } else { + lastSeenDateBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * The latest date this access tuple was seen in the logs.
+     * 
+ * + * .google.type.Date last_seen_date = 4; + */ + public Builder clearLastSeenDate() { + bitField0_ = (bitField0_ & ~0x00000020); + lastSeenDate_ = null; + if (lastSeenDateBuilder_ != null) { + lastSeenDateBuilder_.dispose(); + lastSeenDateBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The latest date this access tuple was seen in the logs.
+     * 
+ * + * .google.type.Date last_seen_date = 4; + */ + public com.google.type.Date.Builder getLastSeenDateBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return getLastSeenDateFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The latest date this access tuple was seen in the logs.
+     * 
+ * + * .google.type.Date last_seen_date = 4; + */ + public com.google.type.DateOrBuilder getLastSeenDateOrBuilder() { + if (lastSeenDateBuilder_ != null) { + return lastSeenDateBuilder_.getMessageOrBuilder(); + } else { + return lastSeenDate_ == null ? com.google.type.Date.getDefaultInstance() : lastSeenDate_; + } + } + /** + * + * + *
+     * The latest date this access tuple was seen in the logs.
+     * 
+ * + * .google.type.Date last_seen_date = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Date, com.google.type.Date.Builder, com.google.type.DateOrBuilder> + getLastSeenDateFieldBuilder() { + if (lastSeenDateBuilder_ == null) { + lastSeenDateBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Date, com.google.type.Date.Builder, com.google.type.DateOrBuilder>( + getLastSeenDate(), getParentForChildren(), isClean()); + lastSeenDate_ = null; + } + return lastSeenDateBuilder_; + } + + @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.policysimulator.v1.ReplayResult) + } + + // @@protoc_insertion_point(class_scope:google.cloud.policysimulator.v1.ReplayResult) + private static final com.google.cloud.policysimulator.v1.ReplayResult DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.policysimulator.v1.ReplayResult(); + } + + public static com.google.cloud.policysimulator.v1.ReplayResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReplayResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.policysimulator.v1.ReplayResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayResultOrBuilder.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayResultOrBuilder.java new file mode 100644 index 000000000000..a4987ea8744e --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/ReplayResultOrBuilder.java @@ -0,0 +1,266 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public interface ReplayResultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.policysimulator.v1.ReplayResult) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The difference between the principal's access under the current
+   * (baseline) policies and the principal's access under the proposed
+   * (simulated) policies.
+   *
+   * This field is only included for access tuples that were successfully
+   * replayed and had different results under the current policies and the
+   * proposed policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + * + * @return Whether the diff field is set. + */ + boolean hasDiff(); + /** + * + * + *
+   * The difference between the principal's access under the current
+   * (baseline) policies and the principal's access under the proposed
+   * (simulated) policies.
+   *
+   * This field is only included for access tuples that were successfully
+   * replayed and had different results under the current policies and the
+   * proposed policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + * + * @return The diff. + */ + com.google.cloud.policysimulator.v1.ReplayDiff getDiff(); + /** + * + * + *
+   * The difference between the principal's access under the current
+   * (baseline) policies and the principal's access under the proposed
+   * (simulated) policies.
+   *
+   * This field is only included for access tuples that were successfully
+   * replayed and had different results under the current policies and the
+   * proposed policies.
+   * 
+ * + * .google.cloud.policysimulator.v1.ReplayDiff diff = 5; + */ + com.google.cloud.policysimulator.v1.ReplayDiffOrBuilder getDiffOrBuilder(); + + /** + * + * + *
+   * The error that caused the access tuple replay to fail.
+   *
+   * This field is only included for access tuples that were not replayed
+   * successfully.
+   * 
+ * + * .google.rpc.Status error = 6; + * + * @return Whether the error field is set. + */ + boolean hasError(); + /** + * + * + *
+   * The error that caused the access tuple replay to fail.
+   *
+   * This field is only included for access tuples that were not replayed
+   * successfully.
+   * 
+ * + * .google.rpc.Status error = 6; + * + * @return The error. + */ + com.google.rpc.Status getError(); + /** + * + * + *
+   * The error that caused the access tuple replay to fail.
+   *
+   * This field is only included for access tuples that were not replayed
+   * successfully.
+   * 
+ * + * .google.rpc.Status error = 6; + */ + com.google.rpc.StatusOrBuilder getErrorOrBuilder(); + + /** + * + * + *
+   * The resource name of the `ReplayResult`, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the [Replay][google.cloud.policysimulator.v1.Replay].
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The resource name of the `ReplayResult`, in the following format:
+   *
+   * `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`,
+   * where `{resource-id}` is the ID of the project, folder, or organization
+   * that owns the [Replay][google.cloud.policysimulator.v1.Replay].
+   *
+   * Example:
+   * `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234`
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple
+   * was included in.
+   * 
+ * + * string parent = 2 [(.google.api.resource_reference) = { ... } + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple
+   * was included in.
+   * 
+ * + * string parent = 2 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The access tuple that was replayed. This field includes information about
+   * the principal, resource, and permission that were involved in the access
+   * attempt.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + * + * @return Whether the accessTuple field is set. + */ + boolean hasAccessTuple(); + /** + * + * + *
+   * The access tuple that was replayed. This field includes information about
+   * the principal, resource, and permission that were involved in the access
+   * attempt.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + * + * @return The accessTuple. + */ + com.google.cloud.policysimulator.v1.AccessTuple getAccessTuple(); + /** + * + * + *
+   * The access tuple that was replayed. This field includes information about
+   * the principal, resource, and permission that were involved in the access
+   * attempt.
+   * 
+ * + * .google.cloud.policysimulator.v1.AccessTuple access_tuple = 3; + */ + com.google.cloud.policysimulator.v1.AccessTupleOrBuilder getAccessTupleOrBuilder(); + + /** + * + * + *
+   * The latest date this access tuple was seen in the logs.
+   * 
+ * + * .google.type.Date last_seen_date = 4; + * + * @return Whether the lastSeenDate field is set. + */ + boolean hasLastSeenDate(); + /** + * + * + *
+   * The latest date this access tuple was seen in the logs.
+   * 
+ * + * .google.type.Date last_seen_date = 4; + * + * @return The lastSeenDate. + */ + com.google.type.Date getLastSeenDate(); + /** + * + * + *
+   * The latest date this access tuple was seen in the logs.
+   * 
+ * + * .google.type.Date last_seen_date = 4; + */ + com.google.type.DateOrBuilder getLastSeenDateOrBuilder(); + + com.google.cloud.policysimulator.v1.ReplayResult.ResultCase getResultCase(); +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/SimulatorProto.java b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/SimulatorProto.java new file mode 100644 index 000000000000..a2e24ee288b9 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/java/com/google/cloud/policysimulator/v1/SimulatorProto.java @@ -0,0 +1,356 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See 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/policysimulator/v1/simulator.proto + +package com.google.cloud.policysimulator.v1; + +public final class SimulatorProto { + private SimulatorProto() {} + + 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_policysimulator_v1_Replay_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_Replay_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_ReplayResult_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_ReplayResult_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_GetReplayRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_GetReplayRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_ReplayConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_ReplayConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_ReplayConfig_PolicyOverlayEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_ReplayConfig_PolicyOverlayEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_ReplayDiff_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_ReplayDiff_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_AccessStateDiff_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_AccessStateDiff_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_policysimulator_v1_ExplainedAccess_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_policysimulator_v1_ExplainedAccess_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/policysimulator/v1/simula" + + "tor.proto\022\037google.cloud.policysimulator." + + "v1\032\034google/api/annotations.proto\032\027google" + + "/api/client.proto\032\037google/api/field_beha" + + "vior.proto\032\031google/api/resource.proto\0322g" + + "oogle/cloud/policysimulator/v1/explanati" + + "ons.proto\032\032google/iam/v1/policy.proto\032#g" + + "oogle/longrunning/operations.proto\032\037goog" + + "le/protobuf/timestamp.proto\032\027google/rpc/" + + "status.proto\032\026google/type/date.proto\"\363\005\n" + + "\006Replay\022\022\n\004name\030\001 \001(\tB\004\342A\001\003\022B\n\005state\030\002 \001" + + "(\0162-.google.cloud.policysimulator.v1.Rep" + + "lay.StateB\004\342A\001\003\022C\n\006config\030\003 \001(\0132-.google" + + ".cloud.policysimulator.v1.ReplayConfigB\004" + + "\342A\001\002\022U\n\017results_summary\030\005 \001(\01326.google.c" + + "loud.policysimulator.v1.Replay.ResultsSu" + + "mmaryB\004\342A\001\003\032\273\001\n\016ResultsSummary\022\021\n\tlog_co" + + "unt\030\001 \001(\005\022\027\n\017unchanged_count\030\002 \001(\005\022\030\n\020di" + + "fference_count\030\003 \001(\005\022\023\n\013error_count\030\004 \001(" + + "\005\022&\n\013oldest_date\030\005 \001(\0132\021.google.type.Dat" + + "e\022&\n\013newest_date\030\006 \001(\0132\021.google.type.Dat" + + "e\"S\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\013\n\007PEN" + + "DING\020\001\022\013\n\007RUNNING\020\002\022\r\n\tSUCCEEDED\020\003\022\n\n\006FA" + + "ILED\020\004:\341\001\352A\335\001\n%policysimulator.googleapi" + + "s.com/Replay\0228projects/{project}/locatio" + + "ns/{location}/replays/{replay}\0226folders/" + + "{folder}/locations/{location}/replays/{r" + + "eplay}\022Borganizations/{organization}/loc" + + "ations/{location}/replays/{replay}\"\345\004\n\014R" + + "eplayResult\022;\n\004diff\030\005 \001(\0132+.google.cloud" + + ".policysimulator.v1.ReplayDiffH\000\022#\n\005erro" + + "r\030\006 \001(\0132\022.google.rpc.StatusH\000\022\014\n\004name\030\001 " + + "\001(\t\022:\n\006parent\030\002 \001(\tB*\372A\'\n%policysimulato" + + "r.googleapis.com/Replay\022B\n\014access_tuple\030" + + "\003 \001(\0132,.google.cloud.policysimulator.v1." + + "AccessTuple\022)\n\016last_seen_date\030\004 \001(\0132\021.go" + + "ogle.type.Date:\257\002\352A\253\002\n+policysimulator.g" + + "oogleapis.com/ReplayResult\022Pprojects/{pr" + + "oject}/locations/{location}/replays/{rep" + + "lay}/results/{replay_result}\022Nfolders/{f" + + "older}/locations/{location}/replays/{rep" + + "lay}/results/{replay_result}\022Zorganizati" + + "ons/{organization}/locations/{location}/" + + "replays/{replay}/results/{replay_result}" + + "B\010\n\006result\"j\n\023CreateReplayRequest\022\024\n\006par" + + "ent\030\001 \001(\tB\004\342A\001\002\022=\n\006replay\030\002 \001(\0132\'.google" + + ".cloud.policysimulator.v1.ReplayB\004\342A\001\002\"I" + + "\n\027ReplayOperationMetadata\022.\n\nstart_time\030" + + "\001 \001(\0132\032.google.protobuf.Timestamp\"P\n\020Get" + + "ReplayRequest\022<\n\004name\030\001 \001(\tB.\342A\001\002\372A\'\n%po" + + "licysimulator.googleapis.com/Replay\"\201\001\n\030" + + "ListReplayResultsRequest\022>\n\006parent\030\001 \001(\t" + + "B.\342A\001\002\372A\'\n%policysimulator.googleapis.co" + + "m/Replay\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_toke" + + "n\030\003 \001(\t\"{\n\031ListReplayResultsResponse\022E\n\016" + + "replay_results\030\001 \003(\0132-.google.cloud.poli" + + "cysimulator.v1.ReplayResult\022\027\n\017next_page" + + "_token\030\002 \001(\t\"\300\002\n\014ReplayConfig\022X\n\016policy_" + + "overlay\030\001 \003(\0132@.google.cloud.policysimul" + + "ator.v1.ReplayConfig.PolicyOverlayEntry\022" + + "K\n\nlog_source\030\002 \001(\01627.google.cloud.polic" + + "ysimulator.v1.ReplayConfig.LogSource\032K\n\022" + + "PolicyOverlayEntry\022\013\n\003key\030\001 \001(\t\022$\n\005value" + + "\030\002 \001(\0132\025.google.iam.v1.Policy:\0028\001\"<\n\tLog" + + "Source\022\032\n\026LOG_SOURCE_UNSPECIFIED\020\000\022\023\n\017RE" + + "CENT_ACCESSES\020\001\"S\n\nReplayDiff\022E\n\013access_" + + "diff\030\002 \001(\01320.google.cloud.policysimulato" + + "r.v1.AccessStateDiff\"\252\003\n\017AccessStateDiff" + + "\022B\n\010baseline\030\001 \001(\01320.google.cloud.policy" + + "simulator.v1.ExplainedAccess\022C\n\tsimulate" + + "d\030\002 \001(\01320.google.cloud.policysimulator.v" + + "1.ExplainedAccess\022X\n\raccess_change\030\003 \001(\016" + + "2A.google.cloud.policysimulator.v1.Acces" + + "sStateDiff.AccessChangeType\"\263\001\n\020AccessCh" + + "angeType\022\"\n\036ACCESS_CHANGE_TYPE_UNSPECIFI" + + "ED\020\000\022\r\n\tNO_CHANGE\020\001\022\022\n\016UNKNOWN_CHANGE\020\002\022" + + "\022\n\016ACCESS_REVOKED\020\003\022\021\n\rACCESS_GAINED\020\004\022\030" + + "\n\024ACCESS_MAYBE_REVOKED\020\005\022\027\n\023ACCESS_MAYBE" + + "_GAINED\020\006\"\275\001\n\017ExplainedAccess\022B\n\014access_" + + "state\030\001 \001(\0162,.google.cloud.policysimulat" + + "or.v1.AccessState\022B\n\010policies\030\002 \003(\01320.go" + + "ogle.cloud.policysimulator.v1.ExplainedP" + + "olicy\022\"\n\006errors\030\003 \003(\0132\022.google.rpc.Statu" + + "s2\201\010\n\tSimulator\022\207\002\n\tGetReplay\0221.google.c" + + "loud.policysimulator.v1.GetReplayRequest" + + "\032\'.google.cloud.policysimulator.v1.Repla" + + "y\"\235\001\332A\004name\202\323\344\223\002\217\001\022+/v1/{name=projects/*" + + "/locations/*/replays/*}Z,\022*/v1/{name=fol" + + "ders/*/locations/*/replays/*}Z2\0220/v1/{na" + + "me=organizations/*/locations/*/replays/*" + + "}\022\310\002\n\014CreateReplay\0224.google.cloud.policy" + + "simulator.v1.CreateReplayRequest\032\035.googl" + + "e.longrunning.Operation\"\342\001\312A!\n\006Replay\022\027R" + + "eplayOperationMetadata\332A\rparent,replay\202\323" + + "\344\223\002\247\001\"+/v1/{parent=projects/*/locations/" + + "*}/replays:\006replayZ4\"*/v1/{parent=folder" + + "s/*/locations/*}/replays:\006replayZ:\"0/v1/" + + "{parent=organizations/*/locations/*}/rep" + + "lays:\006replay\022\312\002\n\021ListReplayResults\0229.goo" + + "gle.cloud.policysimulator.v1.ListReplayR" + + "esultsRequest\032:.google.cloud.policysimul" + + "ator.v1.ListReplayResultsResponse\"\275\001\332A\006p" + + "arent\202\323\344\223\002\255\001\0225/v1/{parent=projects/*/loc" + + "ations/*/replays/*}/resultsZ6\0224/v1/{pare" + + "nt=folders/*/locations/*/replays/*}/resu" + + "ltsZ<\022:/v1/{parent=organizations/*/locat" + + "ions/*/replays/*}/results\032R\312A\036policysimu" + + "lator.googleapis.com\322A.https://www.googl" + + "eapis.com/auth/cloud-platformB\211\001\n#com.go" + + "ogle.cloud.policysimulator.v1B\016Simulator" + + "ProtoP\001ZMcloud.google.com/go/policysimul" + + "ator/apiv1/policysimulatorpb;policysimul" + + "atorpb\370\001\001b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.policysimulator.v1.ExplanationsProto.getDescriptor(), + com.google.iam.v1.PolicyProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + com.google.rpc.StatusProto.getDescriptor(), + com.google.type.DateProto.getDescriptor(), + }); + internal_static_google_cloud_policysimulator_v1_Replay_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_policysimulator_v1_Replay_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_Replay_descriptor, + new java.lang.String[] { + "Name", "State", "Config", "ResultsSummary", + }); + internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_descriptor = + internal_static_google_cloud_policysimulator_v1_Replay_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_Replay_ResultsSummary_descriptor, + new java.lang.String[] { + "LogCount", + "UnchangedCount", + "DifferenceCount", + "ErrorCount", + "OldestDate", + "NewestDate", + }); + internal_static_google_cloud_policysimulator_v1_ReplayResult_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_policysimulator_v1_ReplayResult_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_ReplayResult_descriptor, + new java.lang.String[] { + "Diff", "Error", "Name", "Parent", "AccessTuple", "LastSeenDate", "Result", + }); + internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_CreateReplayRequest_descriptor, + new java.lang.String[] { + "Parent", "Replay", + }); + internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_ReplayOperationMetadata_descriptor, + new java.lang.String[] { + "StartTime", + }); + internal_static_google_cloud_policysimulator_v1_GetReplayRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_policysimulator_v1_GetReplayRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_GetReplayRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_ListReplayResultsRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", + }); + internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_ListReplayResultsResponse_descriptor, + new java.lang.String[] { + "ReplayResults", "NextPageToken", + }); + internal_static_google_cloud_policysimulator_v1_ReplayConfig_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_policysimulator_v1_ReplayConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_ReplayConfig_descriptor, + new java.lang.String[] { + "PolicyOverlay", "LogSource", + }); + internal_static_google_cloud_policysimulator_v1_ReplayConfig_PolicyOverlayEntry_descriptor = + internal_static_google_cloud_policysimulator_v1_ReplayConfig_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_policysimulator_v1_ReplayConfig_PolicyOverlayEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_ReplayConfig_PolicyOverlayEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_policysimulator_v1_ReplayDiff_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_policysimulator_v1_ReplayDiff_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_ReplayDiff_descriptor, + new java.lang.String[] { + "AccessDiff", + }); + internal_static_google_cloud_policysimulator_v1_AccessStateDiff_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_policysimulator_v1_AccessStateDiff_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_AccessStateDiff_descriptor, + new java.lang.String[] { + "Baseline", "Simulated", "AccessChange", + }); + internal_static_google_cloud_policysimulator_v1_ExplainedAccess_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_google_cloud_policysimulator_v1_ExplainedAccess_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_policysimulator_v1_ExplainedAccess_descriptor, + new java.lang.String[] { + "AccessState", "Policies", "Errors", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceReference); + registry.add(com.google.longrunning.OperationsProto.operationInfo); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.policysimulator.v1.ExplanationsProto.getDescriptor(); + com.google.iam.v1.PolicyProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + com.google.rpc.StatusProto.getDescriptor(); + com.google.type.DateProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/proto/google/cloud/policysimulator/v1/explanations.proto b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/proto/google/cloud/policysimulator/v1/explanations.proto new file mode 100644 index 000000000000..b2c6f0c7d0c7 --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/proto/google/cloud/policysimulator/v1/explanations.proto @@ -0,0 +1,257 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.policysimulator.v1; + +import "google/api/field_behavior.proto"; +import "google/iam/v1/policy.proto"; +import "google/type/expr.proto"; + +option cc_enable_arenas = true; +option go_package = "cloud.google.com/go/policysimulator/apiv1/policysimulatorpb;policysimulatorpb"; +option java_multiple_files = true; +option java_outer_classname = "ExplanationsProto"; +option java_package = "com.google.cloud.policysimulator.v1"; + +// Whether a principal has a permission for a resource. +enum AccessState { + // Default value. This value is unused. + ACCESS_STATE_UNSPECIFIED = 0; + + // The principal has the permission. + GRANTED = 1; + + // The principal does not have the permission. + NOT_GRANTED = 2; + + // The principal has the permission only if a condition expression evaluates + // to `true`. + UNKNOWN_CONDITIONAL = 3; + + // The user who created the + // [Replay][google.cloud.policysimulator.v1.Replay] does not have + // access to all of the policies that Policy Simulator needs to evaluate. + UNKNOWN_INFO_DENIED = 4; +} + +// The extent to which a single data point, such as the existence of a binding +// or whether a binding includes a specific principal, contributes to an overall +// determination. +enum HeuristicRelevance { + // Default value. This value is unused. + HEURISTIC_RELEVANCE_UNSPECIFIED = 0; + + // The data point has a limited effect on the result. Changing the data point + // is unlikely to affect the overall determination. + NORMAL = 1; + + // The data point has a strong effect on the result. Changing the data point + // is likely to affect the overall determination. + HIGH = 2; +} + +// Information about the principal, resource, and permission to check. +message AccessTuple { + // Required. The principal whose access you want to check, in the form of + // the email address that represents that principal. For example, + // `alice@example.com` or + // `my-service-account@my-project.iam.gserviceaccount.com`. + // + // The principal must be a Google Account or a service account. Other types of + // principals are not supported. + string principal = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The full resource name that identifies the resource. For example, + // `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`. + // + // For examples of full resource names for Google Cloud services, see + // https://cloud.google.com/iam/help/troubleshooter/full-resource-names. + string full_resource_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The IAM permission to check for the specified principal and + // resource. + // + // For a complete list of IAM permissions, see + // https://cloud.google.com/iam/help/permissions/reference. + // + // For a complete list of predefined IAM roles and the permissions in each + // role, see https://cloud.google.com/iam/help/roles/reference. + string permission = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Details about how a specific IAM [Policy][google.iam.v1.Policy] contributed +// to the access check. +message ExplainedPolicy { + // Indicates whether _this policy_ provides the specified permission to the + // specified principal for the specified resource. + // + // This field does _not_ indicate whether the principal actually has the + // permission for the resource. There might be another policy that overrides + // this policy. To determine whether the principal actually has the + // permission, use the `access` field in the + // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse]. + AccessState access = 1; + + // The full resource name that identifies the resource. For example, + // `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`. + // + // If the user who created the + // [Replay][google.cloud.policysimulator.v1.Replay] does not have + // access to the policy, this field is omitted. + // + // For examples of full resource names for Google Cloud services, see + // https://cloud.google.com/iam/help/troubleshooter/full-resource-names. + string full_resource_name = 2; + + // The IAM policy attached to the resource. + // + // If the user who created the + // [Replay][google.cloud.policysimulator.v1.Replay] does not have + // access to the policy, this field is empty. + google.iam.v1.Policy policy = 3; + + // Details about how each binding in the policy affects the principal's + // ability, or inability, to use the permission for the resource. + // + // If the user who created the + // [Replay][google.cloud.policysimulator.v1.Replay] does not have + // access to the policy, this field is omitted. + repeated BindingExplanation binding_explanations = 4; + + // The relevance of this policy to the overall determination in the + // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse]. + // + // If the user who created the + // [Replay][google.cloud.policysimulator.v1.Replay] does not have + // access to the policy, this field is omitted. + HeuristicRelevance relevance = 5; +} + +// Details about how a binding in a policy affects a principal's ability to use +// a permission. +message BindingExplanation { + // Details about whether the binding includes the principal. + message AnnotatedMembership { + // Indicates whether the binding includes the principal. + Membership membership = 1; + + // The relevance of the principal's status to the overall determination for + // the binding. + HeuristicRelevance relevance = 2; + } + + // Whether a role includes a specific permission. + enum RolePermission { + // Default value. This value is unused. + ROLE_PERMISSION_UNSPECIFIED = 0; + + // The permission is included in the role. + ROLE_PERMISSION_INCLUDED = 1; + + // The permission is not included in the role. + ROLE_PERMISSION_NOT_INCLUDED = 2; + + // The user who created the + // [Replay][google.cloud.policysimulator.v1.Replay] is not + // allowed to access the binding. + ROLE_PERMISSION_UNKNOWN_INFO_DENIED = 3; + } + + // Whether the binding includes the principal. + enum Membership { + // Default value. This value is unused. + MEMBERSHIP_UNSPECIFIED = 0; + + // The binding includes the principal. The principal can be included + // directly or indirectly. For example: + // + // * A principal is included directly if that principal is listed in the + // binding. + // * A principal is included indirectly if that principal is in a Google + // group or Google Workspace domain that is listed in the binding. + MEMBERSHIP_INCLUDED = 1; + + // The binding does not include the principal. + MEMBERSHIP_NOT_INCLUDED = 2; + + // The user who created the + // [Replay][google.cloud.policysimulator.v1.Replay] is not + // allowed to access the binding. + MEMBERSHIP_UNKNOWN_INFO_DENIED = 3; + + // The principal is an unsupported type. Only Google Accounts and service + // accounts are supported. + MEMBERSHIP_UNKNOWN_UNSUPPORTED = 4; + } + + // Required. Indicates whether _this binding_ provides the specified + // permission to the specified principal for the specified resource. + // + // This field does _not_ indicate whether the principal actually has the + // permission for the resource. There might be another binding that overrides + // this binding. To determine whether the principal actually has the + // permission, use the `access` field in the + // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse]. + AccessState access = 1 [(google.api.field_behavior) = REQUIRED]; + + // The role that this binding grants. For example, + // `roles/compute.serviceAgent`. + // + // For a complete list of predefined IAM roles, as well as the permissions in + // each role, see https://cloud.google.com/iam/help/roles/reference. + string role = 2; + + // Indicates whether the role granted by this binding contains the specified + // permission. + RolePermission role_permission = 3; + + // The relevance of the permission's existence, or nonexistence, in the role + // to the overall determination for the entire policy. + HeuristicRelevance role_permission_relevance = 4; + + // Indicates whether each principal in the binding includes the principal + // specified in the request, either directly or indirectly. Each key + // identifies a principal in the binding, and each value indicates whether the + // principal in the binding includes the principal in the request. + // + // For example, suppose that a binding includes the following principals: + // + // * `user:alice@example.com` + // * `group:product-eng@example.com` + // + // The principal in the replayed access tuple is `user:bob@example.com`. This + // user is a principal of the group `group:product-eng@example.com`. + // + // For the first principal in the binding, the key is + // `user:alice@example.com`, and the `membership` field in the value is set to + // `MEMBERSHIP_NOT_INCLUDED`. + // + // For the second principal in the binding, the key is + // `group:product-eng@example.com`, and the `membership` field in the value is + // set to `MEMBERSHIP_INCLUDED`. + map memberships = 5; + + // The relevance of this binding to the overall determination for the entire + // policy. + HeuristicRelevance relevance = 6; + + // A condition expression that prevents this binding from granting access + // unless the expression evaluates to `true`. + // + // To learn about IAM Conditions, see + // https://cloud.google.com/iam/docs/conditions-overview. + google.type.Expr condition = 7; +} diff --git a/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/proto/google/cloud/policysimulator/v1/simulator.proto b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/proto/google/cloud/policysimulator/v1/simulator.proto new file mode 100644 index 000000000000..b5862b9a5d2b --- /dev/null +++ b/java-policysimulator/proto-google-cloud-policysimulator-v1/src/main/proto/google/cloud/policysimulator/v1/simulator.proto @@ -0,0 +1,460 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.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.policysimulator.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/policysimulator/v1/explanations.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/type/date.proto"; + +option cc_enable_arenas = true; +option go_package = "cloud.google.com/go/policysimulator/apiv1/policysimulatorpb;policysimulatorpb"; +option java_multiple_files = true; +option java_outer_classname = "SimulatorProto"; +option java_package = "com.google.cloud.policysimulator.v1"; + +// Policy Simulator API service. +// +// Policy Simulator is a collection of endpoints for creating, running, and +// viewing a [Replay][google.cloud.policysimulator.v1.Replay]. A +// [Replay][google.cloud.policysimulator.v1.Replay] is a type of simulation that +// lets you see how your principals' access to resources might change if you +// changed your IAM policy. +// +// During a [Replay][google.cloud.policysimulator.v1.Replay], Policy Simulator +// re-evaluates, or replays, past access attempts under both the current policy +// and your proposed policy, and compares those results to determine how your +// principals' access might change under the proposed policy. +service Simulator { + option (google.api.default_host) = "policysimulator.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Gets the specified [Replay][google.cloud.policysimulator.v1.Replay]. Each + // `Replay` is available for at least 7 days. + rpc GetReplay(GetReplayRequest) returns (Replay) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/replays/*}" + additional_bindings { get: "/v1/{name=folders/*/locations/*/replays/*}" } + additional_bindings { + get: "/v1/{name=organizations/*/locations/*/replays/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates and starts a [Replay][google.cloud.policysimulator.v1.Replay] using + // the given [ReplayConfig][google.cloud.policysimulator.v1.ReplayConfig]. + rpc CreateReplay(CreateReplayRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/replays" + body: "replay" + additional_bindings { + post: "/v1/{parent=folders/*/locations/*}/replays" + body: "replay" + } + additional_bindings { + post: "/v1/{parent=organizations/*/locations/*}/replays" + body: "replay" + } + }; + option (google.api.method_signature) = "parent,replay"; + option (google.longrunning.operation_info) = { + response_type: "Replay" + metadata_type: "ReplayOperationMetadata" + }; + } + + // Lists the results of running a + // [Replay][google.cloud.policysimulator.v1.Replay]. + rpc ListReplayResults(ListReplayResultsRequest) + returns (ListReplayResultsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/replays/*}/results" + additional_bindings { + get: "/v1/{parent=folders/*/locations/*/replays/*}/results" + } + additional_bindings { + get: "/v1/{parent=organizations/*/locations/*/replays/*}/results" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// A resource describing a `Replay`, or simulation. +message Replay { + option (google.api.resource) = { + type: "policysimulator.googleapis.com/Replay" + pattern: "projects/{project}/locations/{location}/replays/{replay}" + pattern: "folders/{folder}/locations/{location}/replays/{replay}" + pattern: "organizations/{organization}/locations/{location}/replays/{replay}" + }; + + // Summary statistics about the replayed log entries. + message ResultsSummary { + // The total number of log entries replayed. + int32 log_count = 1; + + // The number of replayed log entries with no difference between + // baseline and simulated policies. + int32 unchanged_count = 2; + + // The number of replayed log entries with a difference between baseline and + // simulated policies. + int32 difference_count = 3; + + // The number of log entries that could not be replayed. + int32 error_count = 4; + + // The date of the oldest log entry replayed. + google.type.Date oldest_date = 5; + + // The date of the newest log entry replayed. + google.type.Date newest_date = 6; + } + + // The current state of the [Replay][google.cloud.policysimulator.v1.Replay]. + enum State { + // Default value. This value is unused. + STATE_UNSPECIFIED = 0; + + // The `Replay` has not started yet. + PENDING = 1; + + // The `Replay` is currently running. + RUNNING = 2; + + // The `Replay` has successfully completed. + SUCCEEDED = 3; + + // The `Replay` has finished with an error. + FAILED = 4; + } + + // Output only. The resource name of the `Replay`, which has the following + // format: + // + // `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`, + // where `{resource-id}` is the ID of the project, folder, or organization + // that owns the Replay. + // + // Example: + // `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the `Replay`. + State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The configuration used for the `Replay`. + ReplayConfig config = 3 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Summary statistics about the replayed log entries. + ResultsSummary results_summary = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The result of replaying a single access tuple against a simulated state. +message ReplayResult { + option (google.api.resource) = { + type: "policysimulator.googleapis.com/ReplayResult" + pattern: "projects/{project}/locations/{location}/replays/{replay}/results/{replay_result}" + pattern: "folders/{folder}/locations/{location}/replays/{replay}/results/{replay_result}" + pattern: "organizations/{organization}/locations/{location}/replays/{replay}/results/{replay_result}" + }; + + // The result of replaying the access tuple. + oneof result { + // The difference between the principal's access under the current + // (baseline) policies and the principal's access under the proposed + // (simulated) policies. + // + // This field is only included for access tuples that were successfully + // replayed and had different results under the current policies and the + // proposed policies. + ReplayDiff diff = 5; + + // The error that caused the access tuple replay to fail. + // + // This field is only included for access tuples that were not replayed + // successfully. + google.rpc.Status error = 6; + } + + // The resource name of the `ReplayResult`, in the following format: + // + // `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}/results/{replay-result-id}`, + // where `{resource-id}` is the ID of the project, folder, or organization + // that owns the [Replay][google.cloud.policysimulator.v1.Replay]. + // + // Example: + // `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36/results/1234` + string name = 1; + + // The [Replay][google.cloud.policysimulator.v1.Replay] that the access tuple + // was included in. + string parent = 2 [(google.api.resource_reference) = { + type: "policysimulator.googleapis.com/Replay" + }]; + + // The access tuple that was replayed. This field includes information about + // the principal, resource, and permission that were involved in the access + // attempt. + AccessTuple access_tuple = 3; + + // The latest date this access tuple was seen in the logs. + google.type.Date last_seen_date = 4; +} + +// Request message for +// [Simulator.CreateReplay][google.cloud.policysimulator.v1.Simulator.CreateReplay]. +message CreateReplayRequest { + // Required. The parent resource where this + // [Replay][google.cloud.policysimulator.v1.Replay] will be created. This + // resource must be a project, folder, or organization with a location. + // + // Example: `projects/my-example-project/locations/global` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED + ]; + + // Required. The [Replay][google.cloud.policysimulator.v1.Replay] to create. + // Set `Replay.ReplayConfig` to configure the replay. + Replay replay = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata about a Replay operation. +message ReplayOperationMetadata { + // Time when the request was received. + google.protobuf.Timestamp start_time = 1; +} + +// Request message for +// [Simulator.GetReplay][google.cloud.policysimulator.v1.Simulator.GetReplay]. +message GetReplayRequest { + // Required. The name of the [Replay][google.cloud.policysimulator.v1.Replay] + // to retrieve, in the following format: + // + // `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}`, + // where `{resource-id}` is the ID of the project, folder, or organization + // that owns the `Replay`. + // + // Example: + // `projects/my-example-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "policysimulator.googleapis.com/Replay" + } + ]; +} + +// Request message for +// [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]. +message ListReplayResultsRequest { + // Required. The [Replay][google.cloud.policysimulator.v1.Replay] whose + // results are listed, in the following format: + // + // `{projects|folders|organizations}/{resource-id}/locations/global/replays/{replay-id}` + // + // Example: + // `projects/my-project/locations/global/replays/506a5f7f-38ce-4d7d-8e03-479ce1833c36` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "policysimulator.googleapis.com/Replay" + } + ]; + + // The maximum number of + // [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects to + // return. Defaults to 5000. + // + // The maximum value is 5000; values above 5000 are rounded down to 5000. + int32 page_size = 2; + + // A page token, received from a previous + // [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults] + // call. Provide this token to retrieve the next page of results. + // + // When paginating, all other parameters provided to + // [Simulator.ListReplayResults[] must match the call that provided the page + // token. + string page_token = 3; +} + +// Response message for +// [Simulator.ListReplayResults][google.cloud.policysimulator.v1.Simulator.ListReplayResults]. +message ListReplayResultsResponse { + // The results of running a [Replay][google.cloud.policysimulator.v1.Replay]. + repeated ReplayResult replay_results = 1; + + // A token that you can use to retrieve the next page of + // [ReplayResult][google.cloud.policysimulator.v1.ReplayResult] objects. If + // this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// The configuration used for a +// [Replay][google.cloud.policysimulator.v1.Replay]. +message ReplayConfig { + // The source of the logs to use for a + // [Replay][google.cloud.policysimulator.v1.Replay]. + enum LogSource { + // An unspecified log source. + // If the log source is unspecified, the + // [Replay][google.cloud.policysimulator.v1.Replay] defaults to using + // `RECENT_ACCESSES`. + LOG_SOURCE_UNSPECIFIED = 0; + + // All access logs from the last 90 days. These logs may not include logs + // from the most recent 7 days. + RECENT_ACCESSES = 1; + } + + // A mapping of the resources that you want to simulate policies for and the + // policies that you want to simulate. + // + // Keys are the full resource names for the resources. For example, + // `//cloudresourcemanager.googleapis.com/projects/my-project`. + // For examples of full resource names for Google Cloud services, see + // https://cloud.google.com/iam/help/troubleshooter/full-resource-names. + // + // Values are [Policy][google.iam.v1.Policy] objects representing the policies + // that you want to simulate. + // + // Replays automatically take into account any IAM policies inherited through + // the resource hierarchy, and any policies set on descendant resources. You + // do not need to include these policies in the policy overlay. + map policy_overlay = 1; + + // The logs to use as input for the + // [Replay][google.cloud.policysimulator.v1.Replay]. + LogSource log_source = 2; +} + +// The difference between the results of evaluating an access tuple under +// the current (baseline) policies and under the proposed (simulated) policies. +// This difference explains how a principal's access could change if the +// proposed policies were applied. +message ReplayDiff { + // A summary and comparison of the principal's access under the current + // (baseline) policies and the proposed (simulated) policies for a single + // access tuple. + // + // The evaluation of the principal's access is reported in the + // [AccessState][google.cloud.policysimulator.v1.AccessState] field. + AccessStateDiff access_diff = 2; +} + +// A summary and comparison of the principal's access under the current +// (baseline) policies and the proposed (simulated) policies for a single +// access tuple. +message AccessStateDiff { + // How the principal's access, specified in the AccessState field, changed + // between the current (baseline) policies and proposed (simulated) policies. + enum AccessChangeType { + // Default value. This value is unused. + ACCESS_CHANGE_TYPE_UNSPECIFIED = 0; + + // The principal's access did not change. + // This includes the case where both baseline and simulated are UNKNOWN, + // but the unknown information is equivalent. + NO_CHANGE = 1; + + // The principal's access under both the current policies and the proposed + // policies is `UNKNOWN`, but the unknown information differs between them. + UNKNOWN_CHANGE = 2; + + // The principal had access under the current policies (`GRANTED`), but will + // no longer have access after the proposed changes (`NOT_GRANTED`). + ACCESS_REVOKED = 3; + + // The principal did not have access under the current policies + // (`NOT_GRANTED`), but will have access after the proposed changes + // (`GRANTED`). + ACCESS_GAINED = 4; + + // This result can occur for the following reasons: + // + // * The principal had access under the current policies (`GRANTED`), but + // their access after the proposed changes is `UNKNOWN`. + // + // * The principal's access under the current policies is `UNKNOWN`, but + // they + // will not have access after the proposed changes (`NOT_GRANTED`). + ACCESS_MAYBE_REVOKED = 5; + + // This result can occur for the following reasons: + // + // * The principal did not have access under the current policies + // (`NOT_GRANTED`), but their access after the proposed changes is + // `UNKNOWN`. + // + // * The principal's access under the current policies is `UNKNOWN`, but + // they will have access after the proposed changes (`GRANTED`). + ACCESS_MAYBE_GAINED = 6; + } + + // The results of evaluating the access tuple under the current (baseline) + // policies. + // + // If the [AccessState][google.cloud.policysimulator.v1.AccessState] couldn't + // be fully evaluated, this field explains why. + ExplainedAccess baseline = 1; + + // The results of evaluating the access tuple under the proposed (simulated) + // policies. + // + // If the AccessState couldn't be fully evaluated, this field explains why. + ExplainedAccess simulated = 2; + + // How the principal's access, specified in the AccessState field, changed + // between the current (baseline) policies and proposed (simulated) policies. + AccessChangeType access_change = 3; +} + +// Details about how a set of policies, listed in +// [ExplainedPolicy][google.cloud.policysimulator.v1.ExplainedPolicy], resulted +// in a certain [AccessState][google.cloud.policysimulator.v1.AccessState] when +// replaying an access tuple. +message ExplainedAccess { + // Whether the principal in the access tuple has permission to access the + // resource in the access tuple under the given policies. + AccessState access_state = 1; + + // If the [AccessState][google.cloud.policysimulator.v1.AccessState] is + // `UNKNOWN`, this field contains the policies that led to that result. + // + // If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is + // omitted. + repeated ExplainedPolicy policies = 2; + + // If the [AccessState][google.cloud.policysimulator.v1.AccessState] is + // `UNKNOWN`, this field contains a list of errors explaining why the result + // is `UNKNOWN`. + // + // If the `AccessState` is `GRANTED` or `NOT_GRANTED`, this field is + // omitted. + repeated google.rpc.Status errors = 3; +} diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/create/SyncCreateSetCredentialsProvider.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..9752aec48c80 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.policysimulator.v1.SimulatorClient; +import com.google.cloud.policysimulator.v1.SimulatorSettings; +import com.google.cloud.policysimulator.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SimulatorSettings simulatorSettings = + SimulatorSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + SimulatorClient simulatorClient = SimulatorClient.create(simulatorSettings); + } +} +// [END policysimulator_v1_generated_Simulator_Create_SetCredentialsProvider_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/create/SyncCreateSetCredentialsProvider1.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..d6b87ee2d6d1 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,39 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_Create_SetCredentialsProvider1_sync] +import com.google.cloud.policysimulator.v1.SimulatorClient; +import com.google.cloud.policysimulator.v1.SimulatorSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SimulatorSettings simulatorSettings = SimulatorSettings.newHttpJsonBuilder().build(); + SimulatorClient simulatorClient = SimulatorClient.create(simulatorSettings); + } +} +// [END policysimulator_v1_generated_Simulator_Create_SetCredentialsProvider1_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/create/SyncCreateSetEndpoint.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..9066e0702c1a --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_Create_SetEndpoint_sync] +import com.google.cloud.policysimulator.v1.SimulatorClient; +import com.google.cloud.policysimulator.v1.SimulatorSettings; +import com.google.cloud.policysimulator.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SimulatorSettings simulatorSettings = + SimulatorSettings.newBuilder().setEndpoint(myEndpoint).build(); + SimulatorClient simulatorClient = SimulatorClient.create(simulatorSettings); + } +} +// [END policysimulator_v1_generated_Simulator_Create_SetEndpoint_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/AsyncCreateReplay.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/AsyncCreateReplay.java new file mode 100644 index 000000000000..758dc0d2cd53 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/AsyncCreateReplay.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_CreateReplay_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.policysimulator.v1.CreateReplayRequest; +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.SimulatorClient; +import com.google.longrunning.Operation; + +public class AsyncCreateReplay { + + public static void main(String[] args) throws Exception { + asyncCreateReplay(); + } + + public static void asyncCreateReplay() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + CreateReplayRequest request = + CreateReplayRequest.newBuilder() + .setParent("parent-995424086") + .setReplay(Replay.newBuilder().build()) + .build(); + ApiFuture future = simulatorClient.createReplayCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END policysimulator_v1_generated_Simulator_CreateReplay_async] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/AsyncCreateReplayLRO.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/AsyncCreateReplayLRO.java new file mode 100644 index 000000000000..b7a945907bf2 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/AsyncCreateReplayLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_CreateReplay_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.policysimulator.v1.CreateReplayRequest; +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.ReplayOperationMetadata; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class AsyncCreateReplayLRO { + + public static void main(String[] args) throws Exception { + asyncCreateReplayLRO(); + } + + public static void asyncCreateReplayLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + CreateReplayRequest request = + CreateReplayRequest.newBuilder() + .setParent("parent-995424086") + .setReplay(Replay.newBuilder().build()) + .build(); + OperationFuture future = + simulatorClient.createReplayOperationCallable().futureCall(request); + // Do something. + Replay response = future.get(); + } + } +} +// [END policysimulator_v1_generated_Simulator_CreateReplay_LRO_async] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/SyncCreateReplay.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/SyncCreateReplay.java new file mode 100644 index 000000000000..7be68dbc4502 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/SyncCreateReplay.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_CreateReplay_sync] +import com.google.cloud.policysimulator.v1.CreateReplayRequest; +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class SyncCreateReplay { + + public static void main(String[] args) throws Exception { + syncCreateReplay(); + } + + public static void syncCreateReplay() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + CreateReplayRequest request = + CreateReplayRequest.newBuilder() + .setParent("parent-995424086") + .setReplay(Replay.newBuilder().build()) + .build(); + Replay response = simulatorClient.createReplayAsync(request).get(); + } + } +} +// [END policysimulator_v1_generated_Simulator_CreateReplay_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/SyncCreateReplayStringReplay.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/SyncCreateReplayStringReplay.java new file mode 100644 index 000000000000..7a44ce55697e --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/createreplay/SyncCreateReplayStringReplay.java @@ -0,0 +1,42 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_CreateReplay_StringReplay_sync] +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class SyncCreateReplayStringReplay { + + public static void main(String[] args) throws Exception { + syncCreateReplayStringReplay(); + } + + public static void syncCreateReplayStringReplay() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + String parent = "parent-995424086"; + Replay replay = Replay.newBuilder().build(); + Replay response = simulatorClient.createReplayAsync(parent, replay).get(); + } + } +} +// [END policysimulator_v1_generated_Simulator_CreateReplay_StringReplay_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/AsyncGetReplay.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/AsyncGetReplay.java new file mode 100644 index 000000000000..c7e9e99b977f --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/AsyncGetReplay.java @@ -0,0 +1,51 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_GetReplay_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.policysimulator.v1.GetReplayRequest; +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.ReplayName; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class AsyncGetReplay { + + public static void main(String[] args) throws Exception { + asyncGetReplay(); + } + + public static void asyncGetReplay() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + GetReplayRequest request = + GetReplayRequest.newBuilder() + .setName( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .build(); + ApiFuture future = simulatorClient.getReplayCallable().futureCall(request); + // Do something. + Replay response = future.get(); + } + } +} +// [END policysimulator_v1_generated_Simulator_GetReplay_async] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/SyncGetReplay.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/SyncGetReplay.java new file mode 100644 index 000000000000..4685fafc05d9 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/SyncGetReplay.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_GetReplay_sync] +import com.google.cloud.policysimulator.v1.GetReplayRequest; +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.ReplayName; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class SyncGetReplay { + + public static void main(String[] args) throws Exception { + syncGetReplay(); + } + + public static void syncGetReplay() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + GetReplayRequest request = + GetReplayRequest.newBuilder() + .setName( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .build(); + Replay response = simulatorClient.getReplay(request); + } + } +} +// [END policysimulator_v1_generated_Simulator_GetReplay_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/SyncGetReplayReplayname.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/SyncGetReplayReplayname.java new file mode 100644 index 000000000000..28c2fa7493f5 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/SyncGetReplayReplayname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_GetReplay_Replayname_sync] +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.ReplayName; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class SyncGetReplayReplayname { + + public static void main(String[] args) throws Exception { + syncGetReplayReplayname(); + } + + public static void syncGetReplayReplayname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + ReplayName name = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + Replay response = simulatorClient.getReplay(name); + } + } +} +// [END policysimulator_v1_generated_Simulator_GetReplay_Replayname_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/SyncGetReplayString.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/SyncGetReplayString.java new file mode 100644 index 000000000000..3ce54f0bfb2c --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/getreplay/SyncGetReplayString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_GetReplay_String_sync] +import com.google.cloud.policysimulator.v1.Replay; +import com.google.cloud.policysimulator.v1.ReplayName; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class SyncGetReplayString { + + public static void main(String[] args) throws Exception { + syncGetReplayString(); + } + + public static void syncGetReplayString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + String name = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]").toString(); + Replay response = simulatorClient.getReplay(name); + } + } +} +// [END policysimulator_v1_generated_Simulator_GetReplay_String_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/AsyncListReplayResults.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/AsyncListReplayResults.java new file mode 100644 index 000000000000..10c139b87bad --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/AsyncListReplayResults.java @@ -0,0 +1,56 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_ListReplayResults_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.policysimulator.v1.ListReplayResultsRequest; +import com.google.cloud.policysimulator.v1.ReplayName; +import com.google.cloud.policysimulator.v1.ReplayResult; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class AsyncListReplayResults { + + public static void main(String[] args) throws Exception { + asyncListReplayResults(); + } + + public static void asyncListReplayResults() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + ListReplayResultsRequest request = + ListReplayResultsRequest.newBuilder() + .setParent( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + simulatorClient.listReplayResultsPagedCallable().futureCall(request); + // Do something. + for (ReplayResult element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END policysimulator_v1_generated_Simulator_ListReplayResults_async] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/AsyncListReplayResultsPaged.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/AsyncListReplayResultsPaged.java new file mode 100644 index 000000000000..004d42e4302c --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/AsyncListReplayResultsPaged.java @@ -0,0 +1,64 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_ListReplayResults_Paged_async] +import com.google.cloud.policysimulator.v1.ListReplayResultsRequest; +import com.google.cloud.policysimulator.v1.ListReplayResultsResponse; +import com.google.cloud.policysimulator.v1.ReplayName; +import com.google.cloud.policysimulator.v1.ReplayResult; +import com.google.cloud.policysimulator.v1.SimulatorClient; +import com.google.common.base.Strings; + +public class AsyncListReplayResultsPaged { + + public static void main(String[] args) throws Exception { + asyncListReplayResultsPaged(); + } + + public static void asyncListReplayResultsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + ListReplayResultsRequest request = + ListReplayResultsRequest.newBuilder() + .setParent( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListReplayResultsResponse response = + simulatorClient.listReplayResultsCallable().call(request); + for (ReplayResult element : response.getReplayResultsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END policysimulator_v1_generated_Simulator_ListReplayResults_Paged_async] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/SyncListReplayResults.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/SyncListReplayResults.java new file mode 100644 index 000000000000..dd55aa61ca82 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/SyncListReplayResults.java @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_ListReplayResults_sync] +import com.google.cloud.policysimulator.v1.ListReplayResultsRequest; +import com.google.cloud.policysimulator.v1.ReplayName; +import com.google.cloud.policysimulator.v1.ReplayResult; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class SyncListReplayResults { + + public static void main(String[] args) throws Exception { + syncListReplayResults(); + } + + public static void syncListReplayResults() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + ListReplayResultsRequest request = + ListReplayResultsRequest.newBuilder() + .setParent( + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (ReplayResult element : simulatorClient.listReplayResults(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END policysimulator_v1_generated_Simulator_ListReplayResults_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/SyncListReplayResultsReplayname.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/SyncListReplayResultsReplayname.java new file mode 100644 index 000000000000..f6c174cc0109 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/SyncListReplayResultsReplayname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_ListReplayResults_Replayname_sync] +import com.google.cloud.policysimulator.v1.ReplayName; +import com.google.cloud.policysimulator.v1.ReplayResult; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class SyncListReplayResultsReplayname { + + public static void main(String[] args) throws Exception { + syncListReplayResultsReplayname(); + } + + public static void syncListReplayResultsReplayname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + ReplayName parent = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]"); + for (ReplayResult element : simulatorClient.listReplayResults(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END policysimulator_v1_generated_Simulator_ListReplayResults_Replayname_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/SyncListReplayResultsString.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/SyncListReplayResultsString.java new file mode 100644 index 000000000000..0e5773a8905f --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulator/listreplayresults/SyncListReplayResultsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_Simulator_ListReplayResults_String_sync] +import com.google.cloud.policysimulator.v1.ReplayName; +import com.google.cloud.policysimulator.v1.ReplayResult; +import com.google.cloud.policysimulator.v1.SimulatorClient; + +public class SyncListReplayResultsString { + + public static void main(String[] args) throws Exception { + syncListReplayResultsString(); + } + + public static void syncListReplayResultsString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (SimulatorClient simulatorClient = SimulatorClient.create()) { + String parent = + ReplayName.ofProjectLocationReplayName("[PROJECT]", "[LOCATION]", "[REPLAY]").toString(); + for (ReplayResult element : simulatorClient.listReplayResults(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END policysimulator_v1_generated_Simulator_ListReplayResults_String_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulatorsettings/getreplay/SyncGetReplay.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulatorsettings/getreplay/SyncGetReplay.java new file mode 100644 index 000000000000..851a70b19bfa --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/simulatorsettings/getreplay/SyncGetReplay.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.samples; + +// [START policysimulator_v1_generated_SimulatorSettings_GetReplay_sync] +import com.google.cloud.policysimulator.v1.SimulatorSettings; +import java.time.Duration; + +public class SyncGetReplay { + + public static void main(String[] args) throws Exception { + syncGetReplay(); + } + + public static void syncGetReplay() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SimulatorSettings.Builder simulatorSettingsBuilder = SimulatorSettings.newBuilder(); + simulatorSettingsBuilder + .getReplaySettings() + .setRetrySettings( + simulatorSettingsBuilder + .getReplaySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SimulatorSettings simulatorSettings = simulatorSettingsBuilder.build(); + } +} +// [END policysimulator_v1_generated_SimulatorSettings_GetReplay_sync] diff --git a/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/stub/simulatorstubsettings/getreplay/SyncGetReplay.java b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/stub/simulatorstubsettings/getreplay/SyncGetReplay.java new file mode 100644 index 000000000000..d2fa3f16e3c3 --- /dev/null +++ b/java-policysimulator/samples/snippets/generated/com/google/cloud/policysimulator/v1/stub/simulatorstubsettings/getreplay/SyncGetReplay.java @@ -0,0 +1,48 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.policysimulator.v1.stub.samples; + +// [START policysimulator_v1_generated_SimulatorStubSettings_GetReplay_sync] +import com.google.cloud.policysimulator.v1.stub.SimulatorStubSettings; +import java.time.Duration; + +public class SyncGetReplay { + + public static void main(String[] args) throws Exception { + syncGetReplay(); + } + + public static void syncGetReplay() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + SimulatorStubSettings.Builder simulatorSettingsBuilder = SimulatorStubSettings.newBuilder(); + simulatorSettingsBuilder + .getReplaySettings() + .setRetrySettings( + simulatorSettingsBuilder + .getReplaySettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + SimulatorStubSettings simulatorSettings = simulatorSettingsBuilder.build(); + } +} +// [END policysimulator_v1_generated_SimulatorStubSettings_GetReplay_sync] diff --git a/pom.xml b/pom.xml index 3bec9d8d7ce3..d6c7f8215913 100644 --- a/pom.xml +++ b/pom.xml @@ -126,6 +126,7 @@ java-os-config java-os-login java-phishingprotection + java-policysimulator java-policy-troubleshooter java-private-catalog java-profiler diff --git a/versions.txt b/versions.txt index e403e4e0d4eb..188f22a504dd 100644 --- a/versions.txt +++ b/versions.txt @@ -653,6 +653,9 @@ grpc-google-cloud-discoveryengine-v1:0.17.0:0.18.0-SNAPSHOT google-cloud-migrationcenter:0.3.0:0.4.0-SNAPSHOT proto-google-cloud-migrationcenter-v1:0.3.0:0.4.0-SNAPSHOT grpc-google-cloud-migrationcenter-v1:0.3.0:0.4.0-SNAPSHOT +google-cloud-policysimulator:0.0.0:0.0.1-SNAPSHOT +proto-google-cloud-policysimulator-v1:0.0.0:0.0.1-SNAPSHOT +grpc-google-cloud-policysimulator-v1:0.0.0:0.0.1-SNAPSHOT google-cloud-netapp:0.0.0:0.0.1-SNAPSHOT proto-google-cloud-netapp-v1beta1:0.0.0:0.0.1-SNAPSHOT grpc-google-cloud-netapp-v1beta1:0.0.0:0.0.1-SNAPSHOT