diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index 34450fde..21b9732d 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-recaptchaenterprise.git", - "sha": "412045f9f77b8bf192c580f6937c8e70b39c72c7" + "sha": "0d8754e6f2b8ea9f8d5d09b1a4a27666151936c6" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "2c8aecedd55b0480fb4e123b6e07fa5b12953862" + "sha": "996775eca5fd934edac3c2ae34b80ff0395b1717" } } ] diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh index ba6f504d..447d0b58 100755 --- a/.kokoro/release/publish_javadoc.sh +++ b/.kokoro/release/publish_javadoc.sh @@ -38,8 +38,8 @@ python3 -m pip install gcp-docuploader # compile all packages mvn clean install -B -q -DskipTests=true -NAME=google-cloud-recaptchaenterprise -VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) +export NAME=google-cloud-recaptchaenterprise +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) # build the docs mvn site -B -q @@ -59,7 +59,8 @@ python3 -m docuploader upload . \ popd -# V2 +# V2 due to problems w/ the released javadoc plugin doclava, Java 8 is required. Beware of accidental updates. + mvn clean site -B -q -Ddevsite.template="${KOKORO_GFILE_DIR}/java/" pushd target/devsite/reference diff --git a/CHANGELOG.md b/CHANGELOG.md index 09af4428..26e3c80c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.0.8](https://www.github.com/googleapis/java-recaptchaenterprise/compare/v1.0.7...v1.0.8) (2020-12-14) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.1 ([#321](https://www.github.com/googleapis/java-recaptchaenterprise/issues/321)) ([7e4842a](https://www.github.com/googleapis/java-recaptchaenterprise/commit/7e4842af78aa1234edec2323bbde190b0a1628da)) + ### [1.0.7](https://www.github.com/googleapis/java-recaptchaenterprise/compare/v1.0.6...v1.0.7) (2020-12-02) diff --git a/README.md b/README.md index d0e4509b..0bb14b5b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file com.google.cloud libraries-bom - 15.0.0 + 16.1.0 pom import @@ -39,18 +39,18 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-recaptchaenterprise - 1.0.5 + 1.0.7 ``` If you are using Gradle, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-recaptchaenterprise:1.0.5' +compile 'com.google.cloud:google-cloud-recaptchaenterprise:1.0.7' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-recaptchaenterprise" % "1.0.5" +libraryDependencies += "com.google.cloud" % "google-cloud-recaptchaenterprise" % "1.0.7" ``` ## Authentication @@ -128,6 +128,8 @@ Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] +Java is a registered trademark of Oracle and/or its affiliates. + [product-docs]: https://cloud.google.com/recaptcha-enterprise/docs/ [javadocs]: https://googleapis.dev/java/google-cloud-recaptchaenterprise/latest/ [kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-recaptchaenterprise/java7.svg diff --git a/google-cloud-recaptchaenterprise-bom/pom.xml b/google-cloud-recaptchaenterprise-bom/pom.xml index 51f88ea4..58fd2f66 100644 --- a/google-cloud-recaptchaenterprise-bom/pom.xml +++ b/google-cloud-recaptchaenterprise-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-recaptchaenterprise-bom - 1.0.7 + 1.0.8 pom com.google.cloud @@ -64,27 +64,27 @@ com.google.cloud google-cloud-recaptchaenterprise - 1.0.7 + 1.0.8 com.google.api.grpc proto-google-cloud-recaptchaenterprise-v1 - 1.0.7 + 1.0.8 com.google.api.grpc proto-google-cloud-recaptchaenterprise-v1beta1 - 0.32.7 + 0.32.8 com.google.api.grpc grpc-google-cloud-recaptchaenterprise-v1 - 1.0.7 + 1.0.8 com.google.api.grpc grpc-google-cloud-recaptchaenterprise-v1beta1 - 0.32.7 + 0.32.8 diff --git a/google-cloud-recaptchaenterprise/pom.xml b/google-cloud-recaptchaenterprise/pom.xml index e6222dff..c792c281 100644 --- a/google-cloud-recaptchaenterprise/pom.xml +++ b/google-cloud-recaptchaenterprise/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-recaptchaenterprise - 1.0.7 + 1.0.8 jar reCAPTCHA Enterprise https://github.com/googleapis/java-recaptchaenterprise @@ -11,7 +11,7 @@ com.google.cloud google-cloud-recaptchaenterprise-parent - 1.0.7 + 1.0.8 google-cloud-recaptchaenterprise diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClient.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClient.java index 590e495a..74892dd1 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClient.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClient.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1; import com.google.api.core.ApiFunction; @@ -47,24 +48,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * 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: * - *

- * 
- * 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 + *

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(). * @@ -93,30 +84,28 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings =
  *     RecaptchaEnterpriseServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient =
  *     RecaptchaEnterpriseServiceClient.create(recaptchaEnterpriseServiceSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * 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. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class RecaptchaEnterpriseServiceClient implements BackgroundResource { private final RecaptchaEnterpriseServiceSettings settings; private final RecaptchaEnterpriseServiceStub stub; @@ -138,7 +127,7 @@ public static final RecaptchaEnterpriseServiceClient create( /** * Constructs an instance of RecaptchaEnterpriseServiceClient, using the given stub for making - * calls. This is for advanced usage - prefer to use RecaptchaEnterpriseServiceSettings}. + * calls. This is for advanced usage - prefer using create(RecaptchaEnterpriseServiceSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final RecaptchaEnterpriseServiceClient create(RecaptchaEnterpriseServiceStub stub) { @@ -171,20 +160,10 @@ public RecaptchaEnterpriseServiceStub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Assessment of the likelihood an event is legitimate. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Assessment assessment = Assessment.newBuilder().build();
-   *   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
-   * }
-   * 
- * * @param parent Required. The name of the project in which the assessment will be created, in the * format "projects/{project}". * @param assessment Required. The assessment details. @@ -199,20 +178,10 @@ public final Assessment createAssessment(ProjectName parent, Assessment assessme return createAssessment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Assessment of the likelihood an event is legitimate. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Assessment assessment = Assessment.newBuilder().build();
-   *   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent.toString(), assessment);
-   * }
-   * 
- * * @param parent Required. The name of the project in which the assessment will be created, in the * format "projects/{project}". * @param assessment Required. The assessment details. @@ -224,24 +193,10 @@ public final Assessment createAssessment(String parent, Assessment assessment) { return createAssessment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Assessment of the likelihood an event is legitimate. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Assessment assessment = Assessment.newBuilder().build();
-   *   CreateAssessmentRequest request = CreateAssessmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAssessment(assessment)
-   *     .build();
-   *   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -249,45 +204,21 @@ public final Assessment createAssessment(CreateAssessmentRequest request) { return createAssessmentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Assessment of the likelihood an event is legitimate. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Assessment assessment = Assessment.newBuilder().build();
-   *   CreateAssessmentRequest request = CreateAssessmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAssessment(assessment)
-   *     .build();
-   *   ApiFuture<Assessment> future = recaptchaEnterpriseServiceClient.createAssessmentCallable().futureCall(request);
-   *   // Do something
-   *   Assessment response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createAssessmentCallable() { return stub.createAssessmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
-   *   AnnotateAssessmentRequest.Annotation annotation = AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED;
-   *   AnnotateAssessmentResponse response = recaptchaEnterpriseServiceClient.annotateAssessment(name, annotation);
-   * }
-   * 
- * * @param name Required. The resource name of the Assessment, in the format * "projects/{project}/assessments/{assessment}". * @param annotation Required. The annotation that will be assigned to the Event. @@ -303,21 +234,11 @@ public final AnnotateAssessmentResponse annotateAssessment( return annotateAssessment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
-   *   AnnotateAssessmentRequest.Annotation annotation = AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED;
-   *   AnnotateAssessmentResponse response = recaptchaEnterpriseServiceClient.annotateAssessment(name.toString(), annotation);
-   * }
-   * 
- * * @param name Required. The resource name of the Assessment, in the format * "projects/{project}/assessments/{assessment}". * @param annotation Required. The annotation that will be assigned to the Event. @@ -330,25 +251,11 @@ public final AnnotateAssessmentResponse annotateAssessment( return annotateAssessment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
-   *   AnnotateAssessmentRequest.Annotation annotation = AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED;
-   *   AnnotateAssessmentRequest request = AnnotateAssessmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setAnnotation(annotation)
-   *     .build();
-   *   AnnotateAssessmentResponse response = recaptchaEnterpriseServiceClient.annotateAssessment(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -356,50 +263,22 @@ public final AnnotateAssessmentResponse annotateAssessment(AnnotateAssessmentReq return annotateAssessmentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
-   *   AnnotateAssessmentRequest.Annotation annotation = AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED;
-   *   AnnotateAssessmentRequest request = AnnotateAssessmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setAnnotation(annotation)
-   *     .build();
-   *   ApiFuture<AnnotateAssessmentResponse> future = recaptchaEnterpriseServiceClient.annotateAssessmentCallable().futureCall(request);
-   *   // Do something
-   *   AnnotateAssessmentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable annotateAssessmentCallable() { return stub.annotateAssessmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new reCAPTCHA Enterprise key. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Key key = Key.newBuilder().build();
-   *   CreateKeyRequest request = CreateKeyRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setKey(key)
-   *     .build();
-   *   Key response = recaptchaEnterpriseServiceClient.createKey(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -407,48 +286,20 @@ public final Key createKey(CreateKeyRequest request) { return createKeyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new reCAPTCHA Enterprise key. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Key key = Key.newBuilder().build();
-   *   CreateKeyRequest request = CreateKeyRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setKey(key)
-   *     .build();
-   *   ApiFuture<Key> future = recaptchaEnterpriseServiceClient.createKeyCallable().futureCall(request);
-   *   // Do something
-   *   Key response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createKeyCallable() { return stub.createKeyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all keys that belong to a project. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListKeysRequest request = ListKeysRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Key element : recaptchaEnterpriseServiceClient.listKeys(request).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -456,77 +307,30 @@ public final ListKeysPagedResponse listKeys(ListKeysRequest request) { return listKeysPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all keys that belong to a project. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListKeysRequest request = ListKeysRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListKeysPagedResponse> future = recaptchaEnterpriseServiceClient.listKeysPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Key element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listKeysPagedCallable() { return stub.listKeysPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all keys that belong to a project. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListKeysRequest request = ListKeysRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .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;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listKeysCallable() { return stub.listKeysCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified key. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   KeyName name = KeyName.of("[PROJECT]", "[KEY]");
-   *   GetKeyRequest request = GetKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Key response = recaptchaEnterpriseServiceClient.getKey(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -534,44 +338,20 @@ public final Key getKey(GetKeyRequest request) { return getKeyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified key. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   KeyName name = KeyName.of("[PROJECT]", "[KEY]");
-   *   GetKeyRequest request = GetKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Key> future = recaptchaEnterpriseServiceClient.getKeyCallable().futureCall(request);
-   *   // Do something
-   *   Key response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getKeyCallable() { return stub.getKeyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified key. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   Key key = Key.newBuilder().build();
-   *   UpdateKeyRequest request = UpdateKeyRequest.newBuilder()
-   *     .setKey(key)
-   *     .build();
-   *   Key response = recaptchaEnterpriseServiceClient.updateKey(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -579,44 +359,20 @@ public final Key updateKey(UpdateKeyRequest request) { return updateKeyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified key. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   Key key = Key.newBuilder().build();
-   *   UpdateKeyRequest request = UpdateKeyRequest.newBuilder()
-   *     .setKey(key)
-   *     .build();
-   *   ApiFuture<Key> future = recaptchaEnterpriseServiceClient.updateKeyCallable().futureCall(request);
-   *   // Do something
-   *   Key response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateKeyCallable() { return stub.updateKeyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified key. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   KeyName name = KeyName.of("[PROJECT]", "[KEY]");
-   *   DeleteKeyRequest request = DeleteKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   recaptchaEnterpriseServiceClient.deleteKey(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -624,23 +380,11 @@ public final void deleteKey(DeleteKeyRequest request) { deleteKeyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified key. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
-   *   KeyName name = KeyName.of("[PROJECT]", "[KEY]");
-   *   DeleteKeyRequest request = DeleteKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = recaptchaEnterpriseServiceClient.deleteKeyCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteKeyCallable() { return stub.deleteKeyCallable(); diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceSettings.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceSettings.java index 9c042ea2..2a4f4f8c 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceSettings.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1; import static com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.ListKeysPagedResponse; @@ -45,7 +46,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link RecaptchaEnterpriseServiceClient}. * @@ -63,24 +64,26 @@ * *

For example, to set the total timeout of createAssessment to 30 seconds: * - *

- * 
+ * 
{@code
  * RecaptchaEnterpriseServiceSettings.Builder recaptchaEnterpriseServiceSettingsBuilder =
  *     RecaptchaEnterpriseServiceSettings.newBuilder();
  * recaptchaEnterpriseServiceSettingsBuilder
  *     .createAssessmentSettings()
  *     .setRetrySettings(
- *         recaptchaEnterpriseServiceSettingsBuilder.createAssessmentSettings().getRetrySettings().toBuilder()
+ *         recaptchaEnterpriseServiceSettingsBuilder
+ *             .createAssessmentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings = recaptchaEnterpriseServiceSettingsBuilder.build();
- * 
- * 
+ * RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings = + * recaptchaEnterpriseServiceSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class RecaptchaEnterpriseServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createAssessment. */ public UnaryCallSettings createAssessmentSettings() { return ((RecaptchaEnterpriseServiceStubSettings) getStubSettings()).createAssessmentSettings(); @@ -180,18 +183,15 @@ protected RecaptchaEnterpriseServiceSettings(Builder settingsBuilder) throws IOE /** Builder for RecaptchaEnterpriseServiceSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(RecaptchaEnterpriseServiceStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(RecaptchaEnterpriseServiceStubSettings.newBuilder()); - } - protected Builder(RecaptchaEnterpriseServiceSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -200,11 +200,15 @@ protected Builder(RecaptchaEnterpriseServiceStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(RecaptchaEnterpriseServiceStubSettings.newBuilder()); + } + public RecaptchaEnterpriseServiceStubSettings.Builder getStubSettingsBuilder() { return ((RecaptchaEnterpriseServiceStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/package-info.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/package-info.java index ca6e68df..e30f7f9b 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/package-info.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/package-info.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -15,28 +15,15 @@ */ /** - * A client to reCAPTCHA Enterprise API. + * The interfaces provided are listed below, along with usage samples. * - *

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

================================ RecaptchaEnterpriseServiceClient - * ================================ + *

======================= RecaptchaEnterpriseServiceClient ======================= * *

Service Description: Service to determine the likelihood an event is legitimate. * *

Sample for RecaptchaEnterpriseServiceClient: - * - *

- * 
- * try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
- *   ProjectName parent = ProjectName.of("[PROJECT]");
- *   Assessment assessment = Assessment.newBuilder().build();
- *   Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.recaptchaenterprise.v1; import javax.annotation.Generated; diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/GrpcRecaptchaEnterpriseServiceCallableFactory.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/GrpcRecaptchaEnterpriseServiceCallableFactory.java index 0d3370a6..18815c24 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/GrpcRecaptchaEnterpriseServiceCallableFactory.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/GrpcRecaptchaEnterpriseServiceCallableFactory.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for reCAPTCHA Enterprise API. + * gRPC callable factory implementation for the RecaptchaEnterpriseService service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcRecaptchaEnterpriseServiceCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/GrpcRecaptchaEnterpriseServiceStub.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/GrpcRecaptchaEnterpriseServiceStub.java index 9d57059d..c33055fc 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/GrpcRecaptchaEnterpriseServiceStub.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/GrpcRecaptchaEnterpriseServiceStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1.stub; import static com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.ListKeysPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -26,6 +26,7 @@ import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.UnaryCallable; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest; import com.google.recaptchaenterprise.v1.AnnotateAssessmentResponse; @@ -45,16 +46,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for reCAPTCHA Enterprise API. + * gRPC stub implementation for the RecaptchaEnterpriseService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcRecaptchaEnterpriseServiceStub extends RecaptchaEnterpriseServiceStub { - private static final MethodDescriptor createAssessmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -65,6 +64,7 @@ public class GrpcRecaptchaEnterpriseServiceStub extends RecaptchaEnterpriseServi ProtoUtils.marshaller(CreateAssessmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Assessment.getDefaultInstance())) .build(); + private static final MethodDescriptor annotateAssessmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -76,6 +76,7 @@ public class GrpcRecaptchaEnterpriseServiceStub extends RecaptchaEnterpriseServi .setResponseMarshaller( ProtoUtils.marshaller(AnnotateAssessmentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor createKeyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -84,6 +85,7 @@ public class GrpcRecaptchaEnterpriseServiceStub extends RecaptchaEnterpriseServi .setRequestMarshaller(ProtoUtils.marshaller(CreateKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Key.getDefaultInstance())) .build(); + private static final MethodDescriptor listKeysMethodDescriptor = MethodDescriptor.newBuilder() @@ -93,6 +95,7 @@ public class GrpcRecaptchaEnterpriseServiceStub extends RecaptchaEnterpriseServi .setRequestMarshaller(ProtoUtils.marshaller(ListKeysRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListKeysResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getKeyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -101,6 +104,7 @@ public class GrpcRecaptchaEnterpriseServiceStub extends RecaptchaEnterpriseServi .setRequestMarshaller(ProtoUtils.marshaller(GetKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Key.getDefaultInstance())) .build(); + private static final MethodDescriptor updateKeyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -109,6 +113,7 @@ public class GrpcRecaptchaEnterpriseServiceStub extends RecaptchaEnterpriseServi .setRequestMarshaller(ProtoUtils.marshaller(UpdateKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Key.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteKeyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -118,8 +123,6 @@ public class GrpcRecaptchaEnterpriseServiceStub extends RecaptchaEnterpriseServi .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable createAssessmentCallable; private final UnaryCallable annotateAssessmentCallable; @@ -130,6 +133,8 @@ public class GrpcRecaptchaEnterpriseServiceStub extends RecaptchaEnterpriseServi private final UnaryCallable updateKeyCallable; private final UnaryCallable deleteKeyCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcRecaptchaEnterpriseServiceStub create( @@ -173,6 +178,7 @@ protected GrpcRecaptchaEnterpriseServiceStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings createAssessmentTransportSettings = GrpcCallSettings.newBuilder() @@ -294,7 +300,12 @@ public Map extract(DeleteKeyRequest request) { callableFactory.createUnaryCallable( deleteKeyTransportSettings, settings.deleteKeySettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable createAssessmentCallable() { @@ -310,14 +321,14 @@ public UnaryCallable createKeyCallable() { return createKeyCallable; } - public UnaryCallable listKeysPagedCallable() { - return listKeysPagedCallable; - } - public UnaryCallable listKeysCallable() { return listKeysCallable; } + public UnaryCallable listKeysPagedCallable() { + return listKeysPagedCallable; + } + public UnaryCallable getKeyCallable() { return getKeyCallable; } diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/RecaptchaEnterpriseServiceStub.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/RecaptchaEnterpriseServiceStub.java index 036b981e..51bd0d81 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/RecaptchaEnterpriseServiceStub.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/RecaptchaEnterpriseServiceStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1.stub; import static com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.ListKeysPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.protobuf.Empty; @@ -34,14 +34,13 @@ import com.google.recaptchaenterprise.v1.UpdateKeyRequest; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for reCAPTCHA Enterprise API. + * Base stub class for the RecaptchaEnterpriseService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class RecaptchaEnterpriseServiceStub implements BackgroundResource { public UnaryCallable createAssessmentCallable() { diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/RecaptchaEnterpriseServiceStubSettings.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/RecaptchaEnterpriseServiceStubSettings.java index eed06671..3c363355 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/RecaptchaEnterpriseServiceStubSettings.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/stub/RecaptchaEnterpriseServiceStubSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1.stub; import static com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.ListKeysPagedResponse; @@ -60,7 +61,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link RecaptchaEnterpriseServiceStub}. * @@ -78,22 +79,24 @@ * *

For example, to set the total timeout of createAssessment to 30 seconds: * - *

- * 
+ * 
{@code
  * RecaptchaEnterpriseServiceStubSettings.Builder recaptchaEnterpriseServiceSettingsBuilder =
  *     RecaptchaEnterpriseServiceStubSettings.newBuilder();
  * recaptchaEnterpriseServiceSettingsBuilder
  *     .createAssessmentSettings()
  *     .setRetrySettings(
- *         recaptchaEnterpriseServiceSettingsBuilder.createAssessmentSettings().getRetrySettings().toBuilder()
+ *         recaptchaEnterpriseServiceSettingsBuilder
+ *             .createAssessmentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * RecaptchaEnterpriseServiceStubSettings recaptchaEnterpriseServiceSettings = recaptchaEnterpriseServiceSettingsBuilder.build();
- * 
- * 
+ * RecaptchaEnterpriseServiceStubSettings recaptchaEnterpriseServiceSettings = + * recaptchaEnterpriseServiceSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class RecaptchaEnterpriseServiceStubSettings extends StubSettings { /** The default scopes of the service. */ @@ -110,6 +113,58 @@ public class RecaptchaEnterpriseServiceStubSettings private final UnaryCallSettings updateKeySettings; private final UnaryCallSettings deleteKeySettings; + private static final PagedListDescriptor + LIST_KEYS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListKeysRequest injectToken(ListKeysRequest payload, String token) { + return ListKeysRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListKeysRequest injectPageSize(ListKeysRequest payload, int pageSize) { + return ListKeysRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListKeysRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListKeysResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListKeysResponse payload) { + return payload.getKeysList() == null + ? ImmutableList.of() + : payload.getKeysList(); + } + }; + + private static final PagedListResponseFactory< + ListKeysRequest, ListKeysResponse, ListKeysPagedResponse> + LIST_KEYS_PAGE_STR_FACT = + new PagedListResponseFactory() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListKeysRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_KEYS_PAGE_STR_DESC, request, context); + return ListKeysPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createAssessment. */ public UnaryCallSettings createAssessmentSettings() { return createAssessmentSettings; @@ -153,10 +208,10 @@ public RecaptchaEnterpriseServiceStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcRecaptchaEnterpriseServiceStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -225,63 +280,10 @@ protected RecaptchaEnterpriseServiceStubSettings(Builder settingsBuilder) throws deleteKeySettings = settingsBuilder.deleteKeySettings().build(); } - private static final PagedListDescriptor - LIST_KEYS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListKeysRequest injectToken(ListKeysRequest payload, String token) { - return ListKeysRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListKeysRequest injectPageSize(ListKeysRequest payload, int pageSize) { - return ListKeysRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListKeysRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListKeysResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListKeysResponse payload) { - return payload.getKeysList() != null - ? payload.getKeysList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListKeysRequest, ListKeysResponse, ListKeysPagedResponse> - LIST_KEYS_PAGE_STR_FACT = - new PagedListResponseFactory() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListKeysRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_KEYS_PAGE_STR_DESC, request, context); - return ListKeysPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for RecaptchaEnterpriseServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createAssessmentSettings; private final UnaryCallSettings.Builder @@ -293,16 +295,14 @@ public static class Builder private final UnaryCallSettings.Builder getKeySettings; private final UnaryCallSettings.Builder updateKeySettings; private final UnaryCallSettings.Builder deleteKeySettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder> definitions = ImmutableMap.builder(); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + "no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -311,8 +311,6 @@ public static class Builder static { ImmutableMap.Builder definitions = ImmutableMap.builder(); RetrySettings settings = null; - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(600000L)) @@ -320,29 +318,23 @@ public static class Builder .setMaxRpcTimeout(Duration.ofMillis(600000L)) .setTotalTimeout(Duration.ofMillis(600000L)) .build(); - definitions.put("no_retry_1_params", settings); + definitions.put("no_retry_0_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(clientContext); createAssessmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - annotateAssessmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listKeysSettings = PagedCallSettings.newBuilder(LIST_KEYS_PAGE_STR_FACT); - getKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = @@ -354,82 +346,82 @@ protected Builder(ClientContext clientContext) { getKeySettings, updateKeySettings, deleteKeySettings); - initDefaults(this); } + protected Builder(RecaptchaEnterpriseServiceStubSettings settings) { + super(settings); + + createAssessmentSettings = settings.createAssessmentSettings.toBuilder(); + annotateAssessmentSettings = settings.annotateAssessmentSettings.toBuilder(); + createKeySettings = settings.createKeySettings.toBuilder(); + listKeysSettings = settings.listKeysSettings.toBuilder(); + getKeySettings = settings.getKeySettings.toBuilder(); + updateKeySettings = settings.updateKeySettings.toBuilder(); + deleteKeySettings = settings.deleteKeySettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createAssessmentSettings, + annotateAssessmentSettings, + createKeySettings, + listKeysSettings, + getKeySettings, + updateKeySettings, + deleteKeySettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .createAssessmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .annotateAssessmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .createKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .listKeysSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .getKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .updateKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .deleteKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); return builder; } - protected Builder(RecaptchaEnterpriseServiceStubSettings settings) { - super(settings); - - createAssessmentSettings = settings.createAssessmentSettings.toBuilder(); - annotateAssessmentSettings = settings.annotateAssessmentSettings.toBuilder(); - createKeySettings = settings.createKeySettings.toBuilder(); - listKeysSettings = settings.listKeysSettings.toBuilder(); - getKeySettings = settings.getKeySettings.toBuilder(); - updateKeySettings = settings.updateKeySettings.toBuilder(); - deleteKeySettings = settings.deleteKeySettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createAssessmentSettings, - annotateAssessmentSettings, - createKeySettings, - listKeysSettings, - getKeySettings, - updateKeySettings, - deleteKeySettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Client.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Client.java index d07f8f81..fb2d90ed 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Client.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Client.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1beta1; import com.google.api.core.ApiFunction; @@ -47,24 +48,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * 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: * - *

- * 
- * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
- *   ProjectName parent = ProjectName.of("[PROJECT]");
- *   Assessment assessment = Assessment.newBuilder().build();
- *   Assessment response = recaptchaEnterpriseServiceV1Beta1Client.createAssessment(parent, assessment);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the recaptchaEnterpriseServiceV1Beta1Client object to + *

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

To customize credentials: * - *

- * 
+ * 
{@code
  * RecaptchaEnterpriseServiceV1Beta1Settings recaptchaEnterpriseServiceV1Beta1Settings =
  *     RecaptchaEnterpriseServiceV1Beta1Settings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
  *     RecaptchaEnterpriseServiceV1Beta1Client.create(recaptchaEnterpriseServiceV1Beta1Settings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * RecaptchaEnterpriseServiceV1Beta1Settings recaptchaEnterpriseServiceV1Beta1Settings =
  *     RecaptchaEnterpriseServiceV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build();
  * RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client =
  *     RecaptchaEnterpriseServiceV1Beta1Client.create(recaptchaEnterpriseServiceV1Beta1Settings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class RecaptchaEnterpriseServiceV1Beta1Client implements BackgroundResource { private final RecaptchaEnterpriseServiceV1Beta1Settings settings; private final RecaptchaEnterpriseServiceV1Beta1Stub stub; @@ -138,8 +127,8 @@ public static final RecaptchaEnterpriseServiceV1Beta1Client create( /** * Constructs an instance of RecaptchaEnterpriseServiceV1Beta1Client, using the given stub for - * making calls. This is for advanced usage - prefer to use - * RecaptchaEnterpriseServiceV1Beta1Settings}. + * making calls. This is for advanced usage - prefer using + * create(RecaptchaEnterpriseServiceV1Beta1Settings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final RecaptchaEnterpriseServiceV1Beta1Client create( @@ -174,20 +163,10 @@ public RecaptchaEnterpriseServiceV1Beta1Stub getStub() { return stub; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Assessment of the likelihood an event is legitimate. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Assessment assessment = Assessment.newBuilder().build();
-   *   Assessment response = recaptchaEnterpriseServiceV1Beta1Client.createAssessment(parent, assessment);
-   * }
-   * 
- * * @param parent Required. The name of the project in which the assessment will be created, in the * format "projects/{project_number}". * @param assessment Required. The assessment details. @@ -202,20 +181,10 @@ public final Assessment createAssessment(ProjectName parent, Assessment assessme return createAssessment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Assessment of the likelihood an event is legitimate. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Assessment assessment = Assessment.newBuilder().build();
-   *   Assessment response = recaptchaEnterpriseServiceV1Beta1Client.createAssessment(parent.toString(), assessment);
-   * }
-   * 
- * * @param parent Required. The name of the project in which the assessment will be created, in the * format "projects/{project_number}". * @param assessment Required. The assessment details. @@ -227,24 +196,10 @@ public final Assessment createAssessment(String parent, Assessment assessment) { return createAssessment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Assessment of the likelihood an event is legitimate. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Assessment assessment = Assessment.newBuilder().build();
-   *   CreateAssessmentRequest request = CreateAssessmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAssessment(assessment)
-   *     .build();
-   *   Assessment response = recaptchaEnterpriseServiceV1Beta1Client.createAssessment(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -252,45 +207,21 @@ public final Assessment createAssessment(CreateAssessmentRequest request) { return createAssessmentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Assessment of the likelihood an event is legitimate. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Assessment assessment = Assessment.newBuilder().build();
-   *   CreateAssessmentRequest request = CreateAssessmentRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAssessment(assessment)
-   *     .build();
-   *   ApiFuture<Assessment> future = recaptchaEnterpriseServiceV1Beta1Client.createAssessmentCallable().futureCall(request);
-   *   // Do something
-   *   Assessment response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createAssessmentCallable() { return stub.createAssessmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
-   *   AnnotateAssessmentRequest.Annotation annotation = AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED;
-   *   AnnotateAssessmentResponse response = recaptchaEnterpriseServiceV1Beta1Client.annotateAssessment(name, annotation);
-   * }
-   * 
- * * @param name Required. The resource name of the Assessment, in the format * "projects/{project_number}/assessments/{assessment_id}". * @param annotation Required. The annotation that will be assigned to the Event. @@ -306,21 +237,11 @@ public final AnnotateAssessmentResponse annotateAssessment( return annotateAssessment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
-   *   AnnotateAssessmentRequest.Annotation annotation = AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED;
-   *   AnnotateAssessmentResponse response = recaptchaEnterpriseServiceV1Beta1Client.annotateAssessment(name.toString(), annotation);
-   * }
-   * 
- * * @param name Required. The resource name of the Assessment, in the format * "projects/{project_number}/assessments/{assessment_id}". * @param annotation Required. The annotation that will be assigned to the Event. @@ -333,25 +254,11 @@ public final AnnotateAssessmentResponse annotateAssessment( return annotateAssessment(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
-   *   AnnotateAssessmentRequest.Annotation annotation = AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED;
-   *   AnnotateAssessmentRequest request = AnnotateAssessmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setAnnotation(annotation)
-   *     .build();
-   *   AnnotateAssessmentResponse response = recaptchaEnterpriseServiceV1Beta1Client.annotateAssessment(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -359,50 +266,22 @@ public final AnnotateAssessmentResponse annotateAssessment(AnnotateAssessmentReq return annotateAssessmentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Annotates a previously created Assessment to provide additional information on whether the * event turned out to be authentic or fradulent. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]");
-   *   AnnotateAssessmentRequest.Annotation annotation = AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED;
-   *   AnnotateAssessmentRequest request = AnnotateAssessmentRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setAnnotation(annotation)
-   *     .build();
-   *   ApiFuture<AnnotateAssessmentResponse> future = recaptchaEnterpriseServiceV1Beta1Client.annotateAssessmentCallable().futureCall(request);
-   *   // Do something
-   *   AnnotateAssessmentResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable annotateAssessmentCallable() { return stub.annotateAssessmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new reCAPTCHA Enterprise key. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Key key = Key.newBuilder().build();
-   *   CreateKeyRequest request = CreateKeyRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setKey(key)
-   *     .build();
-   *   Key response = recaptchaEnterpriseServiceV1Beta1Client.createKey(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -410,48 +289,20 @@ public final Key createKey(CreateKeyRequest request) { return createKeyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new reCAPTCHA Enterprise key. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   Key key = Key.newBuilder().build();
-   *   CreateKeyRequest request = CreateKeyRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setKey(key)
-   *     .build();
-   *   ApiFuture<Key> future = recaptchaEnterpriseServiceV1Beta1Client.createKeyCallable().futureCall(request);
-   *   // Do something
-   *   Key response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createKeyCallable() { return stub.createKeyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all keys that belong to a project. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListKeysRequest request = ListKeysRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (Key element : recaptchaEnterpriseServiceV1Beta1Client.listKeys(request).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -459,77 +310,30 @@ public final ListKeysPagedResponse listKeys(ListKeysRequest request) { return listKeysPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all keys that belong to a project. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListKeysRequest request = ListKeysRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListKeysPagedResponse> future = recaptchaEnterpriseServiceV1Beta1Client.listKeysPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Key element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listKeysPagedCallable() { return stub.listKeysPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the list of all keys that belong to a project. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListKeysRequest request = ListKeysRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   while (true) {
-   *     ListKeysResponse response = recaptchaEnterpriseServiceV1Beta1Client.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;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listKeysCallable() { return stub.listKeysCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified key. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   KeyName name = KeyName.of("[PROJECT]", "[KEY]");
-   *   GetKeyRequest request = GetKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   Key response = recaptchaEnterpriseServiceV1Beta1Client.getKey(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -537,44 +341,20 @@ public final Key getKey(GetKeyRequest request) { return getKeyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the specified key. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   KeyName name = KeyName.of("[PROJECT]", "[KEY]");
-   *   GetKeyRequest request = GetKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Key> future = recaptchaEnterpriseServiceV1Beta1Client.getKeyCallable().futureCall(request);
-   *   // Do something
-   *   Key response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getKeyCallable() { return stub.getKeyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified key. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   Key key = Key.newBuilder().build();
-   *   UpdateKeyRequest request = UpdateKeyRequest.newBuilder()
-   *     .setKey(key)
-   *     .build();
-   *   Key response = recaptchaEnterpriseServiceV1Beta1Client.updateKey(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -582,44 +362,20 @@ public final Key updateKey(UpdateKeyRequest request) { return updateKeyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the specified key. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   Key key = Key.newBuilder().build();
-   *   UpdateKeyRequest request = UpdateKeyRequest.newBuilder()
-   *     .setKey(key)
-   *     .build();
-   *   ApiFuture<Key> future = recaptchaEnterpriseServiceV1Beta1Client.updateKeyCallable().futureCall(request);
-   *   // Do something
-   *   Key response = future.get();
-   * }
-   * 
*/ public final UnaryCallable updateKeyCallable() { return stub.updateKeyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified key. * - *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   KeyName name = KeyName.of("[PROJECT]", "[KEY]");
-   *   DeleteKeyRequest request = DeleteKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   recaptchaEnterpriseServiceV1Beta1Client.deleteKey(request);
-   * }
-   * 
- * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -627,23 +383,11 @@ public final void deleteKey(DeleteKeyRequest request) { deleteKeyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the specified key. * *

Sample code: - * - *


-   * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
-   *   KeyName name = KeyName.of("[PROJECT]", "[KEY]");
-   *   DeleteKeyRequest request = DeleteKeyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = recaptchaEnterpriseServiceV1Beta1Client.deleteKeyCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteKeyCallable() { return stub.deleteKeyCallable(); diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Settings.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Settings.java index bd876e80..bcb3ac04 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Settings.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1Settings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1beta1; import static com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client.ListKeysPagedResponse; @@ -45,7 +46,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link RecaptchaEnterpriseServiceV1Beta1Client}. * @@ -63,24 +64,27 @@ * *

For example, to set the total timeout of createAssessment to 30 seconds: * - *

- * 
- * RecaptchaEnterpriseServiceV1Beta1Settings.Builder recaptchaEnterpriseServiceV1Beta1SettingsBuilder =
- *     RecaptchaEnterpriseServiceV1Beta1Settings.newBuilder();
+ * 
{@code
+ * RecaptchaEnterpriseServiceV1Beta1Settings.Builder
+ *     recaptchaEnterpriseServiceV1Beta1SettingsBuilder =
+ *         RecaptchaEnterpriseServiceV1Beta1Settings.newBuilder();
  * recaptchaEnterpriseServiceV1Beta1SettingsBuilder
  *     .createAssessmentSettings()
  *     .setRetrySettings(
- *         recaptchaEnterpriseServiceV1Beta1SettingsBuilder.createAssessmentSettings().getRetrySettings().toBuilder()
+ *         recaptchaEnterpriseServiceV1Beta1SettingsBuilder
+ *             .createAssessmentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * RecaptchaEnterpriseServiceV1Beta1Settings recaptchaEnterpriseServiceV1Beta1Settings = recaptchaEnterpriseServiceV1Beta1SettingsBuilder.build();
- * 
- * 
+ * RecaptchaEnterpriseServiceV1Beta1Settings recaptchaEnterpriseServiceV1Beta1Settings = + * recaptchaEnterpriseServiceV1Beta1SettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class RecaptchaEnterpriseServiceV1Beta1Settings extends ClientSettings { + /** Returns the object with the settings used for calls to createAssessment. */ public UnaryCallSettings createAssessmentSettings() { return ((RecaptchaEnterpriseServiceV1Beta1StubSettings) getStubSettings()) @@ -181,18 +185,15 @@ protected RecaptchaEnterpriseServiceV1Beta1Settings(Builder settingsBuilder) thr /** Builder for RecaptchaEnterpriseServiceV1Beta1Settings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(RecaptchaEnterpriseServiceV1Beta1StubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(RecaptchaEnterpriseServiceV1Beta1StubSettings.newBuilder()); - } - protected Builder(RecaptchaEnterpriseServiceV1Beta1Settings settings) { super(settings.getStubSettings().toBuilder()); } @@ -201,11 +202,15 @@ protected Builder(RecaptchaEnterpriseServiceV1Beta1StubSettings.Builder stubSett super(stubSettings); } + private static Builder createDefault() { + return new Builder(RecaptchaEnterpriseServiceV1Beta1StubSettings.newBuilder()); + } + public RecaptchaEnterpriseServiceV1Beta1StubSettings.Builder getStubSettingsBuilder() { return ((RecaptchaEnterpriseServiceV1Beta1StubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/package-info.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/package-info.java index 5f409b18..70c4c290 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/package-info.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/package-info.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -15,28 +15,15 @@ */ /** - * A client to reCAPTCHA Enterprise API. + * The interfaces provided are listed below, along with usage samples. * - *

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

======================================= RecaptchaEnterpriseServiceV1Beta1Client - * ======================================= + *

======================= RecaptchaEnterpriseServiceV1Beta1Client ======================= * *

Service Description: Service to determine the likelihood an event is legitimate. * *

Sample for RecaptchaEnterpriseServiceV1Beta1Client: - * - *

- * 
- * try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.create()) {
- *   ProjectName parent = ProjectName.of("[PROJECT]");
- *   Assessment assessment = Assessment.newBuilder().build();
- *   Assessment response = recaptchaEnterpriseServiceV1Beta1Client.createAssessment(parent, assessment);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.recaptchaenterprise.v1beta1; import javax.annotation.Generated; diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/GrpcRecaptchaEnterpriseServiceV1Beta1CallableFactory.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/GrpcRecaptchaEnterpriseServiceV1Beta1CallableFactory.java index 24db68f8..a65ac6a7 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/GrpcRecaptchaEnterpriseServiceV1Beta1CallableFactory.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/GrpcRecaptchaEnterpriseServiceV1Beta1CallableFactory.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,19 +31,20 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC callable factory implementation for reCAPTCHA Enterprise API. + * gRPC callable factory implementation for the RecaptchaEnterpriseServiceV1Beta1 service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcRecaptchaEnterpriseServiceV1Beta1CallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -56,61 +57,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/GrpcRecaptchaEnterpriseServiceV1Beta1Stub.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/GrpcRecaptchaEnterpriseServiceV1Beta1Stub.java index 4cb2bd9c..d56204ee 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/GrpcRecaptchaEnterpriseServiceV1Beta1Stub.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/GrpcRecaptchaEnterpriseServiceV1Beta1Stub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1beta1.stub; import static com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client.ListKeysPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -26,6 +26,7 @@ import com.google.api.gax.rpc.RequestParamsExtractor; import com.google.api.gax.rpc.UnaryCallable; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; @@ -45,17 +46,15 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for reCAPTCHA Enterprise API. + * gRPC stub implementation for the RecaptchaEnterpriseServiceV1Beta1 service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcRecaptchaEnterpriseServiceV1Beta1Stub extends RecaptchaEnterpriseServiceV1Beta1Stub { - private static final MethodDescriptor createAssessmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -66,6 +65,7 @@ public class GrpcRecaptchaEnterpriseServiceV1Beta1Stub ProtoUtils.marshaller(CreateAssessmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Assessment.getDefaultInstance())) .build(); + private static final MethodDescriptor annotateAssessmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -77,6 +77,7 @@ public class GrpcRecaptchaEnterpriseServiceV1Beta1Stub .setResponseMarshaller( ProtoUtils.marshaller(AnnotateAssessmentResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor createKeyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -85,6 +86,7 @@ public class GrpcRecaptchaEnterpriseServiceV1Beta1Stub .setRequestMarshaller(ProtoUtils.marshaller(CreateKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Key.getDefaultInstance())) .build(); + private static final MethodDescriptor listKeysMethodDescriptor = MethodDescriptor.newBuilder() @@ -94,6 +96,7 @@ public class GrpcRecaptchaEnterpriseServiceV1Beta1Stub .setRequestMarshaller(ProtoUtils.marshaller(ListKeysRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListKeysResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getKeyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -102,6 +105,7 @@ public class GrpcRecaptchaEnterpriseServiceV1Beta1Stub .setRequestMarshaller(ProtoUtils.marshaller(GetKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Key.getDefaultInstance())) .build(); + private static final MethodDescriptor updateKeyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -110,6 +114,7 @@ public class GrpcRecaptchaEnterpriseServiceV1Beta1Stub .setRequestMarshaller(ProtoUtils.marshaller(UpdateKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Key.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteKeyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -119,8 +124,6 @@ public class GrpcRecaptchaEnterpriseServiceV1Beta1Stub .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final UnaryCallable createAssessmentCallable; private final UnaryCallable annotateAssessmentCallable; @@ -131,6 +134,8 @@ public class GrpcRecaptchaEnterpriseServiceV1Beta1Stub private final UnaryCallable updateKeyCallable; private final UnaryCallable deleteKeyCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcRecaptchaEnterpriseServiceV1Beta1Stub create( @@ -174,6 +179,7 @@ protected GrpcRecaptchaEnterpriseServiceV1Beta1Stub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings createAssessmentTransportSettings = GrpcCallSettings.newBuilder() @@ -295,7 +301,12 @@ public Map extract(DeleteKeyRequest request) { callableFactory.createUnaryCallable( deleteKeyTransportSettings, settings.deleteKeySettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public UnaryCallable createAssessmentCallable() { @@ -311,14 +322,14 @@ public UnaryCallable createKeyCallable() { return createKeyCallable; } - public UnaryCallable listKeysPagedCallable() { - return listKeysPagedCallable; - } - public UnaryCallable listKeysCallable() { return listKeysCallable; } + public UnaryCallable listKeysPagedCallable() { + return listKeysPagedCallable; + } + public UnaryCallable getKeyCallable() { return getKeyCallable; } diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/RecaptchaEnterpriseServiceV1Beta1Stub.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/RecaptchaEnterpriseServiceV1Beta1Stub.java index 61ebf9fd..6868efc6 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/RecaptchaEnterpriseServiceV1Beta1Stub.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/RecaptchaEnterpriseServiceV1Beta1Stub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1beta1.stub; import static com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client.ListKeysPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.UnaryCallable; import com.google.protobuf.Empty; @@ -34,14 +34,13 @@ import com.google.recaptchaenterprise.v1beta1.UpdateKeyRequest; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for reCAPTCHA Enterprise API. + * Base stub class for the RecaptchaEnterpriseServiceV1Beta1 service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class RecaptchaEnterpriseServiceV1Beta1Stub implements BackgroundResource { public UnaryCallable createAssessmentCallable() { diff --git a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/RecaptchaEnterpriseServiceV1Beta1StubSettings.java b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/RecaptchaEnterpriseServiceV1Beta1StubSettings.java index 1c0e8e29..ec479986 100644 --- a/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/RecaptchaEnterpriseServiceV1Beta1StubSettings.java +++ b/google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1beta1/stub/RecaptchaEnterpriseServiceV1Beta1StubSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1beta1.stub; import static com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client.ListKeysPagedResponse; @@ -60,7 +61,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link RecaptchaEnterpriseServiceV1Beta1Stub}. * @@ -78,22 +79,25 @@ * *

For example, to set the total timeout of createAssessment to 30 seconds: * - *

- * 
- * RecaptchaEnterpriseServiceV1Beta1StubSettings.Builder recaptchaEnterpriseServiceV1Beta1SettingsBuilder =
- *     RecaptchaEnterpriseServiceV1Beta1StubSettings.newBuilder();
+ * 
{@code
+ * RecaptchaEnterpriseServiceV1Beta1StubSettings.Builder
+ *     recaptchaEnterpriseServiceV1Beta1SettingsBuilder =
+ *         RecaptchaEnterpriseServiceV1Beta1StubSettings.newBuilder();
  * recaptchaEnterpriseServiceV1Beta1SettingsBuilder
  *     .createAssessmentSettings()
  *     .setRetrySettings(
- *         recaptchaEnterpriseServiceV1Beta1SettingsBuilder.createAssessmentSettings().getRetrySettings().toBuilder()
+ *         recaptchaEnterpriseServiceV1Beta1SettingsBuilder
+ *             .createAssessmentSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * RecaptchaEnterpriseServiceV1Beta1StubSettings recaptchaEnterpriseServiceV1Beta1Settings = recaptchaEnterpriseServiceV1Beta1SettingsBuilder.build();
- * 
- * 
+ * RecaptchaEnterpriseServiceV1Beta1StubSettings recaptchaEnterpriseServiceV1Beta1Settings = + * recaptchaEnterpriseServiceV1Beta1SettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class RecaptchaEnterpriseServiceV1Beta1StubSettings extends StubSettings { /** The default scopes of the service. */ @@ -110,6 +114,58 @@ public class RecaptchaEnterpriseServiceV1Beta1StubSettings private final UnaryCallSettings updateKeySettings; private final UnaryCallSettings deleteKeySettings; + private static final PagedListDescriptor + LIST_KEYS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListKeysRequest injectToken(ListKeysRequest payload, String token) { + return ListKeysRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListKeysRequest injectPageSize(ListKeysRequest payload, int pageSize) { + return ListKeysRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListKeysRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListKeysResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListKeysResponse payload) { + return payload.getKeysList() == null + ? ImmutableList.of() + : payload.getKeysList(); + } + }; + + private static final PagedListResponseFactory< + ListKeysRequest, ListKeysResponse, ListKeysPagedResponse> + LIST_KEYS_PAGE_STR_FACT = + new PagedListResponseFactory() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListKeysRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_KEYS_PAGE_STR_DESC, request, context); + return ListKeysPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createAssessment. */ public UnaryCallSettings createAssessmentSettings() { return createAssessmentSettings; @@ -153,10 +209,10 @@ public RecaptchaEnterpriseServiceV1Beta1Stub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcRecaptchaEnterpriseServiceV1Beta1Stub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -227,63 +283,10 @@ protected RecaptchaEnterpriseServiceV1Beta1StubSettings(Builder settingsBuilder) deleteKeySettings = settingsBuilder.deleteKeySettings().build(); } - private static final PagedListDescriptor - LIST_KEYS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListKeysRequest injectToken(ListKeysRequest payload, String token) { - return ListKeysRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListKeysRequest injectPageSize(ListKeysRequest payload, int pageSize) { - return ListKeysRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListKeysRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListKeysResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListKeysResponse payload) { - return payload.getKeysList() != null - ? payload.getKeysList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListKeysRequest, ListKeysResponse, ListKeysPagedResponse> - LIST_KEYS_PAGE_STR_FACT = - new PagedListResponseFactory() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListKeysRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_KEYS_PAGE_STR_DESC, request, context); - return ListKeysPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for RecaptchaEnterpriseServiceV1Beta1StubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createAssessmentSettings; private final UnaryCallSettings.Builder @@ -295,16 +298,14 @@ public static class Builder private final UnaryCallSettings.Builder getKeySettings; private final UnaryCallSettings.Builder updateKeySettings; private final UnaryCallSettings.Builder deleteKeySettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder> definitions = ImmutableMap.builder(); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( - "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + "no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -313,8 +314,6 @@ public static class Builder static { ImmutableMap.Builder definitions = ImmutableMap.builder(); RetrySettings settings = null; - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(600000L)) @@ -322,29 +321,23 @@ public static class Builder .setMaxRpcTimeout(Duration.ofMillis(600000L)) .setTotalTimeout(Duration.ofMillis(600000L)) .build(); - definitions.put("no_retry_1_params", settings); + definitions.put("no_retry_0_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(clientContext); createAssessmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - annotateAssessmentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listKeysSettings = PagedCallSettings.newBuilder(LIST_KEYS_PAGE_STR_FACT); - getKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = @@ -356,82 +349,82 @@ protected Builder(ClientContext clientContext) { getKeySettings, updateKeySettings, deleteKeySettings); - initDefaults(this); } + protected Builder(RecaptchaEnterpriseServiceV1Beta1StubSettings settings) { + super(settings); + + createAssessmentSettings = settings.createAssessmentSettings.toBuilder(); + annotateAssessmentSettings = settings.annotateAssessmentSettings.toBuilder(); + createKeySettings = settings.createKeySettings.toBuilder(); + listKeysSettings = settings.listKeysSettings.toBuilder(); + getKeySettings = settings.getKeySettings.toBuilder(); + updateKeySettings = settings.updateKeySettings.toBuilder(); + deleteKeySettings = settings.deleteKeySettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createAssessmentSettings, + annotateAssessmentSettings, + createKeySettings, + listKeysSettings, + getKeySettings, + updateKeySettings, + deleteKeySettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .createAssessmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .annotateAssessmentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .createKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .listKeysSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .getKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .updateKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .deleteKeySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); return builder; } - protected Builder(RecaptchaEnterpriseServiceV1Beta1StubSettings settings) { - super(settings); - - createAssessmentSettings = settings.createAssessmentSettings.toBuilder(); - annotateAssessmentSettings = settings.annotateAssessmentSettings.toBuilder(); - createKeySettings = settings.createKeySettings.toBuilder(); - listKeysSettings = settings.listKeysSettings.toBuilder(); - getKeySettings = settings.getKeySettings.toBuilder(); - updateKeySettings = settings.updateKeySettings.toBuilder(); - deleteKeySettings = settings.deleteKeySettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createAssessmentSettings, - annotateAssessmentSettings, - createKeySettings, - listKeysSettings, - getKeySettings, - updateKeySettings, - deleteKeySettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/MockRecaptchaEnterpriseService.java b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/MockRecaptchaEnterpriseService.java index f41689e5..faff9366 100644 --- a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/MockRecaptchaEnterpriseService.java +++ b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/MockRecaptchaEnterpriseService.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockRecaptchaEnterpriseService implements MockGrpcService { private final MockRecaptchaEnterpriseServiceImpl serviceImpl; diff --git a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/MockRecaptchaEnterpriseServiceImpl.java b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/MockRecaptchaEnterpriseServiceImpl.java index da7cd991..96309fb8 100644 --- a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/MockRecaptchaEnterpriseServiceImpl.java +++ b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/MockRecaptchaEnterpriseServiceImpl.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1; import com.google.api.core.BetaApi; @@ -35,9 +36,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockRecaptchaEnterpriseServiceImpl extends RecaptchaEnterpriseServiceImplBase { private List requests; private Queue responses; @@ -74,10 +76,10 @@ public void createAssessment( Object response = responses.remove(); if (response instanceof Assessment) { requests.add(request); - responseObserver.onNext((Assessment) response); + responseObserver.onNext(((Assessment) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -90,10 +92,10 @@ public void annotateAssessment( Object response = responses.remove(); if (response instanceof AnnotateAssessmentResponse) { requests.add(request); - responseObserver.onNext((AnnotateAssessmentResponse) response); + responseObserver.onNext(((AnnotateAssessmentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -104,10 +106,10 @@ public void createKey(CreateKeyRequest request, StreamObserver responseObse Object response = responses.remove(); if (response instanceof Key) { requests.add(request); - responseObserver.onNext((Key) response); + responseObserver.onNext(((Key) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -118,10 +120,10 @@ public void listKeys(ListKeysRequest request, StreamObserver r Object response = responses.remove(); if (response instanceof ListKeysResponse) { requests.add(request); - responseObserver.onNext((ListKeysResponse) response); + responseObserver.onNext(((ListKeysResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -132,10 +134,10 @@ public void getKey(GetKeyRequest request, StreamObserver responseObserver) Object response = responses.remove(); if (response instanceof Key) { requests.add(request); - responseObserver.onNext((Key) response); + responseObserver.onNext(((Key) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -146,10 +148,10 @@ public void updateKey(UpdateKeyRequest request, StreamObserver responseObse Object response = responses.remove(); if (response instanceof Key) { requests.add(request); - responseObserver.onNext((Key) response); + responseObserver.onNext(((Key) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -160,10 +162,10 @@ public void deleteKey(DeleteKeyRequest request, StreamObserver responseOb Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClientTest.java b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClientTest.java index 2b3568c8..eb923d2e 100644 --- a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClientTest.java +++ b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClientTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1; import static com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient.ListKeysPagedResponse; @@ -27,6 +28,8 @@ import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; import com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest; import com.google.recaptchaenterprise.v1.AnnotateAssessmentResponse; import com.google.recaptchaenterprise.v1.Assessment; @@ -34,19 +37,23 @@ import com.google.recaptchaenterprise.v1.CreateAssessmentRequest; import com.google.recaptchaenterprise.v1.CreateKeyRequest; import com.google.recaptchaenterprise.v1.DeleteKeyRequest; +import com.google.recaptchaenterprise.v1.Event; import com.google.recaptchaenterprise.v1.GetKeyRequest; import com.google.recaptchaenterprise.v1.Key; import com.google.recaptchaenterprise.v1.KeyName; import com.google.recaptchaenterprise.v1.ListKeysRequest; import com.google.recaptchaenterprise.v1.ListKeysResponse; import com.google.recaptchaenterprise.v1.ProjectName; +import com.google.recaptchaenterprise.v1.RiskAnalysis; +import com.google.recaptchaenterprise.v1.TokenProperties; import com.google.recaptchaenterprise.v1.UpdateKeyRequest; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -54,32 +61,32 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class RecaptchaEnterpriseServiceClientTest { + private static MockServiceHelper mockServiceHelper; private static MockRecaptchaEnterpriseService mockRecaptchaEnterpriseService; - private static MockServiceHelper serviceHelper; private RecaptchaEnterpriseServiceClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockRecaptchaEnterpriseService = new MockRecaptchaEnterpriseService(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), Arrays.asList(mockRecaptchaEnterpriseService)); - serviceHelper.start(); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); RecaptchaEnterpriseServiceSettings settings = RecaptchaEnterpriseServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -94,10 +101,14 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createAssessmentTest() { - AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]"); - Assessment expectedResponse = Assessment.newBuilder().setName(name.toString()).build(); + public void createAssessmentTest() throws Exception { + Assessment expectedResponse = + Assessment.newBuilder() + .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString()) + .setEvent(Event.newBuilder().build()) + .setRiskAnalysis(RiskAnalysis.newBuilder().build()) + .setTokenProperties(TokenProperties.newBuilder().build()) + .build(); mockRecaptchaEnterpriseService.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); @@ -108,9 +119,9 @@ public void createAssessmentTest() { List actualRequests = mockRecaptchaEnterpriseService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateAssessmentRequest actualRequest = (CreateAssessmentRequest) actualRequests.get(0); + CreateAssessmentRequest actualRequest = ((CreateAssessmentRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(assessment, actualRequest.getAssessment()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -119,40 +130,81 @@ public void createAssessmentTest() { } @Test - @SuppressWarnings("all") public void createAssessmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseService.addException(exception); try { ProjectName parent = ProjectName.of("[PROJECT]"); Assessment assessment = Assessment.newBuilder().build(); + client.createAssessment(parent, assessment); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createAssessmentTest2() throws Exception { + Assessment expectedResponse = + Assessment.newBuilder() + .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString()) + .setEvent(Event.newBuilder().build()) + .setRiskAnalysis(RiskAnalysis.newBuilder().build()) + .setTokenProperties(TokenProperties.newBuilder().build()) + .build(); + mockRecaptchaEnterpriseService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Assessment assessment = Assessment.newBuilder().build(); + + Assessment actualResponse = client.createAssessment(parent, assessment); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockRecaptchaEnterpriseService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateAssessmentRequest actualRequest = ((CreateAssessmentRequest) actualRequests.get(0)); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(assessment, actualRequest.getAssessment()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createAssessmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockRecaptchaEnterpriseService.addException(exception); + + try { + String parent = "parent-995424086"; + Assessment assessment = Assessment.newBuilder().build(); client.createAssessment(parent, assessment); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void annotateAssessmentTest() { + public void annotateAssessmentTest() throws Exception { AnnotateAssessmentResponse expectedResponse = AnnotateAssessmentResponse.newBuilder().build(); mockRecaptchaEnterpriseService.addResponse(expectedResponse); AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]"); AnnotateAssessmentRequest.Annotation annotation = - AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED; + AnnotateAssessmentRequest.Annotation.forNumber(0); AnnotateAssessmentResponse actualResponse = client.annotateAssessment(name, annotation); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockRecaptchaEnterpriseService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - AnnotateAssessmentRequest actualRequest = (AnnotateAssessmentRequest) actualRequests.get(0); + AnnotateAssessmentRequest actualRequest = ((AnnotateAssessmentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AssessmentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertEquals(annotation, actualRequest.getAnnotation()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -161,46 +213,87 @@ public void annotateAssessmentTest() { } @Test - @SuppressWarnings("all") public void annotateAssessmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseService.addException(exception); try { AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]"); AnnotateAssessmentRequest.Annotation annotation = - AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED; + AnnotateAssessmentRequest.Annotation.forNumber(0); + client.annotateAssessment(name, annotation); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void annotateAssessmentTest2() throws Exception { + AnnotateAssessmentResponse expectedResponse = AnnotateAssessmentResponse.newBuilder().build(); + mockRecaptchaEnterpriseService.addResponse(expectedResponse); + + String name = "name3373707"; + AnnotateAssessmentRequest.Annotation annotation = + AnnotateAssessmentRequest.Annotation.forNumber(0); + + AnnotateAssessmentResponse actualResponse = client.annotateAssessment(name, annotation); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockRecaptchaEnterpriseService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnnotateAssessmentRequest actualRequest = ((AnnotateAssessmentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(annotation, actualRequest.getAnnotation()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void annotateAssessmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockRecaptchaEnterpriseService.addException(exception); + try { + String name = "name3373707"; + AnnotateAssessmentRequest.Annotation annotation = + AnnotateAssessmentRequest.Annotation.forNumber(0); client.annotateAssessment(name, annotation); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createKeyTest() { - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - String displayName = "displayName1615086568"; + public void createKeyTest() throws Exception { Key expectedResponse = - Key.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .build(); mockRecaptchaEnterpriseService.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); - Key key = Key.newBuilder().build(); CreateKeyRequest request = - CreateKeyRequest.newBuilder().setParent(parent.toString()).setKey(key).build(); + CreateKeyRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setKey(Key.newBuilder().build()) + .build(); Key actualResponse = client.createKey(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockRecaptchaEnterpriseService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateKeyRequest actualRequest = (CreateKeyRequest) actualRequests.get(0); + CreateKeyRequest actualRequest = ((CreateKeyRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); - Assert.assertEquals(key, actualRequest.getKey()); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getKey(), actualRequest.getKey()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -208,48 +301,54 @@ public void createKeyTest() { } @Test - @SuppressWarnings("all") public void createKeyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseService.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); - Key key = Key.newBuilder().build(); CreateKeyRequest request = - CreateKeyRequest.newBuilder().setParent(parent.toString()).setKey(key).build(); - + CreateKeyRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setKey(Key.newBuilder().build()) + .build(); client.createKey(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listKeysTest() { - String nextPageToken = ""; - Key keysElement = Key.newBuilder().build(); - List keys = Arrays.asList(keysElement); + public void listKeysTest() throws Exception { + Key responsesElement = Key.newBuilder().build(); ListKeysResponse expectedResponse = - ListKeysResponse.newBuilder().setNextPageToken(nextPageToken).addAllKeys(keys).build(); + ListKeysResponse.newBuilder() + .setNextPageToken("") + .addAllKeys(Arrays.asList(responsesElement)) + .build(); mockRecaptchaEnterpriseService.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); - ListKeysRequest request = ListKeysRequest.newBuilder().setParent(parent.toString()).build(); + ListKeysRequest request = + ListKeysRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); ListKeysPagedResponse pagedListResponse = client.listKeys(request); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getKeysList().get(0), resources.get(0)); List actualRequests = mockRecaptchaEnterpriseService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListKeysRequest actualRequest = (ListKeysRequest) actualRequests.get(0); + ListKeysRequest actualRequest = ((ListKeysRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -257,42 +356,46 @@ public void listKeysTest() { } @Test - @SuppressWarnings("all") public void listKeysExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseService.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); - ListKeysRequest request = ListKeysRequest.newBuilder().setParent(parent.toString()).build(); - + ListKeysRequest request = + ListKeysRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); client.listKeys(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getKeyTest() { - KeyName name2 = KeyName.of("[PROJECT]", "[KEY]"); - String displayName = "displayName1615086568"; + public void getKeyTest() throws Exception { Key expectedResponse = - Key.newBuilder().setName(name2.toString()).setDisplayName(displayName).build(); + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .build(); mockRecaptchaEnterpriseService.addResponse(expectedResponse); - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - GetKeyRequest request = GetKeyRequest.newBuilder().setName(name.toString()).build(); + GetKeyRequest request = + GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build(); Key actualResponse = client.getKey(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockRecaptchaEnterpriseService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetKeyRequest actualRequest = (GetKeyRequest) actualRequests.get(0); + GetKeyRequest actualRequest = ((GetKeyRequest) actualRequests.get(0)); - Assert.assertEquals(name, KeyName.parse(actualRequest.getName())); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -300,42 +403,46 @@ public void getKeyTest() { } @Test - @SuppressWarnings("all") public void getKeyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseService.addException(exception); try { - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - GetKeyRequest request = GetKeyRequest.newBuilder().setName(name.toString()).build(); - + GetKeyRequest request = + GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build(); client.getKey(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateKeyTest() { - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - String displayName = "displayName1615086568"; + public void updateKeyTest() throws Exception { Key expectedResponse = - Key.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .build(); mockRecaptchaEnterpriseService.addResponse(expectedResponse); - Key key = Key.newBuilder().build(); - UpdateKeyRequest request = UpdateKeyRequest.newBuilder().setKey(key).build(); + UpdateKeyRequest request = + UpdateKeyRequest.newBuilder() + .setKey(Key.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); Key actualResponse = client.updateKey(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockRecaptchaEnterpriseService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateKeyRequest actualRequest = (UpdateKeyRequest) actualRequests.get(0); + UpdateKeyRequest actualRequest = ((UpdateKeyRequest) actualRequests.get(0)); - Assert.assertEquals(key, actualRequest.getKey()); + Assert.assertEquals(request.getKey(), actualRequest.getKey()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -343,38 +450,38 @@ public void updateKeyTest() { } @Test - @SuppressWarnings("all") public void updateKeyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseService.addException(exception); try { - Key key = Key.newBuilder().build(); - UpdateKeyRequest request = UpdateKeyRequest.newBuilder().setKey(key).build(); - + UpdateKeyRequest request = + UpdateKeyRequest.newBuilder() + .setKey(Key.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); client.updateKey(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteKeyTest() { + public void deleteKeyTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockRecaptchaEnterpriseService.addResponse(expectedResponse); - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - DeleteKeyRequest request = DeleteKeyRequest.newBuilder().setName(name.toString()).build(); + DeleteKeyRequest request = + DeleteKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build(); client.deleteKey(request); List actualRequests = mockRecaptchaEnterpriseService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteKeyRequest actualRequest = (DeleteKeyRequest) actualRequests.get(0); + DeleteKeyRequest actualRequest = ((DeleteKeyRequest) actualRequests.get(0)); - Assert.assertEquals(name, KeyName.parse(actualRequest.getName())); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -382,19 +489,19 @@ public void deleteKeyTest() { } @Test - @SuppressWarnings("all") public void deleteKeyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseService.addException(exception); try { - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - DeleteKeyRequest request = DeleteKeyRequest.newBuilder().setName(name.toString()).build(); - + DeleteKeyRequest request = + DeleteKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .build(); client.deleteKey(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/MockRecaptchaEnterpriseServiceV1Beta1.java b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/MockRecaptchaEnterpriseServiceV1Beta1.java index f7fd3594..09416097 100644 --- a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/MockRecaptchaEnterpriseServiceV1Beta1.java +++ b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/MockRecaptchaEnterpriseServiceV1Beta1.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1beta1; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockRecaptchaEnterpriseServiceV1Beta1 implements MockGrpcService { private final MockRecaptchaEnterpriseServiceV1Beta1Impl serviceImpl; diff --git a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/MockRecaptchaEnterpriseServiceV1Beta1Impl.java b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/MockRecaptchaEnterpriseServiceV1Beta1Impl.java index 1f8dddc6..09a9a2e9 100644 --- a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/MockRecaptchaEnterpriseServiceV1Beta1Impl.java +++ b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/MockRecaptchaEnterpriseServiceV1Beta1Impl.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1beta1; import com.google.api.core.BetaApi; @@ -35,9 +36,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockRecaptchaEnterpriseServiceV1Beta1Impl extends RecaptchaEnterpriseServiceV1Beta1ImplBase { private List requests; @@ -75,10 +77,10 @@ public void createAssessment( Object response = responses.remove(); if (response instanceof Assessment) { requests.add(request); - responseObserver.onNext((Assessment) response); + responseObserver.onNext(((Assessment) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -91,10 +93,10 @@ public void annotateAssessment( Object response = responses.remove(); if (response instanceof AnnotateAssessmentResponse) { requests.add(request); - responseObserver.onNext((AnnotateAssessmentResponse) response); + responseObserver.onNext(((AnnotateAssessmentResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -105,10 +107,10 @@ public void createKey(CreateKeyRequest request, StreamObserver responseObse Object response = responses.remove(); if (response instanceof Key) { requests.add(request); - responseObserver.onNext((Key) response); + responseObserver.onNext(((Key) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -119,10 +121,10 @@ public void listKeys(ListKeysRequest request, StreamObserver r Object response = responses.remove(); if (response instanceof ListKeysResponse) { requests.add(request); - responseObserver.onNext((ListKeysResponse) response); + responseObserver.onNext(((ListKeysResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -133,10 +135,10 @@ public void getKey(GetKeyRequest request, StreamObserver responseObserver) Object response = responses.remove(); if (response instanceof Key) { requests.add(request); - responseObserver.onNext((Key) response); + responseObserver.onNext(((Key) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -147,10 +149,10 @@ public void updateKey(UpdateKeyRequest request, StreamObserver responseObse Object response = responses.remove(); if (response instanceof Key) { requests.add(request); - responseObserver.onNext((Key) response); + responseObserver.onNext(((Key) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -161,10 +163,10 @@ public void deleteKey(DeleteKeyRequest request, StreamObserver responseOb Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1ClientTest.java b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1ClientTest.java index 9f35da17..8d07f03c 100644 --- a/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1ClientTest.java +++ b/google-cloud-recaptchaenterprise/src/test/java/com/google/cloud/recaptchaenterprise/v1beta1/RecaptchaEnterpriseServiceV1Beta1ClientTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.recaptchaenterprise.v1beta1; import static com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client.ListKeysPagedResponse; @@ -27,6 +28,7 @@ import com.google.common.collect.Lists; import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; import com.google.recaptchaenterprise.v1beta1.Assessment; @@ -34,19 +36,22 @@ import com.google.recaptchaenterprise.v1beta1.CreateAssessmentRequest; import com.google.recaptchaenterprise.v1beta1.CreateKeyRequest; import com.google.recaptchaenterprise.v1beta1.DeleteKeyRequest; +import com.google.recaptchaenterprise.v1beta1.Event; import com.google.recaptchaenterprise.v1beta1.GetKeyRequest; import com.google.recaptchaenterprise.v1beta1.Key; import com.google.recaptchaenterprise.v1beta1.KeyName; import com.google.recaptchaenterprise.v1beta1.ListKeysRequest; import com.google.recaptchaenterprise.v1beta1.ListKeysResponse; import com.google.recaptchaenterprise.v1beta1.ProjectName; +import com.google.recaptchaenterprise.v1beta1.TokenProperties; import com.google.recaptchaenterprise.v1beta1.UpdateKeyRequest; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -54,32 +59,32 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class RecaptchaEnterpriseServiceV1Beta1ClientTest { - private static MockRecaptchaEnterpriseServiceV1Beta1 mockRecaptchaEnterpriseServiceV1Beta1; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private RecaptchaEnterpriseServiceV1Beta1Client client; private LocalChannelProvider channelProvider; + private static MockRecaptchaEnterpriseServiceV1Beta1 mockRecaptchaEnterpriseServiceV1Beta1; @BeforeClass public static void startStaticServer() { mockRecaptchaEnterpriseServiceV1Beta1 = new MockRecaptchaEnterpriseServiceV1Beta1(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), Arrays.asList(mockRecaptchaEnterpriseServiceV1Beta1)); - serviceHelper.start(); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); RecaptchaEnterpriseServiceV1Beta1Settings settings = RecaptchaEnterpriseServiceV1Beta1Settings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -94,12 +99,15 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createAssessmentTest() { - AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]"); - float score = 1.0926453E7F; + public void createAssessmentTest() throws Exception { Assessment expectedResponse = - Assessment.newBuilder().setName(name.toString()).setScore(score).build(); + Assessment.newBuilder() + .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString()) + .setEvent(Event.newBuilder().build()) + .setScore(109264530) + .setTokenProperties(TokenProperties.newBuilder().build()) + .addAllReasons(new ArrayList()) + .build(); mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); @@ -110,9 +118,9 @@ public void createAssessmentTest() { List actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateAssessmentRequest actualRequest = (CreateAssessmentRequest) actualRequests.get(0); + CreateAssessmentRequest actualRequest = ((CreateAssessmentRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(assessment, actualRequest.getAssessment()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -121,40 +129,82 @@ public void createAssessmentTest() { } @Test - @SuppressWarnings("all") public void createAssessmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseServiceV1Beta1.addException(exception); try { ProjectName parent = ProjectName.of("[PROJECT]"); Assessment assessment = Assessment.newBuilder().build(); + client.createAssessment(parent, assessment); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void createAssessmentTest2() throws Exception { + Assessment expectedResponse = + Assessment.newBuilder() + .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString()) + .setEvent(Event.newBuilder().build()) + .setScore(109264530) + .setTokenProperties(TokenProperties.newBuilder().build()) + .addAllReasons(new ArrayList()) + .build(); + mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Assessment assessment = Assessment.newBuilder().build(); + + Assessment actualResponse = client.createAssessment(parent, assessment); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateAssessmentRequest actualRequest = ((CreateAssessmentRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(assessment, actualRequest.getAssessment()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createAssessmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockRecaptchaEnterpriseServiceV1Beta1.addException(exception); + + try { + String parent = "parent-995424086"; + Assessment assessment = Assessment.newBuilder().build(); client.createAssessment(parent, assessment); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void annotateAssessmentTest() { + public void annotateAssessmentTest() throws Exception { AnnotateAssessmentResponse expectedResponse = AnnotateAssessmentResponse.newBuilder().build(); mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse); AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]"); AnnotateAssessmentRequest.Annotation annotation = - AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED; + AnnotateAssessmentRequest.Annotation.forNumber(0); AnnotateAssessmentResponse actualResponse = client.annotateAssessment(name, annotation); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); - AnnotateAssessmentRequest actualRequest = (AnnotateAssessmentRequest) actualRequests.get(0); + AnnotateAssessmentRequest actualRequest = ((AnnotateAssessmentRequest) actualRequests.get(0)); - Assert.assertEquals(name, AssessmentName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertEquals(annotation, actualRequest.getAnnotation()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -163,46 +213,85 @@ public void annotateAssessmentTest() { } @Test - @SuppressWarnings("all") public void annotateAssessmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseServiceV1Beta1.addException(exception); try { AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]"); AnnotateAssessmentRequest.Annotation annotation = - AnnotateAssessmentRequest.Annotation.ANNOTATION_UNSPECIFIED; + AnnotateAssessmentRequest.Annotation.forNumber(0); + client.annotateAssessment(name, annotation); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void annotateAssessmentTest2() throws Exception { + AnnotateAssessmentResponse expectedResponse = AnnotateAssessmentResponse.newBuilder().build(); + mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse); + + String name = "name3373707"; + AnnotateAssessmentRequest.Annotation annotation = + AnnotateAssessmentRequest.Annotation.forNumber(0); + + AnnotateAssessmentResponse actualResponse = client.annotateAssessment(name, annotation); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnnotateAssessmentRequest actualRequest = ((AnnotateAssessmentRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(annotation, actualRequest.getAnnotation()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void annotateAssessmentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockRecaptchaEnterpriseServiceV1Beta1.addException(exception); + + try { + String name = "name3373707"; + AnnotateAssessmentRequest.Annotation annotation = + AnnotateAssessmentRequest.Annotation.forNumber(0); client.annotateAssessment(name, annotation); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createKeyTest() { - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - String displayName = "displayName1615086568"; + public void createKeyTest() throws Exception { Key expectedResponse = - Key.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .setDisplayName("displayName1714148973") + .build(); mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); - Key key = Key.newBuilder().build(); CreateKeyRequest request = - CreateKeyRequest.newBuilder().setParent(parent.toString()).setKey(key).build(); + CreateKeyRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setKey(Key.newBuilder().build()) + .build(); Key actualResponse = client.createKey(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateKeyRequest actualRequest = (CreateKeyRequest) actualRequests.get(0); + CreateKeyRequest actualRequest = ((CreateKeyRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); - Assert.assertEquals(key, actualRequest.getKey()); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getKey(), actualRequest.getKey()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -210,48 +299,54 @@ public void createKeyTest() { } @Test - @SuppressWarnings("all") public void createKeyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseServiceV1Beta1.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); - Key key = Key.newBuilder().build(); CreateKeyRequest request = - CreateKeyRequest.newBuilder().setParent(parent.toString()).setKey(key).build(); - + CreateKeyRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setKey(Key.newBuilder().build()) + .build(); client.createKey(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listKeysTest() { - String nextPageToken = ""; - Key keysElement = Key.newBuilder().build(); - List keys = Arrays.asList(keysElement); + public void listKeysTest() throws Exception { + Key responsesElement = Key.newBuilder().build(); ListKeysResponse expectedResponse = - ListKeysResponse.newBuilder().setNextPageToken(nextPageToken).addAllKeys(keys).build(); + ListKeysResponse.newBuilder() + .setNextPageToken("") + .addAllKeys(Arrays.asList(responsesElement)) + .build(); mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse); - ProjectName parent = ProjectName.of("[PROJECT]"); - ListKeysRequest request = ListKeysRequest.newBuilder().setParent(parent.toString()).build(); + ListKeysRequest request = + ListKeysRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); ListKeysPagedResponse pagedListResponse = client.listKeys(request); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getKeysList().get(0), resources.get(0)); List actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListKeysRequest actualRequest = (ListKeysRequest) actualRequests.get(0); + ListKeysRequest actualRequest = ((ListKeysRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -259,42 +354,44 @@ public void listKeysTest() { } @Test - @SuppressWarnings("all") public void listKeysExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseServiceV1Beta1.addException(exception); try { - ProjectName parent = ProjectName.of("[PROJECT]"); - ListKeysRequest request = ListKeysRequest.newBuilder().setParent(parent.toString()).build(); - + ListKeysRequest request = + ListKeysRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); client.listKeys(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getKeyTest() { - KeyName name2 = KeyName.of("[PROJECT]", "[KEY]"); - String displayName = "displayName1615086568"; + public void getKeyTest() throws Exception { Key expectedResponse = - Key.newBuilder().setName(name2.toString()).setDisplayName(displayName).build(); + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .setDisplayName("displayName1714148973") + .build(); mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse); - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - GetKeyRequest request = GetKeyRequest.newBuilder().setName(name.toString()).build(); + GetKeyRequest request = + GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build(); Key actualResponse = client.getKey(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetKeyRequest actualRequest = (GetKeyRequest) actualRequests.get(0); + GetKeyRequest actualRequest = ((GetKeyRequest) actualRequests.get(0)); - Assert.assertEquals(name, KeyName.parse(actualRequest.getName())); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -302,42 +399,44 @@ public void getKeyTest() { } @Test - @SuppressWarnings("all") public void getKeyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseServiceV1Beta1.addException(exception); try { - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - GetKeyRequest request = GetKeyRequest.newBuilder().setName(name.toString()).build(); - + GetKeyRequest request = + GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build(); client.getKey(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateKeyTest() { - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - String displayName = "displayName1615086568"; + public void updateKeyTest() throws Exception { Key expectedResponse = - Key.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .setDisplayName("displayName1714148973") + .build(); mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse); - Key key = Key.newBuilder().build(); - UpdateKeyRequest request = UpdateKeyRequest.newBuilder().setKey(key).build(); + UpdateKeyRequest request = + UpdateKeyRequest.newBuilder() + .setKey(Key.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); Key actualResponse = client.updateKey(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateKeyRequest actualRequest = (UpdateKeyRequest) actualRequests.get(0); + UpdateKeyRequest actualRequest = ((UpdateKeyRequest) actualRequests.get(0)); - Assert.assertEquals(key, actualRequest.getKey()); + Assert.assertEquals(request.getKey(), actualRequest.getKey()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -345,38 +444,38 @@ public void updateKeyTest() { } @Test - @SuppressWarnings("all") public void updateKeyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseServiceV1Beta1.addException(exception); try { - Key key = Key.newBuilder().build(); - UpdateKeyRequest request = UpdateKeyRequest.newBuilder().setKey(key).build(); - + UpdateKeyRequest request = + UpdateKeyRequest.newBuilder() + .setKey(Key.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); client.updateKey(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteKeyTest() { + public void deleteKeyTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockRecaptchaEnterpriseServiceV1Beta1.addResponse(expectedResponse); - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - DeleteKeyRequest request = DeleteKeyRequest.newBuilder().setName(name.toString()).build(); + DeleteKeyRequest request = + DeleteKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build(); client.deleteKey(request); List actualRequests = mockRecaptchaEnterpriseServiceV1Beta1.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteKeyRequest actualRequest = (DeleteKeyRequest) actualRequests.get(0); + DeleteKeyRequest actualRequest = ((DeleteKeyRequest) actualRequests.get(0)); - Assert.assertEquals(name, KeyName.parse(actualRequest.getName())); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -384,19 +483,19 @@ public void deleteKeyTest() { } @Test - @SuppressWarnings("all") public void deleteKeyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockRecaptchaEnterpriseServiceV1Beta1.addException(exception); try { - KeyName name = KeyName.of("[PROJECT]", "[KEY]"); - DeleteKeyRequest request = DeleteKeyRequest.newBuilder().setName(name.toString()).build(); - + DeleteKeyRequest request = + DeleteKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .build(); client.deleteKey(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/grpc-google-cloud-recaptchaenterprise-v1/pom.xml b/grpc-google-cloud-recaptchaenterprise-v1/pom.xml index 95af8137..4f4e791b 100644 --- a/grpc-google-cloud-recaptchaenterprise-v1/pom.xml +++ b/grpc-google-cloud-recaptchaenterprise-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-recaptchaenterprise-v1 - 1.0.7 + 1.0.8 grpc-google-cloud-recaptchaenterprise-v1 GRPC library for grpc-google-cloud-recaptchaenterprise-v1 com.google.cloud google-cloud-recaptchaenterprise-parent - 1.0.7 + 1.0.8 diff --git a/grpc-google-cloud-recaptchaenterprise-v1beta1/pom.xml b/grpc-google-cloud-recaptchaenterprise-v1beta1/pom.xml index 20dd05e4..19ec0eba 100644 --- a/grpc-google-cloud-recaptchaenterprise-v1beta1/pom.xml +++ b/grpc-google-cloud-recaptchaenterprise-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-recaptchaenterprise-v1beta1 - 0.32.7 + 0.32.8 grpc-google-cloud-recaptchaenterprise-v1beta1 GRPC library for grpc-google-cloud-recaptchaenterprise-v1beta1 com.google.cloud google-cloud-recaptchaenterprise-parent - 1.0.7 + 1.0.8 diff --git a/pom.xml b/pom.xml index 792f0e7b..64db5bb3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-recaptchaenterprise-parent pom - 1.0.7 + 1.0.8 reCAPTCHA Enterprise Parent https://github.com/googleapis/java-recaptchaenterprise @@ -70,33 +70,33 @@ com.google.api.grpc proto-google-cloud-recaptchaenterprise-v1 - 1.0.7 + 1.0.8 com.google.api.grpc proto-google-cloud-recaptchaenterprise-v1beta1 - 0.32.7 + 0.32.8 com.google.api.grpc grpc-google-cloud-recaptchaenterprise-v1 - 1.0.7 + 1.0.8 com.google.api.grpc grpc-google-cloud-recaptchaenterprise-v1beta1 - 0.32.7 + 0.32.8 com.google.cloud google-cloud-recaptchaenterprise - 1.0.7 + 1.0.8 com.google.cloud google-cloud-shared-dependencies - 0.16.0 + 0.16.1 pom import diff --git a/proto-google-cloud-recaptchaenterprise-v1/pom.xml b/proto-google-cloud-recaptchaenterprise-v1/pom.xml index 57464827..4d6c0c67 100644 --- a/proto-google-cloud-recaptchaenterprise-v1/pom.xml +++ b/proto-google-cloud-recaptchaenterprise-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-recaptchaenterprise-v1 - 1.0.7 + 1.0.8 proto-google-cloud-recaptchaenterprise-v1 PROTO library for proto-google-cloud-recaptchaenterprise-v1 com.google.cloud google-cloud-recaptchaenterprise-parent - 1.0.7 + 1.0.8 diff --git a/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/AssessmentName.java b/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/AssessmentName.java index 66754794..829fbf3e 100644 --- a/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/AssessmentName.java +++ b/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/AssessmentName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class AssessmentName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_ASSESSMENT = PathTemplate.createWithoutUrlEncoding("projects/{project}/assessments/{assessment}"); - private volatile Map fieldValuesMap; - private final String project; private final String assessment; + @Deprecated + protected AssessmentName() { + project = null; + assessment = null; + } + + private AssessmentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + assessment = Preconditions.checkNotNull(builder.getAssessment()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private AssessmentName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - assessment = Preconditions.checkNotNull(builder.getAssessment()); - } - public static AssessmentName of(String project, String assessment) { return newBuilder().setProject(project).setAssessment(assessment).build(); } @@ -70,7 +75,7 @@ public static AssessmentName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_ASSESSMENT.validatedMatch( formattedString, "AssessmentName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("assessment")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (AssessmentName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_ASSESSMENT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("assessment", assessment); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (assessment != null) { + fieldMapBuilder.put("assessment", assessment); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "assessment", assessment); + return PROJECT_ASSESSMENT.instantiate("project", project, "assessment", assessment); } - /** Builder for AssessmentName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + AssessmentName that = ((AssessmentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.assessment, that.assessment); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(assessment); + return h; + } + + /** Builder for projects/{project}/assessments/{assessment}. */ + public static class Builder { private String project; private String assessment; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setAssessment(String assessment) { return this; } - private Builder() {} - private Builder(AssessmentName assessmentName) { project = assessmentName.project; assessment = assessmentName.assessment; @@ -157,26 +189,4 @@ public AssessmentName build() { return new AssessmentName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof AssessmentName) { - AssessmentName that = (AssessmentName) o; - return (this.project.equals(that.project)) && (this.assessment.equals(that.assessment)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= assessment.hashCode(); - return h; - } } diff --git a/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/KeyName.java b/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/KeyName.java index 74a1c938..3ee899d4 100644 --- a/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/KeyName.java +++ b/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/KeyName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class KeyName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_KEY = PathTemplate.createWithoutUrlEncoding("projects/{project}/keys/{key}"); - private volatile Map fieldValuesMap; - private final String project; private final String key; + @Deprecated + protected KeyName() { + project = null; + key = null; + } + + private KeyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + key = Preconditions.checkNotNull(builder.getKey()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private KeyName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - key = Preconditions.checkNotNull(builder.getKey()); - } - public static KeyName of(String project, String key) { return newBuilder().setProject(project).setKey(key).build(); } @@ -70,7 +75,7 @@ public static KeyName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_KEY.validatedMatch( formattedString, "KeyName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("key")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (KeyName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_KEY.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("key", key); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (key != null) { + fieldMapBuilder.put("key", key); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,38 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "key", key); + return PROJECT_KEY.instantiate("project", project, "key", key); } - /** Builder for KeyName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + KeyName that = ((KeyName) o); + return Objects.equals(this.project, that.project) && Objects.equals(this.key, that.key); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(key); + return h; + } + + /** Builder for projects/{project}/keys/{key}. */ + public static class Builder { private String project; private String key; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +179,6 @@ public Builder setKey(String key) { return this; } - private Builder() {} - private Builder(KeyName keyName) { project = keyName.project; key = keyName.key; @@ -157,26 +188,4 @@ public KeyName build() { return new KeyName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof KeyName) { - KeyName that = (KeyName) o; - return (this.project.equals(that.project)) && (this.key.equals(that.key)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= key.hashCode(); - return h; - } } diff --git a/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/ProjectName.java b/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/ProjectName.java index 39028cc8..aca83b05 100644 --- a/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/ProjectName.java +++ b/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/ProjectName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,18 +23,26 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ProjectName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT = PathTemplate.createWithoutUrlEncoding("projects/{project}"); - private volatile Map fieldValuesMap; - private final String project; + @Deprecated + protected ProjectName() { + project = null; + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + public String getProject() { return project; } @@ -47,10 +55,6 @@ public Builder toBuilder() { return new Builder(this); } - private ProjectName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - } - public static ProjectName of(String project) { return newBuilder().setProject(project).build(); } @@ -64,7 +68,7 @@ public static ProjectName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT.validatedMatch( formattedString, "ProjectName.parse: formattedString not in valid format"); return of(matchMap.get("project")); } @@ -78,7 +82,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ProjectName value : values) { if (value == null) { list.add(""); @@ -90,15 +94,18 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); + if (project != null) { + fieldMapBuilder.put("project", project); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -112,14 +119,35 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project); + return PROJECT.instantiate("project", project); } - /** Builder for ProjectName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ProjectName that = ((ProjectName) o); + return Objects.equals(this.project, that.project); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + return h; + } + + /** Builder for projects/{project}. */ + public static class Builder { private String project; + protected Builder() {} + public String getProject() { return project; } @@ -129,8 +157,6 @@ public Builder setProject(String project) { return this; } - private Builder() {} - private Builder(ProjectName projectName) { project = projectName.project; } @@ -139,24 +165,4 @@ public ProjectName build() { return new ProjectName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ProjectName) { - ProjectName that = (ProjectName) o; - return (this.project.equals(that.project)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - return h; - } } diff --git a/proto-google-cloud-recaptchaenterprise-v1beta1/pom.xml b/proto-google-cloud-recaptchaenterprise-v1beta1/pom.xml index 08dab337..6a9cc4ca 100644 --- a/proto-google-cloud-recaptchaenterprise-v1beta1/pom.xml +++ b/proto-google-cloud-recaptchaenterprise-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-recaptchaenterprise-v1beta1 - 0.32.7 + 0.32.8 proto-google-cloud-recaptchaenterprise-v1beta1 PROTO library for proto-google-cloud-recaptchaenterprise-v1beta1 com.google.cloud google-cloud-recaptchaenterprise-parent - 1.0.7 + 1.0.8 diff --git a/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/AssessmentName.java b/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/AssessmentName.java index f78f99f4..53c8156c 100644 --- a/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/AssessmentName.java +++ b/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/AssessmentName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class AssessmentName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_ASSESSMENT = PathTemplate.createWithoutUrlEncoding("projects/{project}/assessments/{assessment}"); - private volatile Map fieldValuesMap; - private final String project; private final String assessment; + @Deprecated + protected AssessmentName() { + project = null; + assessment = null; + } + + private AssessmentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + assessment = Preconditions.checkNotNull(builder.getAssessment()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private AssessmentName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - assessment = Preconditions.checkNotNull(builder.getAssessment()); - } - public static AssessmentName of(String project, String assessment) { return newBuilder().setProject(project).setAssessment(assessment).build(); } @@ -70,7 +75,7 @@ public static AssessmentName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_ASSESSMENT.validatedMatch( formattedString, "AssessmentName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("assessment")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (AssessmentName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_ASSESSMENT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("assessment", assessment); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (assessment != null) { + fieldMapBuilder.put("assessment", assessment); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "assessment", assessment); + return PROJECT_ASSESSMENT.instantiate("project", project, "assessment", assessment); } - /** Builder for AssessmentName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + AssessmentName that = ((AssessmentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.assessment, that.assessment); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(assessment); + return h; + } + + /** Builder for projects/{project}/assessments/{assessment}. */ + public static class Builder { private String project; private String assessment; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setAssessment(String assessment) { return this; } - private Builder() {} - private Builder(AssessmentName assessmentName) { project = assessmentName.project; assessment = assessmentName.assessment; @@ -157,26 +189,4 @@ public AssessmentName build() { return new AssessmentName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof AssessmentName) { - AssessmentName that = (AssessmentName) o; - return (this.project.equals(that.project)) && (this.assessment.equals(that.assessment)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= assessment.hashCode(); - return h; - } } diff --git a/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/KeyName.java b/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/KeyName.java index 0ea8d2e3..a1023d5d 100644 --- a/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/KeyName.java +++ b/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/KeyName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class KeyName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_KEY = PathTemplate.createWithoutUrlEncoding("projects/{project}/keys/{key}"); - private volatile Map fieldValuesMap; - private final String project; private final String key; + @Deprecated + protected KeyName() { + project = null; + key = null; + } + + private KeyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + key = Preconditions.checkNotNull(builder.getKey()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private KeyName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - key = Preconditions.checkNotNull(builder.getKey()); - } - public static KeyName of(String project, String key) { return newBuilder().setProject(project).setKey(key).build(); } @@ -70,7 +75,7 @@ public static KeyName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_KEY.validatedMatch( formattedString, "KeyName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("key")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (KeyName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_KEY.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("key", key); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (key != null) { + fieldMapBuilder.put("key", key); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,38 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "key", key); + return PROJECT_KEY.instantiate("project", project, "key", key); } - /** Builder for KeyName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + KeyName that = ((KeyName) o); + return Objects.equals(this.project, that.project) && Objects.equals(this.key, that.key); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(key); + return h; + } + + /** Builder for projects/{project}/keys/{key}. */ + public static class Builder { private String project; private String key; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +179,6 @@ public Builder setKey(String key) { return this; } - private Builder() {} - private Builder(KeyName keyName) { project = keyName.project; key = keyName.key; @@ -157,26 +188,4 @@ public KeyName build() { return new KeyName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof KeyName) { - KeyName that = (KeyName) o; - return (this.project.equals(that.project)) && (this.key.equals(that.key)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= key.hashCode(); - return h; - } } diff --git a/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/ProjectName.java b/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/ProjectName.java index 1afcea16..edd75922 100644 --- a/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/ProjectName.java +++ b/proto-google-cloud-recaptchaenterprise-v1beta1/src/main/java/com/google/recaptchaenterprise/v1beta1/ProjectName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,18 +23,26 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ProjectName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT = PathTemplate.createWithoutUrlEncoding("projects/{project}"); - private volatile Map fieldValuesMap; - private final String project; + @Deprecated + protected ProjectName() { + project = null; + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + public String getProject() { return project; } @@ -47,10 +55,6 @@ public Builder toBuilder() { return new Builder(this); } - private ProjectName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - } - public static ProjectName of(String project) { return newBuilder().setProject(project).build(); } @@ -64,7 +68,7 @@ public static ProjectName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT.validatedMatch( formattedString, "ProjectName.parse: formattedString not in valid format"); return of(matchMap.get("project")); } @@ -78,7 +82,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ProjectName value : values) { if (value == null) { list.add(""); @@ -90,15 +94,18 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); + if (project != null) { + fieldMapBuilder.put("project", project); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -112,14 +119,35 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project); + return PROJECT.instantiate("project", project); } - /** Builder for ProjectName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ProjectName that = ((ProjectName) o); + return Objects.equals(this.project, that.project); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + return h; + } + + /** Builder for projects/{project}. */ + public static class Builder { private String project; + protected Builder() {} + public String getProject() { return project; } @@ -129,8 +157,6 @@ public Builder setProject(String project) { return this; } - private Builder() {} - private Builder(ProjectName projectName) { project = projectName.project; } @@ -139,24 +165,4 @@ public ProjectName build() { return new ProjectName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ProjectName) { - ProjectName that = (ProjectName) o; - return (this.project.equals(that.project)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - return h; - } } diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index bea560af..a795c18e 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-recaptchaenterprise - 1.0.6 + 1.0.7 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index df20a1a3..01c21000 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-recaptchaenterprise - 1.0.7 + 1.0.8 diff --git a/synth.metadata b/synth.metadata index f48aa506..d8abdc5d 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,30 +4,30 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-recaptchaenterprise.git", - "sha": "8bd67ac8f6c28bb04e8da1a2717f22403262e607" + "sha": "8c09506a30cb11f98dd913b85893ed7eee8ce9b6" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "cbaf1b693943a074ce21797682bcc3ca75b3e7c5", - "internalRef": "316023196" + "sha": "857f70daef9f4c38f042fb3dfb7b8423ae18fd19", + "internalRef": "346372957" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "cbaf1b693943a074ce21797682bcc3ca75b3e7c5", - "internalRef": "316023196" + "sha": "857f70daef9f4c38f042fb3dfb7b8423ae18fd19", + "internalRef": "346372957" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "943bb78606d035001123030067dffcc34f4645f2" + "sha": "5d11bd2888c38ce1fb6fa6bf25494a4219a73928" } } ], diff --git a/versions.txt b/versions.txt index acc3f7a1..00557324 100644 --- a/versions.txt +++ b/versions.txt @@ -1,8 +1,8 @@ # Format: # module:released-version:current-version -proto-google-cloud-recaptchaenterprise-v1:1.0.7:1.0.7 -proto-google-cloud-recaptchaenterprise-v1beta1:0.32.7:0.32.7 -grpc-google-cloud-recaptchaenterprise-v1:1.0.7:1.0.7 -grpc-google-cloud-recaptchaenterprise-v1beta1:0.32.7:0.32.7 -google-cloud-recaptchaenterprise:1.0.7:1.0.7 \ No newline at end of file +proto-google-cloud-recaptchaenterprise-v1:1.0.8:1.0.8 +proto-google-cloud-recaptchaenterprise-v1beta1:0.32.8:0.32.8 +grpc-google-cloud-recaptchaenterprise-v1:1.0.8:1.0.8 +grpc-google-cloud-recaptchaenterprise-v1beta1:0.32.8:0.32.8 +google-cloud-recaptchaenterprise:1.0.8:1.0.8 \ No newline at end of file