Class RecaptchaEnterpriseServiceClient

java.lang.Object
com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class RecaptchaEnterpriseServiceClient extends Object implements BackgroundResource
Service Description: Service to determine the likelihood an event is legitimate.

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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   Assessment assessment = Assessment.newBuilder().build();
   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
 }
 

Note: close() needs to be called on the RecaptchaEnterpriseServiceClient 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

CreateAssessment

Creates an Assessment of the likelihood an event is legitimate.

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

  • createAssessment(CreateAssessmentRequest request)

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

  • createAssessment(ProjectName parent, Assessment assessment)

  • createAssessment(String parent, Assessment assessment)

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

  • createAssessmentCallable()

AnnotateAssessment

Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

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

  • annotateAssessment(AnnotateAssessmentRequest request)

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

  • annotateAssessment(AssessmentName name, AnnotateAssessmentRequest.Annotation annotation)

  • annotateAssessment(String name, AnnotateAssessmentRequest.Annotation annotation)

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

  • annotateAssessmentCallable()

CreateKey

Creates a new reCAPTCHA Enterprise key.

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

  • createKey(CreateKeyRequest request)

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

  • createKey(ProjectName parent, Key key)

  • createKey(String parent, Key key)

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

  • createKeyCallable()

ListKeys

Returns the list of all keys that belong to a project.

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

  • listKeys(ListKeysRequest request)

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

  • listKeys(ProjectName parent)

  • listKeys(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.

  • listKeysPagedCallable()

  • listKeysCallable()

RetrieveLegacySecretKey

Returns the secret key related to the specified public key. You must use the legacy secret key only in a 3rd party integration with legacy reCAPTCHA.

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

  • retrieveLegacySecretKey(RetrieveLegacySecretKeyRequest request)

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

  • retrieveLegacySecretKey(KeyName key)

  • retrieveLegacySecretKey(String key)

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

  • retrieveLegacySecretKeyCallable()

GetKey

Returns the specified key.

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

  • getKey(GetKeyRequest request)

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

  • getKey(KeyName name)

  • getKey(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.

  • getKeyCallable()

UpdateKey

Updates the specified key.

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

  • updateKey(UpdateKeyRequest request)

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

  • updateKey(Key key, FieldMask updateMask)

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

  • updateKeyCallable()

DeleteKey

Deletes the specified key.

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

  • deleteKey(DeleteKeyRequest request)

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

  • deleteKey(KeyName name)

  • deleteKey(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.

  • deleteKeyCallable()

MigrateKey

Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a key is migrated, it can be used from either product. SiteVerify requests are billed as CreateAssessment calls. You must be authenticated as one of the current owners of the reCAPTCHA Key, and your user must have the reCAPTCHA Enterprise Admin IAM role in the destination project.

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

  • migrateKey(MigrateKeyRequest request)

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

  • migrateKeyCallable()

AddIpOverride

Adds an IP override to a key. The following restrictions hold:

  • The maximum number of IP overrides per key is 1000.
  • For any conflict (such as IP already exists or IP part of an existing IP range), an error is returned.

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

  • addIpOverride(AddIpOverrideRequest request)

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

  • addIpOverride(KeyName name, IpOverrideData ipOverrideData)

  • addIpOverride(String name, IpOverrideData ipOverrideData)

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

  • addIpOverrideCallable()

RemoveIpOverride

Removes an IP override from a key. The following restrictions hold:

  • If the IP isn't found in an existing IP override, a `NOT_FOUND` error is returned.
  • If the IP is found in an existing IP override, but the override type does not match, a `NOT_FOUND` error is returned.

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

  • removeIpOverride(RemoveIpOverrideRequest request)

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

  • removeIpOverride(KeyName name, IpOverrideData ipOverrideData)

  • removeIpOverride(String name, IpOverrideData ipOverrideData)

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

  • removeIpOverrideCallable()

ListIpOverrides

Lists all IP overrides for a key.

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

  • listIpOverrides(ListIpOverridesRequest request)

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

  • listIpOverrides(KeyName parent)

  • listIpOverrides(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.

  • listIpOverridesPagedCallable()

  • listIpOverridesCallable()

GetMetrics

Get some aggregated metrics for a Key. This data can be used to build dashboards.

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

  • getMetrics(GetMetricsRequest request)

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

  • getMetrics(MetricsName name)

  • getMetrics(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.

  • getMetricsCallable()

CreateFirewallPolicy

Creates a new FirewallPolicy, specifying conditions at which reCAPTCHA Enterprise actions can be executed. A project may have a maximum of 1000 policies.

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

  • createFirewallPolicy(CreateFirewallPolicyRequest request)

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

  • createFirewallPolicy(ProjectName parent, FirewallPolicy firewallPolicy)

  • createFirewallPolicy(String parent, FirewallPolicy firewallPolicy)

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

  • createFirewallPolicyCallable()

ListFirewallPolicies

Returns the list of all firewall policies that belong to a project.

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

  • listFirewallPolicies(ListFirewallPoliciesRequest request)

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

  • listFirewallPolicies(ProjectName parent)

  • listFirewallPolicies(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.

  • listFirewallPoliciesPagedCallable()

  • listFirewallPoliciesCallable()

GetFirewallPolicy

Returns the specified firewall policy.

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

  • getFirewallPolicy(GetFirewallPolicyRequest request)

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

  • getFirewallPolicy(FirewallPolicyName name)

  • getFirewallPolicy(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.

  • getFirewallPolicyCallable()

UpdateFirewallPolicy

Updates the specified firewall policy.

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

  • updateFirewallPolicy(UpdateFirewallPolicyRequest request)

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

  • updateFirewallPolicy(FirewallPolicy firewallPolicy, FieldMask updateMask)

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

  • updateFirewallPolicyCallable()

DeleteFirewallPolicy

Deletes the specified firewall policy.

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

  • deleteFirewallPolicy(DeleteFirewallPolicyRequest request)

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

  • deleteFirewallPolicy(FirewallPolicyName name)

  • deleteFirewallPolicy(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.

  • deleteFirewallPolicyCallable()

ReorderFirewallPolicies

Reorders all firewall policies.

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

  • reorderFirewallPolicies(ReorderFirewallPoliciesRequest request)

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

  • reorderFirewallPolicies(ProjectName parent, List<String> names)

  • reorderFirewallPolicies(String parent, List<String> names)

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

  • reorderFirewallPoliciesCallable()

ListRelatedAccountGroups

List groups of related accounts.

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

  • listRelatedAccountGroups(ListRelatedAccountGroupsRequest request)

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

  • listRelatedAccountGroups(ProjectName parent)

  • listRelatedAccountGroups(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.

  • listRelatedAccountGroupsPagedCallable()

  • listRelatedAccountGroupsCallable()

ListRelatedAccountGroupMemberships

Get memberships in a group of related accounts.

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

  • listRelatedAccountGroupMemberships(ListRelatedAccountGroupMembershipsRequest request)

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

  • listRelatedAccountGroupMemberships(RelatedAccountGroupName parent)

  • listRelatedAccountGroupMemberships(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.

  • listRelatedAccountGroupMembershipsPagedCallable()

  • listRelatedAccountGroupMembershipsCallable()

SearchRelatedAccountGroupMemberships

Search group memberships related to a given account.

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

  • searchRelatedAccountGroupMemberships(SearchRelatedAccountGroupMembershipsRequest request)

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

  • searchRelatedAccountGroupMemberships(ProjectName project, ByteString hashedAccountId)

  • searchRelatedAccountGroupMemberships(String project, ByteString hashedAccountId)

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

  • searchRelatedAccountGroupMembershipsPagedCallable()

  • searchRelatedAccountGroupMembershipsCallable()

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 RecaptchaEnterpriseServiceSettings 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
 RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings =
     RecaptchaEnterpriseServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create(recaptchaEnterpriseServiceSettings);
 

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
 RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings =
     RecaptchaEnterpriseServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
     RecaptchaEnterpriseServiceClient.create(recaptchaEnterpriseServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

  • Constructor Details

    • RecaptchaEnterpriseServiceClient

      protected RecaptchaEnterpriseServiceClient(RecaptchaEnterpriseServiceSettings settings) throws IOException
      Constructs an instance of RecaptchaEnterpriseServiceClient, 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
    • RecaptchaEnterpriseServiceClient

      protected RecaptchaEnterpriseServiceClient(RecaptchaEnterpriseServiceStub stub)
  • Method Details

    • create

      public static final RecaptchaEnterpriseServiceClient create() throws IOException
      Constructs an instance of RecaptchaEnterpriseServiceClient with default settings.
      Throws:
      IOException
    • create

      Constructs an instance of RecaptchaEnterpriseServiceClient, 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

      Constructs an instance of RecaptchaEnterpriseServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(RecaptchaEnterpriseServiceSettings).
    • getSettings

      public final RecaptchaEnterpriseServiceSettings getSettings()
    • getStub

    • createAssessment

      public final Assessment createAssessment(ProjectName parent, Assessment assessment)
      Creates an Assessment of the likelihood an event is legitimate.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         Assessment assessment = Assessment.newBuilder().build();
         Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
       }
       
      Parameters:
      parent - Required. The name of the project in which the assessment is created, in the format `projects/{project}`.
      assessment - Required. The assessment details.
      Throws:
      ApiException - if the remote call fails
    • createAssessment

      public final Assessment createAssessment(String parent, Assessment assessment)
      Creates an Assessment of the likelihood an event is legitimate.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         Assessment assessment = Assessment.newBuilder().build();
         Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
       }
       
      Parameters:
      parent - Required. The name of the project in which the assessment is created, in the format `projects/{project}`.
      assessment - Required. The assessment details.
      Throws:
      ApiException - if the remote call fails
    • createAssessment

      public final Assessment createAssessment(CreateAssessmentRequest request)
      Creates an Assessment of the likelihood an event is legitimate.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         CreateAssessmentRequest request =
             CreateAssessmentRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setAssessment(Assessment.newBuilder().build())
                 .build();
         Assessment response = recaptchaEnterpriseServiceClient.createAssessment(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createAssessmentCallable

      public final UnaryCallable<CreateAssessmentRequest,Assessment> createAssessmentCallable()
      Creates an Assessment of the likelihood an event is legitimate.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         CreateAssessmentRequest request =
             CreateAssessmentRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setAssessment(Assessment.newBuilder().build())
                 .build();
         ApiFuture<Assessment> future =
             recaptchaEnterpriseServiceClient.createAssessmentCallable().futureCall(request);
         // Do something.
         Assessment response = future.get();
       }
       
    • annotateAssessment

      public final AnnotateAssessmentResponse annotateAssessment(AssessmentName name, AnnotateAssessmentRequest.Annotation annotation)
      Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
         AnnotateAssessmentRequest.Annotation annotation =
             AnnotateAssessmentRequest.Annotation.forNumber(0);
         AnnotateAssessmentResponse response =
             recaptchaEnterpriseServiceClient.annotateAssessment(name, annotation);
       }
       
      Parameters:
      name - Required. The resource name of the Assessment, in the format `projects/{project}/assessments/{assessment}`.
      annotation - Optional. The annotation that is assigned to the Event. This field can be left empty to provide reasons that apply to an event without concluding whether the event is legitimate or fraudulent.
      Throws:
      ApiException - if the remote call fails
    • annotateAssessment

      public final AnnotateAssessmentResponse annotateAssessment(String name, AnnotateAssessmentRequest.Annotation annotation)
      Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString();
         AnnotateAssessmentRequest.Annotation annotation =
             AnnotateAssessmentRequest.Annotation.forNumber(0);
         AnnotateAssessmentResponse response =
             recaptchaEnterpriseServiceClient.annotateAssessment(name, annotation);
       }
       
      Parameters:
      name - Required. The resource name of the Assessment, in the format `projects/{project}/assessments/{assessment}`.
      annotation - Optional. The annotation that is assigned to the Event. This field can be left empty to provide reasons that apply to an event without concluding whether the event is legitimate or fraudulent.
      Throws:
      ApiException - if the remote call fails
    • annotateAssessment

      public final AnnotateAssessmentResponse annotateAssessment(AnnotateAssessmentRequest request)
      Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         AnnotateAssessmentRequest request =
             AnnotateAssessmentRequest.newBuilder()
                 .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString())
                 .addAllReasons(new ArrayList<AnnotateAssessmentRequest.Reason>())
                 .setAccountId("accountId-1827029976")
                 .setHashedAccountId(ByteString.EMPTY)
                 .setTransactionEvent(TransactionEvent.newBuilder().build())
                 .setPhoneAuthenticationEvent(PhoneAuthenticationEvent.newBuilder().build())
                 .build();
         AnnotateAssessmentResponse response =
             recaptchaEnterpriseServiceClient.annotateAssessment(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • annotateAssessmentCallable

      public final UnaryCallable<AnnotateAssessmentRequest,AnnotateAssessmentResponse> annotateAssessmentCallable()
      Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         AnnotateAssessmentRequest request =
             AnnotateAssessmentRequest.newBuilder()
                 .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString())
                 .addAllReasons(new ArrayList<AnnotateAssessmentRequest.Reason>())
                 .setAccountId("accountId-1827029976")
                 .setHashedAccountId(ByteString.EMPTY)
                 .setTransactionEvent(TransactionEvent.newBuilder().build())
                 .setPhoneAuthenticationEvent(PhoneAuthenticationEvent.newBuilder().build())
                 .build();
         ApiFuture<AnnotateAssessmentResponse> future =
             recaptchaEnterpriseServiceClient.annotateAssessmentCallable().futureCall(request);
         // Do something.
         AnnotateAssessmentResponse response = future.get();
       }
       
    • createKey

      public final Key createKey(ProjectName parent, Key key)
      Creates a new reCAPTCHA Enterprise key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         Key key = Key.newBuilder().build();
         Key response = recaptchaEnterpriseServiceClient.createKey(parent, key);
       }
       
      Parameters:
      parent - Required. The name of the project in which the key is created, in the format `projects/{project}`.
      key - Required. Information to create a reCAPTCHA Enterprise key.
      Throws:
      ApiException - if the remote call fails
    • createKey

      public final Key createKey(String parent, Key key)
      Creates a new reCAPTCHA Enterprise key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         Key key = Key.newBuilder().build();
         Key response = recaptchaEnterpriseServiceClient.createKey(parent, key);
       }
       
      Parameters:
      parent - Required. The name of the project in which the key is created, in the format `projects/{project}`.
      key - Required. Information to create a reCAPTCHA Enterprise key.
      Throws:
      ApiException - if the remote call fails
    • createKey

      public final Key createKey(CreateKeyRequest request)
      Creates a new reCAPTCHA Enterprise key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         CreateKeyRequest request =
             CreateKeyRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setKey(Key.newBuilder().build())
                 .build();
         Key response = recaptchaEnterpriseServiceClient.createKey(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createKeyCallable

      public final UnaryCallable<CreateKeyRequest,Key> createKeyCallable()
      Creates a new reCAPTCHA Enterprise key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         CreateKeyRequest request =
             CreateKeyRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setKey(Key.newBuilder().build())
                 .build();
         ApiFuture<Key> future =
             recaptchaEnterpriseServiceClient.createKeyCallable().futureCall(request);
         // Do something.
         Key response = future.get();
       }
       
    • listKeys

      Returns the list of all keys that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         for (Key element : recaptchaEnterpriseServiceClient.listKeys(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The name of the project that contains the keys that is listed, in the format `projects/{project}`.
      Throws:
      ApiException - if the remote call fails
    • listKeys

      Returns the list of all keys that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         for (Key element : recaptchaEnterpriseServiceClient.listKeys(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The name of the project that contains the keys that is listed, in the format `projects/{project}`.
      Throws:
      ApiException - if the remote call fails
    • listKeys

      Returns the list of all keys that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListKeysRequest request =
             ListKeysRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Key element : recaptchaEnterpriseServiceClient.listKeys(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
    • listKeysPagedCallable

      Returns the list of all keys that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListKeysRequest request =
             ListKeysRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Key> future =
             recaptchaEnterpriseServiceClient.listKeysPagedCallable().futureCall(request);
         // Do something.
         for (Key element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listKeysCallable

      public final UnaryCallable<ListKeysRequest,ListKeysResponse> listKeysCallable()
      Returns the list of all keys that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListKeysRequest request =
             ListKeysRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListKeysResponse response =
               recaptchaEnterpriseServiceClient.listKeysCallable().call(request);
           for (Key element : response.getKeysList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • retrieveLegacySecretKey

      public final RetrieveLegacySecretKeyResponse retrieveLegacySecretKey(KeyName key)
      Returns the secret key related to the specified public key. You must use the legacy secret key only in a 3rd party integration with legacy reCAPTCHA.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         KeyName key = KeyName.of("[PROJECT]", "[KEY]");
         RetrieveLegacySecretKeyResponse response =
             recaptchaEnterpriseServiceClient.retrieveLegacySecretKey(key);
       }
       
      Parameters:
      key - Required. The public key name linked to the requested secret key in the format `projects/{project}/keys/{key}`.
      Throws:
      ApiException - if the remote call fails
    • retrieveLegacySecretKey

      public final RetrieveLegacySecretKeyResponse retrieveLegacySecretKey(String key)
      Returns the secret key related to the specified public key. You must use the legacy secret key only in a 3rd party integration with legacy reCAPTCHA.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String key = KeyName.of("[PROJECT]", "[KEY]").toString();
         RetrieveLegacySecretKeyResponse response =
             recaptchaEnterpriseServiceClient.retrieveLegacySecretKey(key);
       }
       
      Parameters:
      key - Required. The public key name linked to the requested secret key in the format `projects/{project}/keys/{key}`.
      Throws:
      ApiException - if the remote call fails
    • retrieveLegacySecretKey

      public final RetrieveLegacySecretKeyResponse retrieveLegacySecretKey(RetrieveLegacySecretKeyRequest request)
      Returns the secret key related to the specified public key. You must use the legacy secret key only in a 3rd party integration with legacy reCAPTCHA.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         RetrieveLegacySecretKeyRequest request =
             RetrieveLegacySecretKeyRequest.newBuilder()
                 .setKey(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .build();
         RetrieveLegacySecretKeyResponse response =
             recaptchaEnterpriseServiceClient.retrieveLegacySecretKey(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • retrieveLegacySecretKeyCallable

      public final UnaryCallable<RetrieveLegacySecretKeyRequest,RetrieveLegacySecretKeyResponse> retrieveLegacySecretKeyCallable()
      Returns the secret key related to the specified public key. You must use the legacy secret key only in a 3rd party integration with legacy reCAPTCHA.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         RetrieveLegacySecretKeyRequest request =
             RetrieveLegacySecretKeyRequest.newBuilder()
                 .setKey(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .build();
         ApiFuture<RetrieveLegacySecretKeyResponse> future =
             recaptchaEnterpriseServiceClient.retrieveLegacySecretKeyCallable().futureCall(request);
         // Do something.
         RetrieveLegacySecretKeyResponse response = future.get();
       }
       
    • getKey

      public final Key getKey(KeyName name)
      Returns the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         KeyName name = KeyName.of("[PROJECT]", "[KEY]");
         Key response = recaptchaEnterpriseServiceClient.getKey(name);
       }
       
      Parameters:
      name - Required. The name of the requested key, in the format `projects/{project}/keys/{key}`.
      Throws:
      ApiException - if the remote call fails
    • getKey

      public final Key getKey(String name)
      Returns the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String name = KeyName.of("[PROJECT]", "[KEY]").toString();
         Key response = recaptchaEnterpriseServiceClient.getKey(name);
       }
       
      Parameters:
      name - Required. The name of the requested key, in the format `projects/{project}/keys/{key}`.
      Throws:
      ApiException - if the remote call fails
    • getKey

      public final Key getKey(GetKeyRequest request)
      Returns the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         GetKeyRequest request =
             GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build();
         Key response = recaptchaEnterpriseServiceClient.getKey(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getKeyCallable

      public final UnaryCallable<GetKeyRequest,Key> getKeyCallable()
      Returns the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         GetKeyRequest request =
             GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build();
         ApiFuture<Key> future = recaptchaEnterpriseServiceClient.getKeyCallable().futureCall(request);
         // Do something.
         Key response = future.get();
       }
       
    • updateKey

      public final Key updateKey(Key key, com.google.protobuf.FieldMask updateMask)
      Updates the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         Key key = Key.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         Key response = recaptchaEnterpriseServiceClient.updateKey(key, updateMask);
       }
       
      Parameters:
      key - Required. The key to update.
      updateMask - Optional. The mask to control which fields of the key get updated. If the mask is not present, all fields are updated.
      Throws:
      ApiException - if the remote call fails
    • updateKey

      public final Key updateKey(UpdateKeyRequest request)
      Updates the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         UpdateKeyRequest request =
             UpdateKeyRequest.newBuilder()
                 .setKey(Key.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Key response = recaptchaEnterpriseServiceClient.updateKey(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateKeyCallable

      public final UnaryCallable<UpdateKeyRequest,Key> updateKeyCallable()
      Updates the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         UpdateKeyRequest request =
             UpdateKeyRequest.newBuilder()
                 .setKey(Key.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Key> future =
             recaptchaEnterpriseServiceClient.updateKeyCallable().futureCall(request);
         // Do something.
         Key response = future.get();
       }
       
    • deleteKey

      public final void deleteKey(KeyName name)
      Deletes the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         KeyName name = KeyName.of("[PROJECT]", "[KEY]");
         recaptchaEnterpriseServiceClient.deleteKey(name);
       }
       
      Parameters:
      name - Required. The name of the key to be deleted, in the format `projects/{project}/keys/{key}`.
      Throws:
      ApiException - if the remote call fails
    • deleteKey

      public final void deleteKey(String name)
      Deletes the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String name = KeyName.of("[PROJECT]", "[KEY]").toString();
         recaptchaEnterpriseServiceClient.deleteKey(name);
       }
       
      Parameters:
      name - Required. The name of the key to be deleted, in the format `projects/{project}/keys/{key}`.
      Throws:
      ApiException - if the remote call fails
    • deleteKey

      public final void deleteKey(DeleteKeyRequest request)
      Deletes the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         DeleteKeyRequest request =
             DeleteKeyRequest.newBuilder()
                 .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .build();
         recaptchaEnterpriseServiceClient.deleteKey(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteKeyCallable

      public final UnaryCallable<DeleteKeyRequest,com.google.protobuf.Empty> deleteKeyCallable()
      Deletes the specified key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         DeleteKeyRequest request =
             DeleteKeyRequest.newBuilder()
                 .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .build();
         ApiFuture<Empty> future =
             recaptchaEnterpriseServiceClient.deleteKeyCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • migrateKey

      public final Key migrateKey(MigrateKeyRequest request)
      Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a key is migrated, it can be used from either product. SiteVerify requests are billed as CreateAssessment calls. You must be authenticated as one of the current owners of the reCAPTCHA Key, and your user must have the reCAPTCHA Enterprise Admin IAM role in the destination project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         MigrateKeyRequest request =
             MigrateKeyRequest.newBuilder()
                 .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .setSkipBillingCheck(true)
                 .build();
         Key response = recaptchaEnterpriseServiceClient.migrateKey(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • migrateKeyCallable

      public final UnaryCallable<MigrateKeyRequest,Key> migrateKeyCallable()
      Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a key is migrated, it can be used from either product. SiteVerify requests are billed as CreateAssessment calls. You must be authenticated as one of the current owners of the reCAPTCHA Key, and your user must have the reCAPTCHA Enterprise Admin IAM role in the destination project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         MigrateKeyRequest request =
             MigrateKeyRequest.newBuilder()
                 .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .setSkipBillingCheck(true)
                 .build();
         ApiFuture<Key> future =
             recaptchaEnterpriseServiceClient.migrateKeyCallable().futureCall(request);
         // Do something.
         Key response = future.get();
       }
       
    • addIpOverride

      public final AddIpOverrideResponse addIpOverride(KeyName name, IpOverrideData ipOverrideData)
      Adds an IP override to a key. The following restrictions hold:
      • The maximum number of IP overrides per key is 1000.
      • For any conflict (such as IP already exists or IP part of an existing IP range), an error is returned.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         KeyName name = KeyName.of("[PROJECT]", "[KEY]");
         IpOverrideData ipOverrideData = IpOverrideData.newBuilder().build();
         AddIpOverrideResponse response =
             recaptchaEnterpriseServiceClient.addIpOverride(name, ipOverrideData);
       }
       
      Parameters:
      name - Required. The name of the key to which the IP override is added, in the format `projects/{project}/keys/{key}`.
      ipOverrideData - Required. IP override added to the key.
      Throws:
      ApiException - if the remote call fails
    • addIpOverride

      public final AddIpOverrideResponse addIpOverride(String name, IpOverrideData ipOverrideData)
      Adds an IP override to a key. The following restrictions hold:
      • The maximum number of IP overrides per key is 1000.
      • For any conflict (such as IP already exists or IP part of an existing IP range), an error is returned.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String name = KeyName.of("[PROJECT]", "[KEY]").toString();
         IpOverrideData ipOverrideData = IpOverrideData.newBuilder().build();
         AddIpOverrideResponse response =
             recaptchaEnterpriseServiceClient.addIpOverride(name, ipOverrideData);
       }
       
      Parameters:
      name - Required. The name of the key to which the IP override is added, in the format `projects/{project}/keys/{key}`.
      ipOverrideData - Required. IP override added to the key.
      Throws:
      ApiException - if the remote call fails
    • addIpOverride

      public final AddIpOverrideResponse addIpOverride(AddIpOverrideRequest request)
      Adds an IP override to a key. The following restrictions hold:
      • The maximum number of IP overrides per key is 1000.
      • For any conflict (such as IP already exists or IP part of an existing IP range), an error is returned.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         AddIpOverrideRequest request =
             AddIpOverrideRequest.newBuilder()
                 .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .setIpOverrideData(IpOverrideData.newBuilder().build())
                 .build();
         AddIpOverrideResponse response = recaptchaEnterpriseServiceClient.addIpOverride(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • addIpOverrideCallable

      public final UnaryCallable<AddIpOverrideRequest,AddIpOverrideResponse> addIpOverrideCallable()
      Adds an IP override to a key. The following restrictions hold:
      • The maximum number of IP overrides per key is 1000.
      • For any conflict (such as IP already exists or IP part of an existing IP range), an error is returned.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         AddIpOverrideRequest request =
             AddIpOverrideRequest.newBuilder()
                 .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .setIpOverrideData(IpOverrideData.newBuilder().build())
                 .build();
         ApiFuture<AddIpOverrideResponse> future =
             recaptchaEnterpriseServiceClient.addIpOverrideCallable().futureCall(request);
         // Do something.
         AddIpOverrideResponse response = future.get();
       }
       
    • removeIpOverride

      public final RemoveIpOverrideResponse removeIpOverride(KeyName name, IpOverrideData ipOverrideData)
      Removes an IP override from a key. The following restrictions hold:
      • If the IP isn't found in an existing IP override, a `NOT_FOUND` error is returned.
      • If the IP is found in an existing IP override, but the override type does not match, a `NOT_FOUND` error is returned.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         KeyName name = KeyName.of("[PROJECT]", "[KEY]");
         IpOverrideData ipOverrideData = IpOverrideData.newBuilder().build();
         RemoveIpOverrideResponse response =
             recaptchaEnterpriseServiceClient.removeIpOverride(name, ipOverrideData);
       }
       
      Parameters:
      name - Required. The name of the key from which the IP override is removed, in the format `projects/{project}/keys/{key}`.
      ipOverrideData - Required. IP override to be removed from the key.
      Throws:
      ApiException - if the remote call fails
    • removeIpOverride

      public final RemoveIpOverrideResponse removeIpOverride(String name, IpOverrideData ipOverrideData)
      Removes an IP override from a key. The following restrictions hold:
      • If the IP isn't found in an existing IP override, a `NOT_FOUND` error is returned.
      • If the IP is found in an existing IP override, but the override type does not match, a `NOT_FOUND` error is returned.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String name = KeyName.of("[PROJECT]", "[KEY]").toString();
         IpOverrideData ipOverrideData = IpOverrideData.newBuilder().build();
         RemoveIpOverrideResponse response =
             recaptchaEnterpriseServiceClient.removeIpOverride(name, ipOverrideData);
       }
       
      Parameters:
      name - Required. The name of the key from which the IP override is removed, in the format `projects/{project}/keys/{key}`.
      ipOverrideData - Required. IP override to be removed from the key.
      Throws:
      ApiException - if the remote call fails
    • removeIpOverride

      public final RemoveIpOverrideResponse removeIpOverride(RemoveIpOverrideRequest request)
      Removes an IP override from a key. The following restrictions hold:
      • If the IP isn't found in an existing IP override, a `NOT_FOUND` error is returned.
      • If the IP is found in an existing IP override, but the override type does not match, a `NOT_FOUND` error is returned.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         RemoveIpOverrideRequest request =
             RemoveIpOverrideRequest.newBuilder()
                 .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .setIpOverrideData(IpOverrideData.newBuilder().build())
                 .build();
         RemoveIpOverrideResponse response =
             recaptchaEnterpriseServiceClient.removeIpOverride(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • removeIpOverrideCallable

      public final UnaryCallable<RemoveIpOverrideRequest,RemoveIpOverrideResponse> removeIpOverrideCallable()
      Removes an IP override from a key. The following restrictions hold:
      • If the IP isn't found in an existing IP override, a `NOT_FOUND` error is returned.
      • If the IP is found in an existing IP override, but the override type does not match, a `NOT_FOUND` error is returned.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         RemoveIpOverrideRequest request =
             RemoveIpOverrideRequest.newBuilder()
                 .setName(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .setIpOverrideData(IpOverrideData.newBuilder().build())
                 .build();
         ApiFuture<RemoveIpOverrideResponse> future =
             recaptchaEnterpriseServiceClient.removeIpOverrideCallable().futureCall(request);
         // Do something.
         RemoveIpOverrideResponse response = future.get();
       }
       
    • listIpOverrides

      Lists all IP overrides for a key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         KeyName parent = KeyName.of("[PROJECT]", "[KEY]");
         for (IpOverrideData element :
             recaptchaEnterpriseServiceClient.listIpOverrides(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent key for which the IP overrides are listed, in the format `projects/{project}/keys/{key}`.
      Throws:
      ApiException - if the remote call fails
    • listIpOverrides

      Lists all IP overrides for a key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String parent = KeyName.of("[PROJECT]", "[KEY]").toString();
         for (IpOverrideData element :
             recaptchaEnterpriseServiceClient.listIpOverrides(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent key for which the IP overrides are listed, in the format `projects/{project}/keys/{key}`.
      Throws:
      ApiException - if the remote call fails
    • listIpOverrides

      Lists all IP overrides for a key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListIpOverridesRequest request =
             ListIpOverridesRequest.newBuilder()
                 .setParent(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (IpOverrideData element :
             recaptchaEnterpriseServiceClient.listIpOverrides(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
    • listIpOverridesPagedCallable

      Lists all IP overrides for a key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListIpOverridesRequest request =
             ListIpOverridesRequest.newBuilder()
                 .setParent(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<IpOverrideData> future =
             recaptchaEnterpriseServiceClient.listIpOverridesPagedCallable().futureCall(request);
         // Do something.
         for (IpOverrideData element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listIpOverridesCallable

      public final UnaryCallable<ListIpOverridesRequest,ListIpOverridesResponse> listIpOverridesCallable()
      Lists all IP overrides for a key.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListIpOverridesRequest request =
             ListIpOverridesRequest.newBuilder()
                 .setParent(KeyName.of("[PROJECT]", "[KEY]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListIpOverridesResponse response =
               recaptchaEnterpriseServiceClient.listIpOverridesCallable().call(request);
           for (IpOverrideData element : response.getIpOverridesList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getMetrics

      public final Metrics getMetrics(MetricsName name)
      Get some aggregated metrics for a Key. This data can be used to build dashboards.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         MetricsName name = MetricsName.of("[PROJECT]", "[KEY]");
         Metrics response = recaptchaEnterpriseServiceClient.getMetrics(name);
       }
       
      Parameters:
      name - Required. The name of the requested metrics, in the format `projects/{project}/keys/{key}/metrics`.
      Throws:
      ApiException - if the remote call fails
    • getMetrics

      public final Metrics getMetrics(String name)
      Get some aggregated metrics for a Key. This data can be used to build dashboards.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String name = MetricsName.of("[PROJECT]", "[KEY]").toString();
         Metrics response = recaptchaEnterpriseServiceClient.getMetrics(name);
       }
       
      Parameters:
      name - Required. The name of the requested metrics, in the format `projects/{project}/keys/{key}/metrics`.
      Throws:
      ApiException - if the remote call fails
    • getMetrics

      public final Metrics getMetrics(GetMetricsRequest request)
      Get some aggregated metrics for a Key. This data can be used to build dashboards.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         GetMetricsRequest request =
             GetMetricsRequest.newBuilder()
                 .setName(MetricsName.of("[PROJECT]", "[KEY]").toString())
                 .build();
         Metrics response = recaptchaEnterpriseServiceClient.getMetrics(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getMetricsCallable

      public final UnaryCallable<GetMetricsRequest,Metrics> getMetricsCallable()
      Get some aggregated metrics for a Key. This data can be used to build dashboards.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         GetMetricsRequest request =
             GetMetricsRequest.newBuilder()
                 .setName(MetricsName.of("[PROJECT]", "[KEY]").toString())
                 .build();
         ApiFuture<Metrics> future =
             recaptchaEnterpriseServiceClient.getMetricsCallable().futureCall(request);
         // Do something.
         Metrics response = future.get();
       }
       
    • createFirewallPolicy

      public final FirewallPolicy createFirewallPolicy(ProjectName parent, FirewallPolicy firewallPolicy)
      Creates a new FirewallPolicy, specifying conditions at which reCAPTCHA Enterprise actions can be executed. A project may have a maximum of 1000 policies.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         FirewallPolicy firewallPolicy = FirewallPolicy.newBuilder().build();
         FirewallPolicy response =
             recaptchaEnterpriseServiceClient.createFirewallPolicy(parent, firewallPolicy);
       }
       
      Parameters:
      parent - Required. The name of the project this policy applies to, in the format `projects/{project}`.
      firewallPolicy - Required. Information to create the policy.
      Throws:
      ApiException - if the remote call fails
    • createFirewallPolicy

      public final FirewallPolicy createFirewallPolicy(String parent, FirewallPolicy firewallPolicy)
      Creates a new FirewallPolicy, specifying conditions at which reCAPTCHA Enterprise actions can be executed. A project may have a maximum of 1000 policies.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         FirewallPolicy firewallPolicy = FirewallPolicy.newBuilder().build();
         FirewallPolicy response =
             recaptchaEnterpriseServiceClient.createFirewallPolicy(parent, firewallPolicy);
       }
       
      Parameters:
      parent - Required. The name of the project this policy applies to, in the format `projects/{project}`.
      firewallPolicy - Required. Information to create the policy.
      Throws:
      ApiException - if the remote call fails
    • createFirewallPolicy

      public final FirewallPolicy createFirewallPolicy(CreateFirewallPolicyRequest request)
      Creates a new FirewallPolicy, specifying conditions at which reCAPTCHA Enterprise actions can be executed. A project may have a maximum of 1000 policies.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         CreateFirewallPolicyRequest request =
             CreateFirewallPolicyRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFirewallPolicy(FirewallPolicy.newBuilder().build())
                 .build();
         FirewallPolicy response = recaptchaEnterpriseServiceClient.createFirewallPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createFirewallPolicyCallable

      public final UnaryCallable<CreateFirewallPolicyRequest,FirewallPolicy> createFirewallPolicyCallable()
      Creates a new FirewallPolicy, specifying conditions at which reCAPTCHA Enterprise actions can be executed. A project may have a maximum of 1000 policies.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         CreateFirewallPolicyRequest request =
             CreateFirewallPolicyRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFirewallPolicy(FirewallPolicy.newBuilder().build())
                 .build();
         ApiFuture<FirewallPolicy> future =
             recaptchaEnterpriseServiceClient.createFirewallPolicyCallable().futureCall(request);
         // Do something.
         FirewallPolicy response = future.get();
       }
       
    • listFirewallPolicies

      Returns the list of all firewall policies that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         for (FirewallPolicy element :
             recaptchaEnterpriseServiceClient.listFirewallPolicies(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The name of the project to list the policies for, in the format `projects/{project}`.
      Throws:
      ApiException - if the remote call fails
    • listFirewallPolicies

      Returns the list of all firewall policies that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         for (FirewallPolicy element :
             recaptchaEnterpriseServiceClient.listFirewallPolicies(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The name of the project to list the policies for, in the format `projects/{project}`.
      Throws:
      ApiException - if the remote call fails
    • listFirewallPolicies

      Returns the list of all firewall policies that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListFirewallPoliciesRequest request =
             ListFirewallPoliciesRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (FirewallPolicy element :
             recaptchaEnterpriseServiceClient.listFirewallPolicies(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
    • listFirewallPoliciesPagedCallable

      Returns the list of all firewall policies that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListFirewallPoliciesRequest request =
             ListFirewallPoliciesRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<FirewallPolicy> future =
             recaptchaEnterpriseServiceClient.listFirewallPoliciesPagedCallable().futureCall(request);
         // Do something.
         for (FirewallPolicy element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listFirewallPoliciesCallable

      public final UnaryCallable<ListFirewallPoliciesRequest,ListFirewallPoliciesResponse> listFirewallPoliciesCallable()
      Returns the list of all firewall policies that belong to a project.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListFirewallPoliciesRequest request =
             ListFirewallPoliciesRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListFirewallPoliciesResponse response =
               recaptchaEnterpriseServiceClient.listFirewallPoliciesCallable().call(request);
           for (FirewallPolicy element : response.getFirewallPoliciesList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getFirewallPolicy

      public final FirewallPolicy getFirewallPolicy(FirewallPolicyName name)
      Returns the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         FirewallPolicyName name = FirewallPolicyName.of("[PROJECT]", "[FIREWALLPOLICY]");
         FirewallPolicy response = recaptchaEnterpriseServiceClient.getFirewallPolicy(name);
       }
       
      Parameters:
      name - Required. The name of the requested policy, in the format `projects/{project}/firewallpolicies/{firewallpolicy}`.
      Throws:
      ApiException - if the remote call fails
    • getFirewallPolicy

      public final FirewallPolicy getFirewallPolicy(String name)
      Returns the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String name = FirewallPolicyName.of("[PROJECT]", "[FIREWALLPOLICY]").toString();
         FirewallPolicy response = recaptchaEnterpriseServiceClient.getFirewallPolicy(name);
       }
       
      Parameters:
      name - Required. The name of the requested policy, in the format `projects/{project}/firewallpolicies/{firewallpolicy}`.
      Throws:
      ApiException - if the remote call fails
    • getFirewallPolicy

      public final FirewallPolicy getFirewallPolicy(GetFirewallPolicyRequest request)
      Returns the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         GetFirewallPolicyRequest request =
             GetFirewallPolicyRequest.newBuilder()
                 .setName(FirewallPolicyName.of("[PROJECT]", "[FIREWALLPOLICY]").toString())
                 .build();
         FirewallPolicy response = recaptchaEnterpriseServiceClient.getFirewallPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getFirewallPolicyCallable

      public final UnaryCallable<GetFirewallPolicyRequest,FirewallPolicy> getFirewallPolicyCallable()
      Returns the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         GetFirewallPolicyRequest request =
             GetFirewallPolicyRequest.newBuilder()
                 .setName(FirewallPolicyName.of("[PROJECT]", "[FIREWALLPOLICY]").toString())
                 .build();
         ApiFuture<FirewallPolicy> future =
             recaptchaEnterpriseServiceClient.getFirewallPolicyCallable().futureCall(request);
         // Do something.
         FirewallPolicy response = future.get();
       }
       
    • updateFirewallPolicy

      public final FirewallPolicy updateFirewallPolicy(FirewallPolicy firewallPolicy, com.google.protobuf.FieldMask updateMask)
      Updates the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         FirewallPolicy firewallPolicy = FirewallPolicy.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         FirewallPolicy response =
             recaptchaEnterpriseServiceClient.updateFirewallPolicy(firewallPolicy, updateMask);
       }
       
      Parameters:
      firewallPolicy - Required. The policy to update.
      updateMask - Optional. The mask to control which fields of the policy get updated. If the mask is not present, all fields are updated.
      Throws:
      ApiException - if the remote call fails
    • updateFirewallPolicy

      public final FirewallPolicy updateFirewallPolicy(UpdateFirewallPolicyRequest request)
      Updates the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         UpdateFirewallPolicyRequest request =
             UpdateFirewallPolicyRequest.newBuilder()
                 .setFirewallPolicy(FirewallPolicy.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         FirewallPolicy response = recaptchaEnterpriseServiceClient.updateFirewallPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateFirewallPolicyCallable

      public final UnaryCallable<UpdateFirewallPolicyRequest,FirewallPolicy> updateFirewallPolicyCallable()
      Updates the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         UpdateFirewallPolicyRequest request =
             UpdateFirewallPolicyRequest.newBuilder()
                 .setFirewallPolicy(FirewallPolicy.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<FirewallPolicy> future =
             recaptchaEnterpriseServiceClient.updateFirewallPolicyCallable().futureCall(request);
         // Do something.
         FirewallPolicy response = future.get();
       }
       
    • deleteFirewallPolicy

      public final void deleteFirewallPolicy(FirewallPolicyName name)
      Deletes the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         FirewallPolicyName name = FirewallPolicyName.of("[PROJECT]", "[FIREWALLPOLICY]");
         recaptchaEnterpriseServiceClient.deleteFirewallPolicy(name);
       }
       
      Parameters:
      name - Required. The name of the policy to be deleted, in the format `projects/{project}/firewallpolicies/{firewallpolicy}`.
      Throws:
      ApiException - if the remote call fails
    • deleteFirewallPolicy

      public final void deleteFirewallPolicy(String name)
      Deletes the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String name = FirewallPolicyName.of("[PROJECT]", "[FIREWALLPOLICY]").toString();
         recaptchaEnterpriseServiceClient.deleteFirewallPolicy(name);
       }
       
      Parameters:
      name - Required. The name of the policy to be deleted, in the format `projects/{project}/firewallpolicies/{firewallpolicy}`.
      Throws:
      ApiException - if the remote call fails
    • deleteFirewallPolicy

      public final void deleteFirewallPolicy(DeleteFirewallPolicyRequest request)
      Deletes the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         DeleteFirewallPolicyRequest request =
             DeleteFirewallPolicyRequest.newBuilder()
                 .setName(FirewallPolicyName.of("[PROJECT]", "[FIREWALLPOLICY]").toString())
                 .build();
         recaptchaEnterpriseServiceClient.deleteFirewallPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteFirewallPolicyCallable

      public final UnaryCallable<DeleteFirewallPolicyRequest,com.google.protobuf.Empty> deleteFirewallPolicyCallable()
      Deletes the specified firewall policy.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         DeleteFirewallPolicyRequest request =
             DeleteFirewallPolicyRequest.newBuilder()
                 .setName(FirewallPolicyName.of("[PROJECT]", "[FIREWALLPOLICY]").toString())
                 .build();
         ApiFuture<Empty> future =
             recaptchaEnterpriseServiceClient.deleteFirewallPolicyCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • reorderFirewallPolicies

      public final ReorderFirewallPoliciesResponse reorderFirewallPolicies(ProjectName parent, List<String> names)
      Reorders all firewall policies.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         List<String> names = new ArrayList<>();
         ReorderFirewallPoliciesResponse response =
             recaptchaEnterpriseServiceClient.reorderFirewallPolicies(parent, names);
       }
       
      Parameters:
      parent - Required. The name of the project to list the policies for, in the format `projects/{project}`.
      names - Required. A list containing all policy names, in the new order. Each name is in the format `projects/{project}/firewallpolicies/{firewallpolicy}`.
      Throws:
      ApiException - if the remote call fails
    • reorderFirewallPolicies

      public final ReorderFirewallPoliciesResponse reorderFirewallPolicies(String parent, List<String> names)
      Reorders all firewall policies.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         List<String> names = new ArrayList<>();
         ReorderFirewallPoliciesResponse response =
             recaptchaEnterpriseServiceClient.reorderFirewallPolicies(parent, names);
       }
       
      Parameters:
      parent - Required. The name of the project to list the policies for, in the format `projects/{project}`.
      names - Required. A list containing all policy names, in the new order. Each name is in the format `projects/{project}/firewallpolicies/{firewallpolicy}`.
      Throws:
      ApiException - if the remote call fails
    • reorderFirewallPolicies

      public final ReorderFirewallPoliciesResponse reorderFirewallPolicies(ReorderFirewallPoliciesRequest request)
      Reorders all firewall policies.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ReorderFirewallPoliciesRequest request =
             ReorderFirewallPoliciesRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .addAllNames(new ArrayList<String>())
                 .build();
         ReorderFirewallPoliciesResponse response =
             recaptchaEnterpriseServiceClient.reorderFirewallPolicies(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • reorderFirewallPoliciesCallable

      public final UnaryCallable<ReorderFirewallPoliciesRequest,ReorderFirewallPoliciesResponse> reorderFirewallPoliciesCallable()
      Reorders all firewall policies.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ReorderFirewallPoliciesRequest request =
             ReorderFirewallPoliciesRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .addAllNames(new ArrayList<String>())
                 .build();
         ApiFuture<ReorderFirewallPoliciesResponse> future =
             recaptchaEnterpriseServiceClient.reorderFirewallPoliciesCallable().futureCall(request);
         // Do something.
         ReorderFirewallPoliciesResponse response = future.get();
       }
       
    • listRelatedAccountGroups

      List groups of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         for (RelatedAccountGroup element :
             recaptchaEnterpriseServiceClient.listRelatedAccountGroups(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The name of the project to list related account groups from, in the format `projects/{project}`.
      Throws:
      ApiException - if the remote call fails
    • listRelatedAccountGroups

      List groups of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         for (RelatedAccountGroup element :
             recaptchaEnterpriseServiceClient.listRelatedAccountGroups(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The name of the project to list related account groups from, in the format `projects/{project}`.
      Throws:
      ApiException - if the remote call fails
    • listRelatedAccountGroups

      List groups of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListRelatedAccountGroupsRequest request =
             ListRelatedAccountGroupsRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (RelatedAccountGroup element :
             recaptchaEnterpriseServiceClient.listRelatedAccountGroups(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
    • listRelatedAccountGroupsPagedCallable

      List groups of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListRelatedAccountGroupsRequest request =
             ListRelatedAccountGroupsRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<RelatedAccountGroup> future =
             recaptchaEnterpriseServiceClient
                 .listRelatedAccountGroupsPagedCallable()
                 .futureCall(request);
         // Do something.
         for (RelatedAccountGroup element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listRelatedAccountGroupsCallable

      public final UnaryCallable<ListRelatedAccountGroupsRequest,ListRelatedAccountGroupsResponse> listRelatedAccountGroupsCallable()
      List groups of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListRelatedAccountGroupsRequest request =
             ListRelatedAccountGroupsRequest.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListRelatedAccountGroupsResponse response =
               recaptchaEnterpriseServiceClient.listRelatedAccountGroupsCallable().call(request);
           for (RelatedAccountGroup element : response.getRelatedAccountGroupsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • listRelatedAccountGroupMemberships

      Get memberships in a group of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         RelatedAccountGroupName parent =
             RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]");
         for (RelatedAccountGroupMembership element :
             recaptchaEnterpriseServiceClient
                 .listRelatedAccountGroupMemberships(parent)
                 .iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The resource name for the related account group in the format `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`.
      Throws:
      ApiException - if the remote call fails
    • listRelatedAccountGroupMemberships

      public final RecaptchaEnterpriseServiceClient.ListRelatedAccountGroupMembershipsPagedResponse listRelatedAccountGroupMemberships(String parent)
      Get memberships in a group of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String parent = RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString();
         for (RelatedAccountGroupMembership element :
             recaptchaEnterpriseServiceClient
                 .listRelatedAccountGroupMemberships(parent)
                 .iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The resource name for the related account group in the format `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`.
      Throws:
      ApiException - if the remote call fails
    • listRelatedAccountGroupMemberships

      Get memberships in a group of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListRelatedAccountGroupMembershipsRequest request =
             ListRelatedAccountGroupMembershipsRequest.newBuilder()
                 .setParent(
                     RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (RelatedAccountGroupMembership element :
             recaptchaEnterpriseServiceClient
                 .listRelatedAccountGroupMemberships(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
    • listRelatedAccountGroupMembershipsPagedCallable

      Get memberships in a group of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListRelatedAccountGroupMembershipsRequest request =
             ListRelatedAccountGroupMembershipsRequest.newBuilder()
                 .setParent(
                     RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<RelatedAccountGroupMembership> future =
             recaptchaEnterpriseServiceClient
                 .listRelatedAccountGroupMembershipsPagedCallable()
                 .futureCall(request);
         // Do something.
         for (RelatedAccountGroupMembership element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listRelatedAccountGroupMembershipsCallable

      Get memberships in a group of related accounts.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ListRelatedAccountGroupMembershipsRequest request =
             ListRelatedAccountGroupMembershipsRequest.newBuilder()
                 .setParent(
                     RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListRelatedAccountGroupMembershipsResponse response =
               recaptchaEnterpriseServiceClient
                   .listRelatedAccountGroupMembershipsCallable()
                   .call(request);
           for (RelatedAccountGroupMembership element :
               response.getRelatedAccountGroupMembershipsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • searchRelatedAccountGroupMemberships

      public final RecaptchaEnterpriseServiceClient.SearchRelatedAccountGroupMembershipsPagedResponse searchRelatedAccountGroupMemberships(ProjectName project, com.google.protobuf.ByteString hashedAccountId)
      Search group memberships related to a given account.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         ProjectName project = ProjectName.of("[PROJECT]");
         ByteString hashedAccountId = ByteString.EMPTY;
         for (RelatedAccountGroupMembership element :
             recaptchaEnterpriseServiceClient
                 .searchRelatedAccountGroupMemberships(project, hashedAccountId)
                 .iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      project - Required. The name of the project to search related account group memberships from. Specify the project name in the following format: `projects/{project}`.
      hashedAccountId - Optional. Deprecated: use `account_id` instead. The unique stable hashed account identifier used to search connections. The identifier should correspond to a `hashed_account_id` provided in a previous `CreateAssessment` or `AnnotateAssessment` call. Either hashed_account_id or account_id must be set, but not both.
      Throws:
      ApiException - if the remote call fails
    • searchRelatedAccountGroupMemberships

      public final RecaptchaEnterpriseServiceClient.SearchRelatedAccountGroupMembershipsPagedResponse searchRelatedAccountGroupMemberships(String project, com.google.protobuf.ByteString hashedAccountId)
      Search group memberships related to a given account.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         String project = ProjectName.of("[PROJECT]").toString();
         ByteString hashedAccountId = ByteString.EMPTY;
         for (RelatedAccountGroupMembership element :
             recaptchaEnterpriseServiceClient
                 .searchRelatedAccountGroupMemberships(project, hashedAccountId)
                 .iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      project - Required. The name of the project to search related account group memberships from. Specify the project name in the following format: `projects/{project}`.
      hashedAccountId - Optional. Deprecated: use `account_id` instead. The unique stable hashed account identifier used to search connections. The identifier should correspond to a `hashed_account_id` provided in a previous `CreateAssessment` or `AnnotateAssessment` call. Either hashed_account_id or account_id must be set, but not both.
      Throws:
      ApiException - if the remote call fails
    • searchRelatedAccountGroupMemberships

      Search group memberships related to a given account.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         SearchRelatedAccountGroupMembershipsRequest request =
             SearchRelatedAccountGroupMembershipsRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setAccountId("accountId-1827029976")
                 .setHashedAccountId(ByteString.EMPTY)
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (RelatedAccountGroupMembership element :
             recaptchaEnterpriseServiceClient
                 .searchRelatedAccountGroupMemberships(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
    • searchRelatedAccountGroupMembershipsPagedCallable

      Search group memberships related to a given account.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         SearchRelatedAccountGroupMembershipsRequest request =
             SearchRelatedAccountGroupMembershipsRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setAccountId("accountId-1827029976")
                 .setHashedAccountId(ByteString.EMPTY)
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<RelatedAccountGroupMembership> future =
             recaptchaEnterpriseServiceClient
                 .searchRelatedAccountGroupMembershipsPagedCallable()
                 .futureCall(request);
         // Do something.
         for (RelatedAccountGroupMembership element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • searchRelatedAccountGroupMembershipsCallable

      Search group memberships related to a given account.

      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 (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
           RecaptchaEnterpriseServiceClient.create()) {
         SearchRelatedAccountGroupMembershipsRequest request =
             SearchRelatedAccountGroupMembershipsRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setAccountId("accountId-1827029976")
                 .setHashedAccountId(ByteString.EMPTY)
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           SearchRelatedAccountGroupMembershipsResponse response =
               recaptchaEnterpriseServiceClient
                   .searchRelatedAccountGroupMembershipsCallable()
                   .call(request);
           for (RelatedAccountGroupMembership element :
               response.getRelatedAccountGroupMembershipsList()) {
             // 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:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException