Class OrgPolicyViolationsPreviewServiceClient (0.49.0)

GitHub RepositoryProduct Reference

Service Description: Violations Preview API service for OrgPolicy.

An OrgPolicyViolationsPreview is a preview of the violations that will exist as soon as a proposed OrgPolicy change is submitted. To create an 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().

Methods
Method Description Method Variants

ListOrgPolicyViolationsPreviews

ListOrgPolicyViolationsPreviews lists each OrgPolicyViolationsPreview in an organization. Each 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.

  • listOrgPolicyViolationsPreviews(ListOrgPolicyViolationsPreviewsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listOrgPolicyViolationsPreviews(OrganizationLocationName parent)

  • listOrgPolicyViolationsPreviews(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listOrgPolicyViolationsPreviewsPagedCallable()

  • listOrgPolicyViolationsPreviewsCallable()

GetOrgPolicyViolationsPreview

GetOrgPolicyViolationsPreview gets the specified OrgPolicyViolationsPreview. Each 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.

  • getOrgPolicyViolationsPreview(GetOrgPolicyViolationsPreviewRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getOrgPolicyViolationsPreview(OrgPolicyViolationsPreviewName name)

  • getOrgPolicyViolationsPreview(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getOrgPolicyViolationsPreviewCallable()

CreateOrgPolicyViolationsPreview

CreateOrgPolicyViolationsPreview creates an 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.

  • createOrgPolicyViolationsPreviewAsync(CreateOrgPolicyViolationsPreviewRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createOrgPolicyViolationsPreviewAsync(OrganizationLocationName parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId)

  • createOrgPolicyViolationsPreviewAsync(String parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createOrgPolicyViolationsPreviewOperationCallable()

  • createOrgPolicyViolationsPreviewCallable()

ListOrgPolicyViolations

ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an OrgPolicyViolationsPreview.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listOrgPolicyViolations(ListOrgPolicyViolationsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listOrgPolicyViolations(OrgPolicyViolationsPreviewName parent)

  • listOrgPolicyViolations(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listOrgPolicyViolationsPagedCallable()

  • listOrgPolicyViolationsCallable()

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.

Inheritance

java.lang.Object > OrgPolicyViolationsPreviewServiceClient

Static Methods

create()

public static final OrgPolicyViolationsPreviewServiceClient create()

Constructs an instance of OrgPolicyViolationsPreviewServiceClient with default settings.

Returns
Type Description
OrgPolicyViolationsPreviewServiceClient
Exceptions
Type Description
IOException

create(OrgPolicyViolationsPreviewServiceSettings settings)

public static final OrgPolicyViolationsPreviewServiceClient create(OrgPolicyViolationsPreviewServiceSettings settings)

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.

Parameter
Name Description
settings OrgPolicyViolationsPreviewServiceSettings
Returns
Type Description
OrgPolicyViolationsPreviewServiceClient
Exceptions
Type Description
IOException

create(OrgPolicyViolationsPreviewServiceStub stub)

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).

Parameter
Name Description
stub OrgPolicyViolationsPreviewServiceStub
Returns
Type Description
OrgPolicyViolationsPreviewServiceClient

Constructors

OrgPolicyViolationsPreviewServiceClient(OrgPolicyViolationsPreviewServiceSettings settings)

protected OrgPolicyViolationsPreviewServiceClient(OrgPolicyViolationsPreviewServiceSettings settings)

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.

Parameter
Name Description
settings OrgPolicyViolationsPreviewServiceSettings

OrgPolicyViolationsPreviewServiceClient(OrgPolicyViolationsPreviewServiceStub stub)

protected OrgPolicyViolationsPreviewServiceClient(OrgPolicyViolationsPreviewServiceStub stub)
Parameter
Name Description
stub OrgPolicyViolationsPreviewServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createOrgPolicyViolationsPreviewAsync(CreateOrgPolicyViolationsPreviewRequest request)

public final OperationFuture<OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata> createOrgPolicyViolationsPreviewAsync(CreateOrgPolicyViolationsPreviewRequest request)

CreateOrgPolicyViolationsPreview creates an 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();
 }
 
Parameter
Name Description
request CreateOrgPolicyViolationsPreviewRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata>

createOrgPolicyViolationsPreviewAsync(OrganizationLocationName parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId)

public final OperationFuture<OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata> createOrgPolicyViolationsPreviewAsync(OrganizationLocationName parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId)

CreateOrgPolicyViolationsPreview creates an 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
Name Description
parent OrganizationLocationName

Required. The organization under which this OrgPolicyViolationsPreview will be created.

Example: organizations/my-example-org/locations/global

orgPolicyViolationsPreview OrgPolicyViolationsPreview

Required. The OrgPolicyViolationsPreview to generate.

orgPolicyViolationsPreviewId String

Optional. An optional user-specified ID for the OrgPolicyViolationsPreview. If not provided, a random ID will be generated.

Returns
Type Description
OperationFuture<OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata>

createOrgPolicyViolationsPreviewAsync(String parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId)

public final OperationFuture<OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata> createOrgPolicyViolationsPreviewAsync(String parent, OrgPolicyViolationsPreview orgPolicyViolationsPreview, String orgPolicyViolationsPreviewId)

CreateOrgPolicyViolationsPreview creates an 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
Name Description
parent String

Required. The organization under which this OrgPolicyViolationsPreview will be created.

Example: organizations/my-example-org/locations/global

orgPolicyViolationsPreview OrgPolicyViolationsPreview

Required. The OrgPolicyViolationsPreview to generate.

orgPolicyViolationsPreviewId String

Optional. An optional user-specified ID for the OrgPolicyViolationsPreview. If not provided, a random ID will be generated.

Returns
Type Description
OperationFuture<OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata>

createOrgPolicyViolationsPreviewCallable()

public final UnaryCallable<CreateOrgPolicyViolationsPreviewRequest,Operation> createOrgPolicyViolationsPreviewCallable()

CreateOrgPolicyViolationsPreview creates an 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();
 }
 
Returns
Type Description
UnaryCallable<CreateOrgPolicyViolationsPreviewRequest,Operation>

createOrgPolicyViolationsPreviewOperationCallable()

public final OperationCallable<CreateOrgPolicyViolationsPreviewRequest,OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata> createOrgPolicyViolationsPreviewOperationCallable()

CreateOrgPolicyViolationsPreview creates an 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();
 }
 
Returns
Type Description
OperationCallable<CreateOrgPolicyViolationsPreviewRequest,OrgPolicyViolationsPreview,CreateOrgPolicyViolationsPreviewOperationMetadata>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getOrgPolicyViolationsPreview(GetOrgPolicyViolationsPreviewRequest request)

public final OrgPolicyViolationsPreview getOrgPolicyViolationsPreview(GetOrgPolicyViolationsPreviewRequest request)

GetOrgPolicyViolationsPreview gets the specified OrgPolicyViolationsPreview. Each 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);
 }
 
Parameter
Name Description
request GetOrgPolicyViolationsPreviewRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OrgPolicyViolationsPreview

getOrgPolicyViolationsPreview(OrgPolicyViolationsPreviewName name)

public final OrgPolicyViolationsPreview getOrgPolicyViolationsPreview(OrgPolicyViolationsPreviewName name)

GetOrgPolicyViolationsPreview gets the specified OrgPolicyViolationsPreview. Each 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);
 }
 
Parameter
Name Description
name OrgPolicyViolationsPreviewName

Required. The name of the OrgPolicyViolationsPreview to get.

Returns
Type Description
OrgPolicyViolationsPreview

getOrgPolicyViolationsPreview(String name)

public final OrgPolicyViolationsPreview getOrgPolicyViolationsPreview(String name)

GetOrgPolicyViolationsPreview gets the specified OrgPolicyViolationsPreview. Each 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);
 }
 
Parameter
Name Description
name String

Required. The name of the OrgPolicyViolationsPreview to get.

Returns
Type Description
OrgPolicyViolationsPreview

getOrgPolicyViolationsPreviewCallable()

public final UnaryCallable<GetOrgPolicyViolationsPreviewRequest,OrgPolicyViolationsPreview> getOrgPolicyViolationsPreviewCallable()

GetOrgPolicyViolationsPreview gets the specified OrgPolicyViolationsPreview. Each 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();
 }
 
Returns
Type Description
UnaryCallable<GetOrgPolicyViolationsPreviewRequest,OrgPolicyViolationsPreview>

getSettings()

public final OrgPolicyViolationsPreviewServiceSettings getSettings()
Returns
Type Description
OrgPolicyViolationsPreviewServiceSettings

getStub()

public OrgPolicyViolationsPreviewServiceStub getStub()
Returns
Type Description
OrgPolicyViolationsPreviewServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listOrgPolicyViolations(ListOrgPolicyViolationsRequest request)

public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse listOrgPolicyViolations(ListOrgPolicyViolationsRequest request)

ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an 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);
   }
 }
 
Parameter
Name Description
request ListOrgPolicyViolationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse

listOrgPolicyViolations(OrgPolicyViolationsPreviewName parent)

public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse listOrgPolicyViolations(OrgPolicyViolationsPreviewName parent)

ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an 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);
   }
 }
 
Parameter
Name Description
parent OrgPolicyViolationsPreviewName

Required. The OrgPolicyViolationsPreview to get OrgPolicyViolations from. Format: organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview}

Returns
Type Description
OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse

listOrgPolicyViolations(String parent)

public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse listOrgPolicyViolations(String parent)

ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an 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);
   }
 }
 
Parameter
Name Description
parent String

Required. The OrgPolicyViolationsPreview to get OrgPolicyViolations from. Format: organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview}

Returns
Type Description
OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse

listOrgPolicyViolationsCallable()

public final UnaryCallable<ListOrgPolicyViolationsRequest,ListOrgPolicyViolationsResponse> listOrgPolicyViolationsCallable()

ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an 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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListOrgPolicyViolationsRequest,ListOrgPolicyViolationsResponse>

listOrgPolicyViolationsPagedCallable()

public final UnaryCallable<ListOrgPolicyViolationsRequest,OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPagedResponse> listOrgPolicyViolationsPagedCallable()

ListOrgPolicyViolations lists the [OrgPolicyViolations][] that are present in an 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);
   }
 }
 
Returns
Type Description
UnaryCallable<ListOrgPolicyViolationsRequest,ListOrgPolicyViolationsPagedResponse>

listOrgPolicyViolationsPreviews(ListOrgPolicyViolationsPreviewsRequest request)

public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse listOrgPolicyViolationsPreviews(ListOrgPolicyViolationsPreviewsRequest request)

ListOrgPolicyViolationsPreviews lists each OrgPolicyViolationsPreview in an organization. Each 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);
   }
 }
 
Parameter
Name Description
request ListOrgPolicyViolationsPreviewsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse

listOrgPolicyViolationsPreviews(OrganizationLocationName parent)

public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse listOrgPolicyViolationsPreviews(OrganizationLocationName parent)

ListOrgPolicyViolationsPreviews lists each OrgPolicyViolationsPreview in an organization. Each 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);
   }
 }
 
Parameter
Name Description
parent OrganizationLocationName

Required. The parent the violations are scoped to. Format: organizations/{organization}/locations/{location}

Example: organizations/my-example-org/locations/global

Returns
Type Description
OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse

listOrgPolicyViolationsPreviews(String parent)

public final OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse listOrgPolicyViolationsPreviews(String parent)

ListOrgPolicyViolationsPreviews lists each OrgPolicyViolationsPreview in an organization. Each 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);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent the violations are scoped to. Format: organizations/{organization}/locations/{location}

Example: organizations/my-example-org/locations/global

Returns
Type Description
OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse

listOrgPolicyViolationsPreviewsCallable()

public final UnaryCallable<ListOrgPolicyViolationsPreviewsRequest,ListOrgPolicyViolationsPreviewsResponse> listOrgPolicyViolationsPreviewsCallable()

ListOrgPolicyViolationsPreviews lists each OrgPolicyViolationsPreview in an organization. Each 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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListOrgPolicyViolationsPreviewsRequest,ListOrgPolicyViolationsPreviewsResponse>

listOrgPolicyViolationsPreviewsPagedCallable()

public final UnaryCallable<ListOrgPolicyViolationsPreviewsRequest,OrgPolicyViolationsPreviewServiceClient.ListOrgPolicyViolationsPreviewsPagedResponse> listOrgPolicyViolationsPreviewsPagedCallable()

ListOrgPolicyViolationsPreviews lists each OrgPolicyViolationsPreview in an organization. Each 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);
   }
 }
 
Returns
Type Description
UnaryCallable<ListOrgPolicyViolationsPreviewsRequest,ListOrgPolicyViolationsPreviewsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()