Class OrgPolicyViolationsPreviewServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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.
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:
// 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);
}
Note: close() needs to be called on the OrgPolicyViolationsPreviewServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
ListOrgPolicyViolationsPreviews |
ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetOrgPolicyViolationsPreview |
GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateOrgPolicyViolationsPreview |
CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy are specified by this `OrgPolicyOverlay`. The resources to scan are inferred from these specified changes. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListOrgPolicyViolations |
ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return 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 OrgPolicyViolationsPreviewServiceSettings to create(). For example:
To customize credentials:
// 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
OrgPolicyViolationsPreviewServiceSettings orgPolicyViolationsPreviewServiceSettings =
OrgPolicyViolationsPreviewServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient =
OrgPolicyViolationsPreviewServiceClient.create(orgPolicyViolationsPreviewServiceSettings);
To customize the endpoint:
// 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
OrgPolicyViolationsPreviewServiceSettings orgPolicyViolationsPreviewServiceSettings =
OrgPolicyViolationsPreviewServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient =
OrgPolicyViolationsPreviewServiceClient.create(orgPolicyViolationsPreviewServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
OrgPolicyViolationsPreviewServiceSettings orgPolicyViolationsPreviewServiceSettings =
OrgPolicyViolationsPreviewServiceSettings.newHttpJsonBuilder().build();
OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient =
OrgPolicyViolationsPreviewServiceClient.create(orgPolicyViolationsPreviewServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of OrgPolicyViolationsPreviewServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final OrgPolicyViolationsPreviewServiceClientcreate()Constructs an instance of OrgPolicyViolationsPreviewServiceClient with default settings.static final OrgPolicyViolationsPreviewServiceClientConstructs an instance of OrgPolicyViolationsPreviewServiceClient, using the given settings.static final OrgPolicyViolationsPreviewServiceClientConstructs an instance of OrgPolicyViolationsPreviewServiceClient, using the given stub for making calls.CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][].createOrgPolicyViolationsPreviewAsync(OrganizationLocationName parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId) CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][].createOrgPolicyViolationsPreviewAsync(String parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId) CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][].CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][].final OperationCallable<CreateOrgPolicyViolationsPreviewRequest,OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][].final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].getStub()booleanbooleanListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].listOrgPolicyViolations(String parent) ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].final UnaryCallable<ListOrgPolicyViolationsRequest,OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse> ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization.ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization.ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization.ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization.final UnaryCallable<ListOrgPolicyViolationsPreviewsRequest,OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse> ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization.voidshutdown()void
-
Constructor Details
-
OrgPolicyViolationsPreviewServiceClient
protected OrgPolicyViolationsPreviewServiceClient(OrgPolicyViolationsPreviewServiceSettings settings) throws IOException Constructs an instance of OrgPolicyViolationsPreviewServiceClient, 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.- Throws:
IOException
-
OrgPolicyViolationsPreviewServiceClient
-
-
Method Details
-
create
Constructs an instance of OrgPolicyViolationsPreviewServiceClient with default settings.- Throws:
IOException
-
create
public static final OrgPolicyViolationsPreviewServiceClient create(OrgPolicyViolationsPreviewServiceSettings settings) throws IOException Constructs an instance of OrgPolicyViolationsPreviewServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
public static final OrgPolicyViolationsPreviewServiceClient create(OrgPolicyViolationsPreviewServiceStub stub) Constructs an instance of OrgPolicyViolationsPreviewServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(OrgPolicyViolationsPreviewServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
getHttpJsonOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
listOrgPolicyViolationsPreviews
public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse listOrgPolicyViolationsPreviews(OrganizationLocationName parent) ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); for (OrgPolicyViolationsPreview element : orgPolicyViolationsPreviewServiceClient .listOrgPolicyViolationsPreviews(parent) .iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent the violations are scoped to. Format: `organizations/{organization}/locations/{location}`Example: `organizations/my-example-org/locations/global`
- Throws:
ApiException- if the remote call fails
-
listOrgPolicyViolationsPreviews
public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse listOrgPolicyViolationsPreviews(String parent) ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { String parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString(); for (OrgPolicyViolationsPreview element : orgPolicyViolationsPreviewServiceClient .listOrgPolicyViolationsPreviews(parent) .iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent the violations are scoped to. Format: `organizations/{organization}/locations/{location}`Example: `organizations/my-example-org/locations/global`
- Throws:
ApiException- if the remote call fails
-
listOrgPolicyViolationsPreviews
public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse listOrgPolicyViolationsPreviews(ListOrgPolicyViolationsPreviewsRequest request) ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { ListOrgPolicyViolationsPreviewsRequest request = ListOrgPolicyViolationsPreviewsRequest.newBuilder() .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (OrgPolicyViolationsPreview element : orgPolicyViolationsPreviewServiceClient .listOrgPolicyViolationsPreviews(request) .iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listOrgPolicyViolationsPreviewsPagedCallable
public final UnaryCallable<ListOrgPolicyViolationsPreviewsRequest,OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse> listOrgPolicyViolationsPreviewsPagedCallable()ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { ListOrgPolicyViolationsPreviewsRequest request = ListOrgPolicyViolationsPreviewsRequest.newBuilder() .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<OrgPolicyViolationsPreview> future = orgPolicyViolationsPreviewServiceClient .listOrgPolicyViolationsPreviewsPagedCallable() .futureCall(request); // Do something. for (OrgPolicyViolationsPreview element : future.get().iterateAll()) { // doThingsWith(element); } } -
listOrgPolicyViolationsPreviewsCallable
public final UnaryCallable<ListOrgPolicyViolationsPreviewsRequest,ListOrgPolicyViolationsPreviewsResponse> listOrgPolicyViolationsPreviewsCallable()ListOrgPolicyViolationsPreviews lists each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] in an organization. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { ListOrgPolicyViolationsPreviewsRequest request = ListOrgPolicyViolationsPreviewsRequest.newBuilder() .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListOrgPolicyViolationsPreviewsResponse response = orgPolicyViolationsPreviewServiceClient .listOrgPolicyViolationsPreviewsCallable() .call(request); for (OrgPolicyViolationsPreview element : response.getOrgPolicyViolationsPreviewsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getOrgPolicyViolationsPreview
public final OrgPolicyViolationsPreview getOrgPolicyViolationsPreview(OrgPolicyViolationsPreviewName name) GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { OrgPolicyViolationsPreviewName name = OrgPolicyViolationsPreviewName.of( "[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]"); OrgPolicyViolationsPreview response = orgPolicyViolationsPreviewServiceClient.getOrgPolicyViolationsPreview(name); }- Parameters:
name- Required. The name of the OrgPolicyViolationsPreview to get.- Throws:
ApiException- if the remote call fails
-
getOrgPolicyViolationsPreview
GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { String name = OrgPolicyViolationsPreviewName.of( "[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]") .toString(); OrgPolicyViolationsPreview response = orgPolicyViolationsPreviewServiceClient.getOrgPolicyViolationsPreview(name); }- Parameters:
name- Required. The name of the OrgPolicyViolationsPreview to get.- Throws:
ApiException- if the remote call fails
-
getOrgPolicyViolationsPreview
public final OrgPolicyViolationsPreview getOrgPolicyViolationsPreview(GetOrgPolicyViolationsPreviewRequest request) GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { GetOrgPolicyViolationsPreviewRequest request = GetOrgPolicyViolationsPreviewRequest.newBuilder() .setName( OrgPolicyViolationsPreviewName.of( "[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]") .toString()) .build(); OrgPolicyViolationsPreview response = orgPolicyViolationsPreviewServiceClient.getOrgPolicyViolationsPreview(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getOrgPolicyViolationsPreviewCallable
public final UnaryCallable<GetOrgPolicyViolationsPreviewRequest,OrgPolicyViolationsPreview> getOrgPolicyViolationsPreviewCallable()GetOrgPolicyViolationsPreview gets the specified [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. Each [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] is available for at least 7 days.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { GetOrgPolicyViolationsPreviewRequest request = GetOrgPolicyViolationsPreviewRequest.newBuilder() .setName( OrgPolicyViolationsPreviewName.of( "[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]") .toString()) .build(); ApiFuture<OrgPolicyViolationsPreview> future = orgPolicyViolationsPreviewServiceClient .getOrgPolicyViolationsPreviewCallable() .futureCall(request); // Do something. OrgPolicyViolationsPreview response = future.get(); } -
createOrgPolicyViolationsPreviewAsync
public final OperationFuture<OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata> createOrgPolicyViolationsPreviewAsync(OrganizationLocationName parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId) CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy are specified by this `OrgPolicyOverlay`. The resources to scan are inferred from these specified changes.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]"); OrgPolicyViolationsPreview orgPolicyViolationsPreview = OrgPolicyViolationsPreview.newBuilder().build(); String orgPolicyViolationsPreviewId = "orgPolicyViolationsPreviewId2098912671"; OrgPolicyViolationsPreview response = orgPolicyViolationsPreviewServiceClient .createOrgPolicyViolationsPreviewAsync( parent, orgPolicyViolationsPreview, orgPolicyViolationsPreviewId) .get(); }- Parameters:
parent- Required. The organization under which this [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] will be created.Example: `organizations/my-example-org/locations/global`
orgPolicyViolationsPreview- Required. The [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] to generate.orgPolicyViolationsPreviewId- Optional. An optional user-specified ID for the [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. If not provided, a random ID will be generated.- Throws:
ApiException- if the remote call fails
-
createOrgPolicyViolationsPreviewAsync
public final OperationFuture<OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata> createOrgPolicyViolationsPreviewAsync(String parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId) CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy are specified by this `OrgPolicyOverlay`. The resources to scan are inferred from these specified changes.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { String parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString(); OrgPolicyViolationsPreview orgPolicyViolationsPreview = OrgPolicyViolationsPreview.newBuilder().build(); String orgPolicyViolationsPreviewId = "orgPolicyViolationsPreviewId2098912671"; OrgPolicyViolationsPreview response = orgPolicyViolationsPreviewServiceClient .createOrgPolicyViolationsPreviewAsync( parent, orgPolicyViolationsPreview, orgPolicyViolationsPreviewId) .get(); }- Parameters:
parent- Required. The organization under which this [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] will be created.Example: `organizations/my-example-org/locations/global`
orgPolicyViolationsPreview- Required. The [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] to generate.orgPolicyViolationsPreviewId- Optional. An optional user-specified ID for the [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview]. If not provided, a random ID will be generated.- Throws:
ApiException- if the remote call fails
-
createOrgPolicyViolationsPreviewAsync
public final OperationFuture<OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata> createOrgPolicyViolationsPreviewAsync(CreateOrgPolicyViolationsPreviewRequest request) CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy are specified by this `OrgPolicyOverlay`. The resources to scan are inferred from these specified changes.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { CreateOrgPolicyViolationsPreviewRequest request = CreateOrgPolicyViolationsPreviewRequest.newBuilder() .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setOrgPolicyViolationsPreview(OrgPolicyViolationsPreview.newBuilder().build()) .setOrgPolicyViolationsPreviewId("orgPolicyViolationsPreviewId2098912671") .build(); OrgPolicyViolationsPreview response = orgPolicyViolationsPreviewServiceClient .createOrgPolicyViolationsPreviewAsync(request) .get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createOrgPolicyViolationsPreviewOperationCallable
public final OperationCallable<CreateOrgPolicyViolationsPreviewRequest,OrgPolicyViolationsPreview, createOrgPolicyViolationsPreviewOperationCallable()CreateOrgPolicyViolationsPreviewOperationMetadata> CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy are specified by this `OrgPolicyOverlay`. The resources to scan are inferred from these specified changes.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { CreateOrgPolicyViolationsPreviewRequest request = CreateOrgPolicyViolationsPreviewRequest.newBuilder() .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setOrgPolicyViolationsPreview(OrgPolicyViolationsPreview.newBuilder().build()) .setOrgPolicyViolationsPreviewId("orgPolicyViolationsPreviewId2098912671") .build(); OperationFuture<OrgPolicyViolationsPreview, CreateOrgPolicyViolationsPreviewOperationMetadata> future = orgPolicyViolationsPreviewServiceClient .createOrgPolicyViolationsPreviewOperationCallable() .futureCall(request); // Do something. OrgPolicyViolationsPreview response = future.get(); } -
createOrgPolicyViolationsPreviewCallable
public final UnaryCallable<CreateOrgPolicyViolationsPreviewRequest,Operation> createOrgPolicyViolationsPreviewCallable()CreateOrgPolicyViolationsPreview creates an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview] for the proposed changes in the provided [OrgPolicyViolationsPreview.OrgPolicyOverlay][]. The changes to OrgPolicy are specified by this `OrgPolicyOverlay`. The resources to scan are inferred from these specified changes.Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { CreateOrgPolicyViolationsPreviewRequest request = CreateOrgPolicyViolationsPreviewRequest.newBuilder() .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString()) .setOrgPolicyViolationsPreview(OrgPolicyViolationsPreview.newBuilder().build()) .setOrgPolicyViolationsPreviewId("orgPolicyViolationsPreviewId2098912671") .build(); ApiFuture<Operation> future = orgPolicyViolationsPreviewServiceClient .createOrgPolicyViolationsPreviewCallable() .futureCall(request); // Do something. Operation response = future.get(); } -
listOrgPolicyViolations
public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse listOrgPolicyViolations(OrgPolicyViolationsPreviewName parent) ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { OrgPolicyViolationsPreviewName parent = OrgPolicyViolationsPreviewName.of( "[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]"); for (OrgPolicyViolation element : orgPolicyViolationsPreviewServiceClient.listOrgPolicyViolations(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The OrgPolicyViolationsPreview to get OrgPolicyViolations from. Format: organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview}- Throws:
ApiException- if the remote call fails
-
listOrgPolicyViolations
public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse listOrgPolicyViolations(String parent) ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { String parent = OrgPolicyViolationsPreviewName.of( "[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]") .toString(); for (OrgPolicyViolation element : orgPolicyViolationsPreviewServiceClient.listOrgPolicyViolations(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The OrgPolicyViolationsPreview to get OrgPolicyViolations from. Format: organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview}- Throws:
ApiException- if the remote call fails
-
listOrgPolicyViolations
public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse listOrgPolicyViolations(ListOrgPolicyViolationsRequest request) ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { ListOrgPolicyViolationsRequest request = ListOrgPolicyViolationsRequest.newBuilder() .setParent( OrgPolicyViolationsPreviewName.of( "[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]") .toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (OrgPolicyViolation element : orgPolicyViolationsPreviewServiceClient.listOrgPolicyViolations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listOrgPolicyViolationsPagedCallable
public final UnaryCallable<ListOrgPolicyViolationsRequest,OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse> listOrgPolicyViolationsPagedCallable()ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { ListOrgPolicyViolationsRequest request = ListOrgPolicyViolationsRequest.newBuilder() .setParent( OrgPolicyViolationsPreviewName.of( "[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]") .toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<OrgPolicyViolation> future = orgPolicyViolationsPreviewServiceClient .listOrgPolicyViolationsPagedCallable() .futureCall(request); // Do something. for (OrgPolicyViolation element : future.get().iterateAll()) { // doThingsWith(element); } } -
listOrgPolicyViolationsCallable
public final UnaryCallable<ListOrgPolicyViolationsRequest,ListOrgPolicyViolationsResponse> listOrgPolicyViolationsCallable()ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an [OrgPolicyViolationsPreview][google.cloud.policysimulator.v1.OrgPolicyViolationsPreview].Sample 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 (OrgPolicyViolationsPreviewServiceClient orgPolicyViolationsPreviewServiceClient = OrgPolicyViolationsPreviewServiceClient.create()) { ListOrgPolicyViolationsRequest request = ListOrgPolicyViolationsRequest.newBuilder() .setParent( OrgPolicyViolationsPreviewName.of( "[ORGANIZATION]", "[LOCATION]", "[ORG_POLICY_VIOLATIONS_PREVIEW]") .toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListOrgPolicyViolationsResponse response = orgPolicyViolationsPreviewServiceClient.listOrgPolicyViolationsCallable().call(request); for (OrgPolicyViolation element : response.getOrgPolicyViolationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-