Package com.google.cloud.policysimulator.v1
The interfaces provided are listed below, along with usage samples.
======================= OrgPolicyViolationsPreviewServiceClient =======================
Service Description: Violations Preview API service for OrgPolicy.
An [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is a preview of the violations that will exist as soon as a proposed OrgPolicy change is submitted. To create an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview], the API user specifies the changes they wish to make and requests the generation of a preview via [GenerateViolationsPreview][]. the OrgPolicy Simulator service then scans the API user's currently existing resources to determine these resources violate the newly set OrgPolicy.
Sample for OrgPolicyViolationsPreviewServiceClient:
// 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient =
OrgPolicyViolationsPreviewServiceClient.create()) {
OrgPolicyViolationsPreviewName name =
OrgPolicyViolationsPreviewName.of(
"[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]");
OrgPolicyViolationsPreview response =
orgPolicyViolationsPreviewServiceClient.getOrgPolicyViolationsPreview(name);
}
======================= 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:
// 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);
}
-
ClassesClassDescriptionService Description: Violations Preview API service for OrgPolicy.Settings class to configure an instance of
OrgPolicyViolationsPreviewServiceClient.Builder for OrgPolicyViolationsPreviewServiceSettings.Service Description: Policy Simulator API service.Settings class to configure an instance ofSimulatorClient.Builder for SimulatorSettings.