From bb2c0aeeac132ab5ea86a0e688149d5113fed22d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 21 Jun 2022 16:24:11 +0000 Subject: [PATCH] fix!: set the right field number for reCAPTCHA private password leak (#819) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 455215317 Source-Link: https://github.com/googleapis/googleapis/commit/ec8056e2674fd307b889a0b587a83ae033e0db62 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8084ad71ff90f4af666052e46bb955b8e555d4bf Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODA4NGFkNzFmZjkwZjRhZjY2NjA1MmU0NmJiOTU1YjhlNTU1ZDRiZiJ9 --- .../recaptchaenterprise/v1/Assessment.java | 32 ++++----- .../v1/AssessmentOrBuilder.java | 6 +- .../v1/RecaptchaEnterpriseProto.java | 2 +- .../v1/recaptchaenterprise.proto | 2 +- .../AsyncAnnotateAssessment.java | 53 +++++++++++++++ .../SyncAnnotateAssessment.java | 49 +++++++++++++ ...meAnnotateassessmentrequestannotation.java | 47 +++++++++++++ ...ngAnnotateassessmentrequestannotation.java | 47 +++++++++++++ .../SyncCreateSetCredentialsProvider.java | 44 ++++++++++++ .../create/SyncCreateSetEndpoint.java | 39 +++++++++++ .../AsyncCreateAssessment.java | 49 +++++++++++++ .../SyncCreateAssessment.java | 45 ++++++++++++ ...CreateAssessmentProjectnameAssessment.java | 43 ++++++++++++ .../SyncCreateAssessmentStringAssessment.java | 43 ++++++++++++ .../createkey/AsyncCreateKey.java | 49 +++++++++++++ .../createkey/SyncCreateKey.java | 45 ++++++++++++ .../deletekey/AsyncDeleteKey.java | 48 +++++++++++++ .../deletekey/SyncDeleteKey.java | 43 ++++++++++++ .../getkey/AsyncGetKey.java | 45 ++++++++++++ .../getkey/SyncGetKey.java | 42 ++++++++++++ .../getmetrics/AsyncGetMetrics.java | 48 +++++++++++++ .../getmetrics/SyncGetMetrics.java | 44 ++++++++++++ .../getmetrics/SyncGetMetricsMetricsname.java | 42 ++++++++++++ .../getmetrics/SyncGetMetricsString.java | 40 +++++++++++ .../listkeys/AsyncListKeys.java | 52 ++++++++++++++ .../listkeys/AsyncListKeysPaged.java | 60 ++++++++++++++++ .../listkeys/SyncListKeys.java | 48 +++++++++++++ ...yncListRelatedAccountGroupMemberships.java | 57 ++++++++++++++++ ...stRelatedAccountGroupMembershipsPaged.java | 66 ++++++++++++++++++ ...yncListRelatedAccountGroupMemberships.java | 54 +++++++++++++++ ...oupMembershipsRelatedaccountgroupname.java | 49 +++++++++++++ ...tRelatedAccountGroupMembershipsString.java | 47 +++++++++++++ .../AsyncListRelatedAccountGroups.java | 56 +++++++++++++++ .../AsyncListRelatedAccountGroupsPaged.java | 62 +++++++++++++++++ .../SyncListRelatedAccountGroups.java | 51 ++++++++++++++ ...ncListRelatedAccountGroupsProjectname.java | 45 ++++++++++++ .../SyncListRelatedAccountGroupsString.java | 45 ++++++++++++ .../migratekey/AsyncMigrateKey.java | 48 +++++++++++++ .../migratekey/SyncMigrateKey.java | 44 ++++++++++++ ...cSearchRelatedAccountGroupMemberships.java | 59 ++++++++++++++++ ...chRelatedAccountGroupMembershipsPaged.java | 68 +++++++++++++++++++ ...cSearchRelatedAccountGroupMemberships.java | 56 +++++++++++++++ ...hipsRelatedaccountgroupnameBytestring.java | 51 ++++++++++++++ ...countGroupMembershipsStringBytestring.java | 49 +++++++++++++ .../updatekey/AsyncUpdateKey.java | 49 +++++++++++++ .../updatekey/SyncUpdateKey.java | 45 ++++++++++++ .../SyncCreateAssessment.java | 47 +++++++++++++ .../SyncCreateAssessment.java | 49 +++++++++++++ .../AsyncAnnotateAssessment.java | 54 +++++++++++++++ .../SyncAnnotateAssessment.java | 51 ++++++++++++++ ...meAnnotateassessmentrequestannotation.java | 47 +++++++++++++ ...ngAnnotateassessmentrequestannotation.java | 47 +++++++++++++ .../SyncCreateSetCredentialsProvider.java | 44 ++++++++++++ .../create/SyncCreateSetEndpoint.java | 41 +++++++++++ .../AsyncCreateAssessment.java | 51 ++++++++++++++ .../SyncCreateAssessment.java | 47 +++++++++++++ ...CreateAssessmentProjectnameAssessment.java | 44 ++++++++++++ .../SyncCreateAssessmentStringAssessment.java | 44 ++++++++++++ .../SyncCreateAssessment.java | 50 ++++++++++++++ .../SyncCreateAssessment.java | 50 ++++++++++++++ 60 files changed, 2753 insertions(+), 21 deletions(-) create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/AsyncAnnotateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/AsyncCreateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessmentProjectnameAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessmentStringAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createkey/AsyncCreateKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createkey/SyncCreateKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/deletekey/AsyncDeleteKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/deletekey/SyncDeleteKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getkey/AsyncGetKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getkey/SyncGetKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/AsyncGetMetrics.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetrics.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetricsMetricsname.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetricsString.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/AsyncListKeys.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/AsyncListKeysPaged.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/SyncListKeys.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/AsyncListRelatedAccountGroupMemberships.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/AsyncListRelatedAccountGroupMembershipsPaged.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMemberships.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMembershipsRelatedaccountgroupname.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMembershipsString.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/AsyncListRelatedAccountGroups.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/AsyncListRelatedAccountGroupsPaged.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroups.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroupsProjectname.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroupsString.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/migratekey/AsyncMigrateKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/migratekey/SyncMigrateKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/AsyncSearchRelatedAccountGroupMemberships.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/AsyncSearchRelatedAccountGroupMembershipsPaged.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMemberships.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMembershipsRelatedaccountgroupnameBytestring.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMembershipsStringBytestring.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/updatekey/AsyncUpdateKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/updatekey/SyncUpdateKey.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseservicesettings/createassessment/SyncCreateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/stub/recaptchaenterpriseservicestubsettings/createassessment/SyncCreateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/AsyncAnnotateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/create/SyncCreateSetEndpoint.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/AsyncCreateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessmentProjectnameAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessmentStringAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1settings/createassessment/SyncCreateAssessment.java create mode 100644 java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/stub/recaptchaenterpriseservicev1beta1stubsettings/createassessment/SyncCreateAssessment.java diff --git a/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/Assessment.java b/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/Assessment.java index 013adeaa7488..6b129069209f 100644 --- a/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/Assessment.java +++ b/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/Assessment.java @@ -143,7 +143,7 @@ private Assessment( break; } - case 58: + case 66: { com.google.recaptchaenterprise.v1.PrivatePasswordLeakVerification.Builder subBuilder = null; @@ -461,7 +461,7 @@ public boolean hasAccountDefenderAssessment() { return getAccountDefenderAssessment(); } - public static final int PRIVATE_PASSWORD_LEAK_VERIFICATION_FIELD_NUMBER = 7; + public static final int PRIVATE_PASSWORD_LEAK_VERIFICATION_FIELD_NUMBER = 8; private com.google.recaptchaenterprise.v1.PrivatePasswordLeakVerification privatePasswordLeakVerification_; /** @@ -472,7 +472,7 @@ public boolean hasAccountDefenderAssessment() { * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * * * @return Whether the privatePasswordLeakVerification field is set. @@ -489,7 +489,7 @@ public boolean hasPrivatePasswordLeakVerification() { * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * * * @return The privatePasswordLeakVerification. @@ -509,7 +509,7 @@ public boolean hasPrivatePasswordLeakVerification() { * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * */ @java.lang.Override @@ -548,7 +548,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io output.writeMessage(6, getAccountDefenderAssessment()); } if (privatePasswordLeakVerification_ != null) { - output.writeMessage(7, getPrivatePasswordLeakVerification()); + output.writeMessage(8, getPrivatePasswordLeakVerification()); } unknownFields.writeTo(output); } @@ -579,7 +579,7 @@ public int getSerializedSize() { if (privatePasswordLeakVerification_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize( - 7, getPrivatePasswordLeakVerification()); + 8, getPrivatePasswordLeakVerification()); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -1920,7 +1920,7 @@ public Builder clearAccountDefenderAssessment() { * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * * * @return Whether the privatePasswordLeakVerification field is set. @@ -1937,7 +1937,7 @@ public boolean hasPrivatePasswordLeakVerification() { * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * * * @return The privatePasswordLeakVerification. @@ -1960,7 +1960,7 @@ public boolean hasPrivatePasswordLeakVerification() { * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * */ public Builder setPrivatePasswordLeakVerification( @@ -1985,7 +1985,7 @@ public Builder setPrivatePasswordLeakVerification( * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * */ public Builder setPrivatePasswordLeakVerification( @@ -2007,7 +2007,7 @@ public Builder setPrivatePasswordLeakVerification( * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * */ public Builder mergePrivatePasswordLeakVerification( @@ -2037,7 +2037,7 @@ public Builder mergePrivatePasswordLeakVerification( * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * */ public Builder clearPrivatePasswordLeakVerification() { @@ -2059,7 +2059,7 @@ public Builder clearPrivatePasswordLeakVerification() { * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * */ public com.google.recaptchaenterprise.v1.PrivatePasswordLeakVerification.Builder @@ -2076,7 +2076,7 @@ public Builder clearPrivatePasswordLeakVerification() { * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * */ public com.google.recaptchaenterprise.v1.PrivatePasswordLeakVerificationOrBuilder @@ -2097,7 +2097,7 @@ public Builder clearPrivatePasswordLeakVerification() { * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * */ private com.google.protobuf.SingleFieldBuilderV3< diff --git a/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/AssessmentOrBuilder.java b/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/AssessmentOrBuilder.java index 142d837f4cca..2bdaa9699a2d 100644 --- a/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/AssessmentOrBuilder.java +++ b/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/AssessmentOrBuilder.java @@ -220,7 +220,7 @@ public interface AssessmentOrBuilder * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * * * @return Whether the privatePasswordLeakVerification field is set. @@ -234,7 +234,7 @@ public interface AssessmentOrBuilder * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * * * @return The privatePasswordLeakVerification. @@ -249,7 +249,7 @@ public interface AssessmentOrBuilder * * * - * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 7; + * .google.cloud.recaptchaenterprise.v1.PrivatePasswordLeakVerification private_password_leak_verification = 8; * */ com.google.recaptchaenterprise.v1.PrivatePasswordLeakVerificationOrBuilder diff --git a/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/RecaptchaEnterpriseProto.java b/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/RecaptchaEnterpriseProto.java index c9cf4b6bb07d..171baed0b909 100644 --- a/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/RecaptchaEnterpriseProto.java +++ b/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/java/com/google/recaptchaenterprise/v1/RecaptchaEnterpriseProto.java @@ -228,7 +228,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "_assessment\030\006 \001(\0132>.google.cloud.recaptc" + "haenterprise.v1.AccountDefenderAssessmen" + "t\022p\n\"private_password_leak_verification\030" - + "\007 \001(\0132D.google.cloud.recaptchaenterprise" + + "\010 \001(\0132D.google.cloud.recaptchaenterprise" + ".v1.PrivatePasswordLeakVerification:_\352A\\" + "\n-recaptchaenterprise.googleapis.com/Ass" + "essment\022+projects/{project}/assessments/" diff --git a/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/proto/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto b/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/proto/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto index 0169ebbd3827..7165d1bcc007 100644 --- a/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/proto/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto +++ b/java-recaptchaenterprise/proto-google-cloud-recaptchaenterprise-v1/src/main/proto/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto @@ -287,7 +287,7 @@ message Assessment { AccountDefenderAssessment account_defender_assessment = 6; // Password leak verification info. - PrivatePasswordLeakVerification private_password_leak_verification = 7; + PrivatePasswordLeakVerification private_password_leak_verification = 8; } message Event { diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/AsyncAnnotateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/AsyncAnnotateAssessment.java new file mode 100644 index 000000000000..40c536780f4d --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/AsyncAnnotateAssessment.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_annotateassessment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.protobuf.ByteString; +import com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest; +import com.google.recaptchaenterprise.v1.AnnotateAssessmentResponse; +import com.google.recaptchaenterprise.v1.AssessmentName; +import java.util.ArrayList; + +public class AsyncAnnotateAssessment { + + public static void main(String[] args) throws Exception { + asyncAnnotateAssessment(); + } + + public static void asyncAnnotateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + AnnotateAssessmentRequest request = + AnnotateAssessmentRequest.newBuilder() + .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString()) + .addAllReasons(new ArrayList()) + .setHashedAccountId(ByteString.EMPTY) + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient.annotateAssessmentCallable().futureCall(request); + // Do something. + AnnotateAssessmentResponse response = future.get(); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_annotateassessment_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessment.java new file mode 100644 index 000000000000..4f210537e27f --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessment.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_annotateassessment_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.protobuf.ByteString; +import com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest; +import com.google.recaptchaenterprise.v1.AnnotateAssessmentResponse; +import com.google.recaptchaenterprise.v1.AssessmentName; +import java.util.ArrayList; + +public class SyncAnnotateAssessment { + + public static void main(String[] args) throws Exception { + syncAnnotateAssessment(); + } + + public static void syncAnnotateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + AnnotateAssessmentRequest request = + AnnotateAssessmentRequest.newBuilder() + .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString()) + .addAllReasons(new ArrayList()) + .setHashedAccountId(ByteString.EMPTY) + .build(); + AnnotateAssessmentResponse response = + recaptchaEnterpriseServiceClient.annotateAssessment(request); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_annotateassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation.java new file mode 100644 index 000000000000..416d6e8909a2 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_annotateassessment_assessmentnameannotateassessmentrequestannotation_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest; +import com.google.recaptchaenterprise.v1.AnnotateAssessmentResponse; +import com.google.recaptchaenterprise.v1.AssessmentName; + +public class SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation { + + public static void main(String[] args) throws Exception { + syncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation(); + } + + public static void syncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]"); + AnnotateAssessmentRequest.Annotation annotation = + AnnotateAssessmentRequest.Annotation.forNumber(0); + AnnotateAssessmentResponse response = + recaptchaEnterpriseServiceClient.annotateAssessment(name, annotation); + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_annotateassessment_assessmentnameannotateassessmentrequestannotation_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation.java new file mode 100644 index 000000000000..709c8c446061 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/annotateassessment/SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_annotateassessment_stringannotateassessmentrequestannotation_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.AnnotateAssessmentRequest; +import com.google.recaptchaenterprise.v1.AnnotateAssessmentResponse; +import com.google.recaptchaenterprise.v1.AssessmentName; + +public class SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation { + + public static void main(String[] args) throws Exception { + syncAnnotateAssessmentStringAnnotateassessmentrequestannotation(); + } + + public static void syncAnnotateAssessmentStringAnnotateassessmentrequestannotation() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + String name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString(); + AnnotateAssessmentRequest.Annotation annotation = + AnnotateAssessmentRequest.Annotation.forNumber(0); + AnnotateAssessmentResponse response = + recaptchaEnterpriseServiceClient.annotateAssessment(name, annotation); + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_annotateassessment_stringannotateassessmentrequestannotation_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/create/SyncCreateSetCredentialsProvider.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..13686088ceed --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceSettings; +import com.google.cloud.recaptchaenterprise.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings = + RecaptchaEnterpriseServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create(recaptchaEnterpriseServiceSettings); + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_create_setcredentialsprovider_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/create/SyncCreateSetEndpoint.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..95176cb73ccc --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_create_setendpoint_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceSettings; +import com.google.cloud.recaptchaenterprise.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings = + RecaptchaEnterpriseServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create(recaptchaEnterpriseServiceSettings); + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_create_setendpoint_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/AsyncCreateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/AsyncCreateAssessment.java new file mode 100644 index 000000000000..00c7a18c0cd4 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/AsyncCreateAssessment.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createassessment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Assessment; +import com.google.recaptchaenterprise.v1.CreateAssessmentRequest; +import com.google.recaptchaenterprise.v1.ProjectName; + +public class AsyncCreateAssessment { + + public static void main(String[] args) throws Exception { + asyncCreateAssessment(); + } + + public static void asyncCreateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + CreateAssessmentRequest request = + CreateAssessmentRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setAssessment(Assessment.newBuilder().build()) + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient.createAssessmentCallable().futureCall(request); + // Do something. + Assessment response = future.get(); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createassessment_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessment.java new file mode 100644 index 000000000000..0500ad09646a --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessment.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createassessment_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Assessment; +import com.google.recaptchaenterprise.v1.CreateAssessmentRequest; +import com.google.recaptchaenterprise.v1.ProjectName; + +public class SyncCreateAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessment(); + } + + public static void syncCreateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + CreateAssessmentRequest request = + CreateAssessmentRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setAssessment(Assessment.newBuilder().build()) + .build(); + Assessment response = recaptchaEnterpriseServiceClient.createAssessment(request); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessmentProjectnameAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessmentProjectnameAssessment.java new file mode 100644 index 000000000000..4fc36f4b29ec --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessmentProjectnameAssessment.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createassessment_projectnameassessment_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Assessment; +import com.google.recaptchaenterprise.v1.ProjectName; + +public class SyncCreateAssessmentProjectnameAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessmentProjectnameAssessment(); + } + + public static void syncCreateAssessmentProjectnameAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + Assessment assessment = Assessment.newBuilder().build(); + Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment); + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createassessment_projectnameassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessmentStringAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessmentStringAssessment.java new file mode 100644 index 000000000000..38cf51c613e0 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createassessment/SyncCreateAssessmentStringAssessment.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createassessment_stringassessment_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Assessment; +import com.google.recaptchaenterprise.v1.ProjectName; + +public class SyncCreateAssessmentStringAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessmentStringAssessment(); + } + + public static void syncCreateAssessmentStringAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + Assessment assessment = Assessment.newBuilder().build(); + Assessment response = recaptchaEnterpriseServiceClient.createAssessment(parent, assessment); + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createassessment_stringassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createkey/AsyncCreateKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createkey/AsyncCreateKey.java new file mode 100644 index 000000000000..8cfd10bd37bc --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createkey/AsyncCreateKey.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createkey_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.CreateKeyRequest; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.ProjectName; + +public class AsyncCreateKey { + + public static void main(String[] args) throws Exception { + asyncCreateKey(); + } + + public static void asyncCreateKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + CreateKeyRequest request = + CreateKeyRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setKey(Key.newBuilder().build()) + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient.createKeyCallable().futureCall(request); + // Do something. + Key response = future.get(); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createkey_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createkey/SyncCreateKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createkey/SyncCreateKey.java new file mode 100644 index 000000000000..f8d73e1acddd --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/createkey/SyncCreateKey.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createkey_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.CreateKeyRequest; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.ProjectName; + +public class SyncCreateKey { + + public static void main(String[] args) throws Exception { + syncCreateKey(); + } + + public static void syncCreateKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + CreateKeyRequest request = + CreateKeyRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setKey(Key.newBuilder().build()) + .build(); + Key response = recaptchaEnterpriseServiceClient.createKey(request); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_createkey_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/deletekey/AsyncDeleteKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/deletekey/AsyncDeleteKey.java new file mode 100644 index 000000000000..21a7dde05f73 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/deletekey/AsyncDeleteKey.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_deletekey_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.protobuf.Empty; +import com.google.recaptchaenterprise.v1.DeleteKeyRequest; +import com.google.recaptchaenterprise.v1.KeyName; + +public class AsyncDeleteKey { + + public static void main(String[] args) throws Exception { + asyncDeleteKey(); + } + + public static void asyncDeleteKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + DeleteKeyRequest request = + DeleteKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient.deleteKeyCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_deletekey_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/deletekey/SyncDeleteKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/deletekey/SyncDeleteKey.java new file mode 100644 index 000000000000..71e31067ef7f --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/deletekey/SyncDeleteKey.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_deletekey_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.DeleteKeyRequest; +import com.google.recaptchaenterprise.v1.KeyName; + +public class SyncDeleteKey { + + public static void main(String[] args) throws Exception { + syncDeleteKey(); + } + + public static void syncDeleteKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + DeleteKeyRequest request = + DeleteKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .build(); + recaptchaEnterpriseServiceClient.deleteKey(request); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_deletekey_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getkey/AsyncGetKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getkey/AsyncGetKey.java new file mode 100644 index 000000000000..efae28facb92 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getkey/AsyncGetKey.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getkey_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.GetKeyRequest; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.KeyName; + +public class AsyncGetKey { + + public static void main(String[] args) throws Exception { + asyncGetKey(); + } + + public static void asyncGetKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + GetKeyRequest request = + GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build(); + ApiFuture future = recaptchaEnterpriseServiceClient.getKeyCallable().futureCall(request); + // Do something. + Key response = future.get(); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getkey_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getkey/SyncGetKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getkey/SyncGetKey.java new file mode 100644 index 000000000000..5d5cefa65c35 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getkey/SyncGetKey.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getkey_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.GetKeyRequest; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.KeyName; + +public class SyncGetKey { + + public static void main(String[] args) throws Exception { + syncGetKey(); + } + + public static void syncGetKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + GetKeyRequest request = + GetKeyRequest.newBuilder().setName(KeyName.of("[PROJECT]", "[KEY]").toString()).build(); + Key response = recaptchaEnterpriseServiceClient.getKey(request); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getkey_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/AsyncGetMetrics.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/AsyncGetMetrics.java new file mode 100644 index 000000000000..906ba48b0736 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/AsyncGetMetrics.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getmetrics_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.GetMetricsRequest; +import com.google.recaptchaenterprise.v1.Metrics; +import com.google.recaptchaenterprise.v1.MetricsName; + +public class AsyncGetMetrics { + + public static void main(String[] args) throws Exception { + asyncGetMetrics(); + } + + public static void asyncGetMetrics() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + GetMetricsRequest request = + GetMetricsRequest.newBuilder() + .setName(MetricsName.of("[PROJECT]", "[KEY]").toString()) + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient.getMetricsCallable().futureCall(request); + // Do something. + Metrics response = future.get(); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getmetrics_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetrics.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetrics.java new file mode 100644 index 000000000000..3f8a596c1007 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetrics.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getmetrics_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.GetMetricsRequest; +import com.google.recaptchaenterprise.v1.Metrics; +import com.google.recaptchaenterprise.v1.MetricsName; + +public class SyncGetMetrics { + + public static void main(String[] args) throws Exception { + syncGetMetrics(); + } + + public static void syncGetMetrics() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + GetMetricsRequest request = + GetMetricsRequest.newBuilder() + .setName(MetricsName.of("[PROJECT]", "[KEY]").toString()) + .build(); + Metrics response = recaptchaEnterpriseServiceClient.getMetrics(request); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getmetrics_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetricsMetricsname.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetricsMetricsname.java new file mode 100644 index 000000000000..bd8248f63070 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetricsMetricsname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getmetrics_metricsname_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Metrics; +import com.google.recaptchaenterprise.v1.MetricsName; + +public class SyncGetMetricsMetricsname { + + public static void main(String[] args) throws Exception { + syncGetMetricsMetricsname(); + } + + public static void syncGetMetricsMetricsname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + MetricsName name = MetricsName.of("[PROJECT]", "[KEY]"); + Metrics response = recaptchaEnterpriseServiceClient.getMetrics(name); + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getmetrics_metricsname_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetricsString.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetricsString.java new file mode 100644 index 000000000000..a45f67fbc171 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/getmetrics/SyncGetMetricsString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getmetrics_string_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Metrics; +import com.google.recaptchaenterprise.v1.MetricsName; + +public class SyncGetMetricsString { + + public static void main(String[] args) throws Exception { + syncGetMetricsString(); + } + + public static void syncGetMetricsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + String name = MetricsName.of("[PROJECT]", "[KEY]").toString(); + Metrics response = recaptchaEnterpriseServiceClient.getMetrics(name); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_getmetrics_string_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/AsyncListKeys.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/AsyncListKeys.java new file mode 100644 index 000000000000..5bf13eb99b80 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/AsyncListKeys.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listkeys_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.ListKeysRequest; +import com.google.recaptchaenterprise.v1.ProjectName; + +public class AsyncListKeys { + + public static void main(String[] args) throws Exception { + asyncListKeys(); + } + + public static void asyncListKeys() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ListKeysRequest request = + ListKeysRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient.listKeysPagedCallable().futureCall(request); + // Do something. + for (Key element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listkeys_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/AsyncListKeysPaged.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/AsyncListKeysPaged.java new file mode 100644 index 000000000000..1dba3cecbf70 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/AsyncListKeysPaged.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listkeys_paged_async] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.common.base.Strings; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.ListKeysRequest; +import com.google.recaptchaenterprise.v1.ListKeysResponse; +import com.google.recaptchaenterprise.v1.ProjectName; + +public class AsyncListKeysPaged { + + public static void main(String[] args) throws Exception { + asyncListKeysPaged(); + } + + public static void asyncListKeysPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ListKeysRequest request = + ListKeysRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListKeysResponse response = + recaptchaEnterpriseServiceClient.listKeysCallable().call(request); + for (Key element : response.getKeysList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listkeys_paged_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/SyncListKeys.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/SyncListKeys.java new file mode 100644 index 000000000000..0a10d4f4842d --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listkeys/SyncListKeys.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listkeys_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.ListKeysRequest; +import com.google.recaptchaenterprise.v1.ProjectName; + +public class SyncListKeys { + + public static void main(String[] args) throws Exception { + syncListKeys(); + } + + public static void syncListKeys() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ListKeysRequest request = + ListKeysRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Key element : recaptchaEnterpriseServiceClient.listKeys(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listkeys_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/AsyncListRelatedAccountGroupMemberships.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/AsyncListRelatedAccountGroupMemberships.java new file mode 100644 index 000000000000..e9264c3d8ff9 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/AsyncListRelatedAccountGroupMemberships.java @@ -0,0 +1,57 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; + +public class AsyncListRelatedAccountGroupMemberships { + + public static void main(String[] args) throws Exception { + asyncListRelatedAccountGroupMemberships(); + } + + public static void asyncListRelatedAccountGroupMemberships() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ListRelatedAccountGroupMembershipsRequest request = + ListRelatedAccountGroupMembershipsRequest.newBuilder() + .setParent( + RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient + .listRelatedAccountGroupMembershipsPagedCallable() + .futureCall(request); + // Do something. + for (RelatedAccountGroupMembership element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/AsyncListRelatedAccountGroupMembershipsPaged.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/AsyncListRelatedAccountGroupMembershipsPaged.java new file mode 100644 index 000000000000..4e7bc670970b --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/AsyncListRelatedAccountGroupMembershipsPaged.java @@ -0,0 +1,66 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_paged_async] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.common.base.Strings; +import com.google.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest; +import com.google.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsResponse; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; + +public class AsyncListRelatedAccountGroupMembershipsPaged { + + public static void main(String[] args) throws Exception { + asyncListRelatedAccountGroupMembershipsPaged(); + } + + public static void asyncListRelatedAccountGroupMembershipsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ListRelatedAccountGroupMembershipsRequest request = + ListRelatedAccountGroupMembershipsRequest.newBuilder() + .setParent( + RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListRelatedAccountGroupMembershipsResponse response = + recaptchaEnterpriseServiceClient + .listRelatedAccountGroupMembershipsCallable() + .call(request); + for (RelatedAccountGroupMembership element : + response.getRelatedAccountGroupMembershipsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_paged_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMemberships.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMemberships.java new file mode 100644 index 000000000000..14ff84a48f4f --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMemberships.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.ListRelatedAccountGroupMembershipsRequest; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; + +public class SyncListRelatedAccountGroupMemberships { + + public static void main(String[] args) throws Exception { + syncListRelatedAccountGroupMemberships(); + } + + public static void syncListRelatedAccountGroupMemberships() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ListRelatedAccountGroupMembershipsRequest request = + ListRelatedAccountGroupMembershipsRequest.newBuilder() + .setParent( + RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (RelatedAccountGroupMembership element : + recaptchaEnterpriseServiceClient + .listRelatedAccountGroupMemberships(request) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMembershipsRelatedaccountgroupname.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMembershipsRelatedaccountgroupname.java new file mode 100644 index 000000000000..1b5283b16e7d --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMembershipsRelatedaccountgroupname.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_relatedaccountgroupname_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; + +public class SyncListRelatedAccountGroupMembershipsRelatedaccountgroupname { + + public static void main(String[] args) throws Exception { + syncListRelatedAccountGroupMembershipsRelatedaccountgroupname(); + } + + public static void syncListRelatedAccountGroupMembershipsRelatedaccountgroupname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + RelatedAccountGroupName parent = + RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]"); + for (RelatedAccountGroupMembership element : + recaptchaEnterpriseServiceClient + .listRelatedAccountGroupMemberships(parent) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_relatedaccountgroupname_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMembershipsString.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMembershipsString.java new file mode 100644 index 000000000000..5a78171735b6 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroupmemberships/SyncListRelatedAccountGroupMembershipsString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_string_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; + +public class SyncListRelatedAccountGroupMembershipsString { + + public static void main(String[] args) throws Exception { + syncListRelatedAccountGroupMembershipsString(); + } + + public static void syncListRelatedAccountGroupMembershipsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + String parent = RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString(); + for (RelatedAccountGroupMembership element : + recaptchaEnterpriseServiceClient + .listRelatedAccountGroupMemberships(parent) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroupmemberships_string_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/AsyncListRelatedAccountGroups.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/AsyncListRelatedAccountGroups.java new file mode 100644 index 000000000000..3de89a2dfbcb --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/AsyncListRelatedAccountGroups.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest; +import com.google.recaptchaenterprise.v1.ProjectName; +import com.google.recaptchaenterprise.v1.RelatedAccountGroup; + +public class AsyncListRelatedAccountGroups { + + public static void main(String[] args) throws Exception { + asyncListRelatedAccountGroups(); + } + + public static void asyncListRelatedAccountGroups() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ListRelatedAccountGroupsRequest request = + ListRelatedAccountGroupsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient + .listRelatedAccountGroupsPagedCallable() + .futureCall(request); + // Do something. + for (RelatedAccountGroup element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/AsyncListRelatedAccountGroupsPaged.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/AsyncListRelatedAccountGroupsPaged.java new file mode 100644 index 000000000000..4a89a77a161f --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/AsyncListRelatedAccountGroupsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_paged_async] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.common.base.Strings; +import com.google.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest; +import com.google.recaptchaenterprise.v1.ListRelatedAccountGroupsResponse; +import com.google.recaptchaenterprise.v1.ProjectName; +import com.google.recaptchaenterprise.v1.RelatedAccountGroup; + +public class AsyncListRelatedAccountGroupsPaged { + + public static void main(String[] args) throws Exception { + asyncListRelatedAccountGroupsPaged(); + } + + public static void asyncListRelatedAccountGroupsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ListRelatedAccountGroupsRequest request = + ListRelatedAccountGroupsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListRelatedAccountGroupsResponse response = + recaptchaEnterpriseServiceClient.listRelatedAccountGroupsCallable().call(request); + for (RelatedAccountGroup element : response.getRelatedAccountGroupsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_paged_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroups.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroups.java new file mode 100644 index 000000000000..27e25146c7ac --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroups.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest; +import com.google.recaptchaenterprise.v1.ProjectName; +import com.google.recaptchaenterprise.v1.RelatedAccountGroup; + +public class SyncListRelatedAccountGroups { + + public static void main(String[] args) throws Exception { + syncListRelatedAccountGroups(); + } + + public static void syncListRelatedAccountGroups() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ListRelatedAccountGroupsRequest request = + ListRelatedAccountGroupsRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (RelatedAccountGroup element : + recaptchaEnterpriseServiceClient.listRelatedAccountGroups(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroupsProjectname.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroupsProjectname.java new file mode 100644 index 000000000000..290c14a7a6b7 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroupsProjectname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_projectname_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.ProjectName; +import com.google.recaptchaenterprise.v1.RelatedAccountGroup; + +public class SyncListRelatedAccountGroupsProjectname { + + public static void main(String[] args) throws Exception { + syncListRelatedAccountGroupsProjectname(); + } + + public static void syncListRelatedAccountGroupsProjectname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + for (RelatedAccountGroup element : + recaptchaEnterpriseServiceClient.listRelatedAccountGroups(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_projectname_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroupsString.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroupsString.java new file mode 100644 index 000000000000..16774f014f4d --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/listrelatedaccountgroups/SyncListRelatedAccountGroupsString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_string_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.ProjectName; +import com.google.recaptchaenterprise.v1.RelatedAccountGroup; + +public class SyncListRelatedAccountGroupsString { + + public static void main(String[] args) throws Exception { + syncListRelatedAccountGroupsString(); + } + + public static void syncListRelatedAccountGroupsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + for (RelatedAccountGroup element : + recaptchaEnterpriseServiceClient.listRelatedAccountGroups(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_listrelatedaccountgroups_string_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/migratekey/AsyncMigrateKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/migratekey/AsyncMigrateKey.java new file mode 100644 index 000000000000..a93f665b87dc --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/migratekey/AsyncMigrateKey.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_migratekey_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.KeyName; +import com.google.recaptchaenterprise.v1.MigrateKeyRequest; + +public class AsyncMigrateKey { + + public static void main(String[] args) throws Exception { + asyncMigrateKey(); + } + + public static void asyncMigrateKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + MigrateKeyRequest request = + MigrateKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient.migrateKeyCallable().futureCall(request); + // Do something. + Key response = future.get(); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_migratekey_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/migratekey/SyncMigrateKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/migratekey/SyncMigrateKey.java new file mode 100644 index 000000000000..1cc641b9c303 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/migratekey/SyncMigrateKey.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_migratekey_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.KeyName; +import com.google.recaptchaenterprise.v1.MigrateKeyRequest; + +public class SyncMigrateKey { + + public static void main(String[] args) throws Exception { + syncMigrateKey(); + } + + public static void syncMigrateKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + MigrateKeyRequest request = + MigrateKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[KEY]").toString()) + .build(); + Key response = recaptchaEnterpriseServiceClient.migrateKey(request); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_migratekey_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/AsyncSearchRelatedAccountGroupMemberships.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/AsyncSearchRelatedAccountGroupMemberships.java new file mode 100644 index 000000000000..5e5dc98affb5 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/AsyncSearchRelatedAccountGroupMemberships.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.protobuf.ByteString; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; +import com.google.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest; + +public class AsyncSearchRelatedAccountGroupMemberships { + + public static void main(String[] args) throws Exception { + asyncSearchRelatedAccountGroupMemberships(); + } + + public static void asyncSearchRelatedAccountGroupMemberships() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + SearchRelatedAccountGroupMembershipsRequest request = + SearchRelatedAccountGroupMembershipsRequest.newBuilder() + .setProject( + RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString()) + .setHashedAccountId(ByteString.EMPTY) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient + .searchRelatedAccountGroupMembershipsPagedCallable() + .futureCall(request); + // Do something. + for (RelatedAccountGroupMembership element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/AsyncSearchRelatedAccountGroupMembershipsPaged.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/AsyncSearchRelatedAccountGroupMembershipsPaged.java new file mode 100644 index 000000000000..59a77209997f --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/AsyncSearchRelatedAccountGroupMembershipsPaged.java @@ -0,0 +1,68 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_paged_async] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.common.base.Strings; +import com.google.protobuf.ByteString; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; +import com.google.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest; +import com.google.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsResponse; + +public class AsyncSearchRelatedAccountGroupMembershipsPaged { + + public static void main(String[] args) throws Exception { + asyncSearchRelatedAccountGroupMembershipsPaged(); + } + + public static void asyncSearchRelatedAccountGroupMembershipsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + SearchRelatedAccountGroupMembershipsRequest request = + SearchRelatedAccountGroupMembershipsRequest.newBuilder() + .setProject( + RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString()) + .setHashedAccountId(ByteString.EMPTY) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + SearchRelatedAccountGroupMembershipsResponse response = + recaptchaEnterpriseServiceClient + .searchRelatedAccountGroupMembershipsCallable() + .call(request); + for (RelatedAccountGroupMembership element : + response.getRelatedAccountGroupMembershipsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_paged_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMemberships.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMemberships.java new file mode 100644 index 000000000000..a1b87130f495 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMemberships.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.protobuf.ByteString; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; +import com.google.recaptchaenterprise.v1.SearchRelatedAccountGroupMembershipsRequest; + +public class SyncSearchRelatedAccountGroupMemberships { + + public static void main(String[] args) throws Exception { + syncSearchRelatedAccountGroupMemberships(); + } + + public static void syncSearchRelatedAccountGroupMemberships() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + SearchRelatedAccountGroupMembershipsRequest request = + SearchRelatedAccountGroupMembershipsRequest.newBuilder() + .setProject( + RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString()) + .setHashedAccountId(ByteString.EMPTY) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (RelatedAccountGroupMembership element : + recaptchaEnterpriseServiceClient + .searchRelatedAccountGroupMemberships(request) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMembershipsRelatedaccountgroupnameBytestring.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMembershipsRelatedaccountgroupnameBytestring.java new file mode 100644 index 000000000000..870a361a637e --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMembershipsRelatedaccountgroupnameBytestring.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_relatedaccountgroupnamebytestring_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.protobuf.ByteString; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; + +public class SyncSearchRelatedAccountGroupMembershipsRelatedaccountgroupnameBytestring { + + public static void main(String[] args) throws Exception { + syncSearchRelatedAccountGroupMembershipsRelatedaccountgroupnameBytestring(); + } + + public static void syncSearchRelatedAccountGroupMembershipsRelatedaccountgroupnameBytestring() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + RelatedAccountGroupName project = + RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]"); + ByteString hashedAccountId = ByteString.EMPTY; + for (RelatedAccountGroupMembership element : + recaptchaEnterpriseServiceClient + .searchRelatedAccountGroupMemberships(project, hashedAccountId) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_relatedaccountgroupnamebytestring_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMembershipsStringBytestring.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMembershipsStringBytestring.java new file mode 100644 index 000000000000..ba406b891802 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/searchrelatedaccountgroupmemberships/SyncSearchRelatedAccountGroupMembershipsStringBytestring.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_stringbytestring_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.protobuf.ByteString; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupMembership; +import com.google.recaptchaenterprise.v1.RelatedAccountGroupName; + +public class SyncSearchRelatedAccountGroupMembershipsStringBytestring { + + public static void main(String[] args) throws Exception { + syncSearchRelatedAccountGroupMembershipsStringBytestring(); + } + + public static void syncSearchRelatedAccountGroupMembershipsStringBytestring() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + String project = RelatedAccountGroupName.of("[PROJECT]", "[RELATEDACCOUNTGROUP]").toString(); + ByteString hashedAccountId = ByteString.EMPTY; + for (RelatedAccountGroupMembership element : + recaptchaEnterpriseServiceClient + .searchRelatedAccountGroupMemberships(project, hashedAccountId) + .iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_searchrelatedaccountgroupmemberships_stringbytestring_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/updatekey/AsyncUpdateKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/updatekey/AsyncUpdateKey.java new file mode 100644 index 000000000000..1199190c7d99 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/updatekey/AsyncUpdateKey.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_updatekey_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.protobuf.FieldMask; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.UpdateKeyRequest; + +public class AsyncUpdateKey { + + public static void main(String[] args) throws Exception { + asyncUpdateKey(); + } + + public static void asyncUpdateKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + UpdateKeyRequest request = + UpdateKeyRequest.newBuilder() + .setKey(Key.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + recaptchaEnterpriseServiceClient.updateKeyCallable().futureCall(request); + // Do something. + Key response = future.get(); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_updatekey_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/updatekey/SyncUpdateKey.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/updatekey/SyncUpdateKey.java new file mode 100644 index 000000000000..993d70da4edd --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseserviceclient/updatekey/SyncUpdateKey.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_updatekey_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient; +import com.google.protobuf.FieldMask; +import com.google.recaptchaenterprise.v1.Key; +import com.google.recaptchaenterprise.v1.UpdateKeyRequest; + +public class SyncUpdateKey { + + public static void main(String[] args) throws Exception { + syncUpdateKey(); + } + + public static void syncUpdateKey() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = + RecaptchaEnterpriseServiceClient.create()) { + UpdateKeyRequest request = + UpdateKeyRequest.newBuilder() + .setKey(Key.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Key response = recaptchaEnterpriseServiceClient.updateKey(request); + } + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseserviceclient_updatekey_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseservicesettings/createassessment/SyncCreateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseservicesettings/createassessment/SyncCreateAssessment.java new file mode 100644 index 000000000000..426e31ea0d08 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/recaptchaenterpriseservicesettings/createassessment/SyncCreateAssessment.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.samples; + +// [START recaptchaenterprise_v1_generated_recaptchaenterpriseservicesettings_createassessment_sync] +import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceSettings; +import java.time.Duration; + +public class SyncCreateAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessment(); + } + + public static void syncCreateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + RecaptchaEnterpriseServiceSettings.Builder recaptchaEnterpriseServiceSettingsBuilder = + RecaptchaEnterpriseServiceSettings.newBuilder(); + recaptchaEnterpriseServiceSettingsBuilder + .createAssessmentSettings() + .setRetrySettings( + recaptchaEnterpriseServiceSettingsBuilder + .createAssessmentSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + RecaptchaEnterpriseServiceSettings recaptchaEnterpriseServiceSettings = + recaptchaEnterpriseServiceSettingsBuilder.build(); + } +} +// [END recaptchaenterprise_v1_generated_recaptchaenterpriseservicesettings_createassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/stub/recaptchaenterpriseservicestubsettings/createassessment/SyncCreateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/stub/recaptchaenterpriseservicestubsettings/createassessment/SyncCreateAssessment.java new file mode 100644 index 000000000000..ba790e42619b --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1/stub/recaptchaenterpriseservicestubsettings/createassessment/SyncCreateAssessment.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1.stub.samples; + +// [START +// recaptchaenterprise_v1_generated_recaptchaenterpriseservicestubsettings_createassessment_sync] +import com.google.cloud.recaptchaenterprise.v1.stub.RecaptchaEnterpriseServiceStubSettings; +import java.time.Duration; + +public class SyncCreateAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessment(); + } + + public static void syncCreateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + RecaptchaEnterpriseServiceStubSettings.Builder recaptchaEnterpriseServiceSettingsBuilder = + RecaptchaEnterpriseServiceStubSettings.newBuilder(); + recaptchaEnterpriseServiceSettingsBuilder + .createAssessmentSettings() + .setRetrySettings( + recaptchaEnterpriseServiceSettingsBuilder + .createAssessmentSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + RecaptchaEnterpriseServiceStubSettings recaptchaEnterpriseServiceSettings = + recaptchaEnterpriseServiceSettingsBuilder.build(); + } +} +// [END +// recaptchaenterprise_v1_generated_recaptchaenterpriseservicestubsettings_createassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/AsyncAnnotateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/AsyncAnnotateAssessment.java new file mode 100644 index 000000000000..f82e2b6f065a --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/AsyncAnnotateAssessment.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_annotateassessment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.protobuf.ByteString; +import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; +import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; +import com.google.recaptchaenterprise.v1beta1.AssessmentName; +import java.util.ArrayList; + +public class AsyncAnnotateAssessment { + + public static void main(String[] args) throws Exception { + asyncAnnotateAssessment(); + } + + public static void asyncAnnotateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create()) { + AnnotateAssessmentRequest request = + AnnotateAssessmentRequest.newBuilder() + .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString()) + .addAllReasons(new ArrayList()) + .setHashedAccountId(ByteString.EMPTY) + .build(); + ApiFuture future = + recaptchaEnterpriseServiceV1Beta1Client.annotateAssessmentCallable().futureCall(request); + // Do something. + AnnotateAssessmentResponse response = future.get(); + } + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_annotateassessment_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessment.java new file mode 100644 index 000000000000..f09e1783b36f --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessment.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_annotateassessment_sync] +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.protobuf.ByteString; +import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; +import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; +import com.google.recaptchaenterprise.v1beta1.AssessmentName; +import java.util.ArrayList; + +public class SyncAnnotateAssessment { + + public static void main(String[] args) throws Exception { + syncAnnotateAssessment(); + } + + public static void syncAnnotateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create()) { + AnnotateAssessmentRequest request = + AnnotateAssessmentRequest.newBuilder() + .setName(AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString()) + .addAllReasons(new ArrayList()) + .setHashedAccountId(ByteString.EMPTY) + .build(); + AnnotateAssessmentResponse response = + recaptchaEnterpriseServiceV1Beta1Client.annotateAssessment(request); + } + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_annotateassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation.java new file mode 100644 index 000000000000..0e6f23086157 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_annotateassessment_assessmentnameannotateassessmentrequestannotation_sync] +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; +import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; +import com.google.recaptchaenterprise.v1beta1.AssessmentName; + +public class SyncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation { + + public static void main(String[] args) throws Exception { + syncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation(); + } + + public static void syncAnnotateAssessmentAssessmentnameAnnotateassessmentrequestannotation() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create()) { + AssessmentName name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]"); + AnnotateAssessmentRequest.Annotation annotation = + AnnotateAssessmentRequest.Annotation.forNumber(0); + AnnotateAssessmentResponse response = + recaptchaEnterpriseServiceV1Beta1Client.annotateAssessment(name, annotation); + } + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_annotateassessment_assessmentnameannotateassessmentrequestannotation_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation.java new file mode 100644 index 000000000000..64194b42844f --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/annotateassessment/SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_annotateassessment_stringannotateassessmentrequestannotation_sync] +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentRequest; +import com.google.recaptchaenterprise.v1beta1.AnnotateAssessmentResponse; +import com.google.recaptchaenterprise.v1beta1.AssessmentName; + +public class SyncAnnotateAssessmentStringAnnotateassessmentrequestannotation { + + public static void main(String[] args) throws Exception { + syncAnnotateAssessmentStringAnnotateassessmentrequestannotation(); + } + + public static void syncAnnotateAssessmentStringAnnotateassessmentrequestannotation() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create()) { + String name = AssessmentName.of("[PROJECT]", "[ASSESSMENT]").toString(); + AnnotateAssessmentRequest.Annotation annotation = + AnnotateAssessmentRequest.Annotation.forNumber(0); + AnnotateAssessmentResponse response = + recaptchaEnterpriseServiceV1Beta1Client.annotateAssessment(name, annotation); + } + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_annotateassessment_stringannotateassessmentrequestannotation_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/create/SyncCreateSetCredentialsProvider.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..e672c67fb550 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Settings; +import com.google.cloud.recaptchaenterprise.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + RecaptchaEnterpriseServiceV1Beta1Settings recaptchaEnterpriseServiceV1Beta1Settings = + RecaptchaEnterpriseServiceV1Beta1Settings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create(recaptchaEnterpriseServiceV1Beta1Settings); + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_create_setcredentialsprovider_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/create/SyncCreateSetEndpoint.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..176b22a46b7e --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/create/SyncCreateSetEndpoint.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_create_setendpoint_sync] +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Settings; +import com.google.cloud.recaptchaenterprise.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + RecaptchaEnterpriseServiceV1Beta1Settings recaptchaEnterpriseServiceV1Beta1Settings = + RecaptchaEnterpriseServiceV1Beta1Settings.newBuilder().setEndpoint(myEndpoint).build(); + RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create(recaptchaEnterpriseServiceV1Beta1Settings); + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_create_setendpoint_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/AsyncCreateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/AsyncCreateAssessment.java new file mode 100644 index 000000000000..34cf084398f9 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/AsyncCreateAssessment.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_createassessment_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.recaptchaenterprise.v1beta1.Assessment; +import com.google.recaptchaenterprise.v1beta1.CreateAssessmentRequest; +import com.google.recaptchaenterprise.v1beta1.ProjectName; + +public class AsyncCreateAssessment { + + public static void main(String[] args) throws Exception { + asyncCreateAssessment(); + } + + public static void asyncCreateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create()) { + CreateAssessmentRequest request = + CreateAssessmentRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setAssessment(Assessment.newBuilder().build()) + .build(); + ApiFuture future = + recaptchaEnterpriseServiceV1Beta1Client.createAssessmentCallable().futureCall(request); + // Do something. + Assessment response = future.get(); + } + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_createassessment_async] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessment.java new file mode 100644 index 000000000000..1de577b141ea --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessment.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_createassessment_sync] +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.recaptchaenterprise.v1beta1.Assessment; +import com.google.recaptchaenterprise.v1beta1.CreateAssessmentRequest; +import com.google.recaptchaenterprise.v1beta1.ProjectName; + +public class SyncCreateAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessment(); + } + + public static void syncCreateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create()) { + CreateAssessmentRequest request = + CreateAssessmentRequest.newBuilder() + .setParent(ProjectName.of("[PROJECT]").toString()) + .setAssessment(Assessment.newBuilder().build()) + .build(); + Assessment response = recaptchaEnterpriseServiceV1Beta1Client.createAssessment(request); + } + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_createassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessmentProjectnameAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessmentProjectnameAssessment.java new file mode 100644 index 000000000000..00b21de08e4c --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessmentProjectnameAssessment.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_createassessment_projectnameassessment_sync] +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.recaptchaenterprise.v1beta1.Assessment; +import com.google.recaptchaenterprise.v1beta1.ProjectName; + +public class SyncCreateAssessmentProjectnameAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessmentProjectnameAssessment(); + } + + public static void syncCreateAssessmentProjectnameAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create()) { + ProjectName parent = ProjectName.of("[PROJECT]"); + Assessment assessment = Assessment.newBuilder().build(); + Assessment response = + recaptchaEnterpriseServiceV1Beta1Client.createAssessment(parent, assessment); + } + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_createassessment_projectnameassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessmentStringAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessmentStringAssessment.java new file mode 100644 index 000000000000..28f66bced0f2 --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1client/createassessment/SyncCreateAssessmentStringAssessment.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_createassessment_stringassessment_sync] +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Client; +import com.google.recaptchaenterprise.v1beta1.Assessment; +import com.google.recaptchaenterprise.v1beta1.ProjectName; + +public class SyncCreateAssessmentStringAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessmentStringAssessment(); + } + + public static void syncCreateAssessmentStringAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = + RecaptchaEnterpriseServiceV1Beta1Client.create()) { + String parent = ProjectName.of("[PROJECT]").toString(); + Assessment assessment = Assessment.newBuilder().build(); + Assessment response = + recaptchaEnterpriseServiceV1Beta1Client.createAssessment(parent, assessment); + } + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1client_createassessment_stringassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1settings/createassessment/SyncCreateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1settings/createassessment/SyncCreateAssessment.java new file mode 100644 index 000000000000..5f366d2c9b4a --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterpriseservicev1beta1settings/createassessment/SyncCreateAssessment.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1settings_createassessment_sync] +import com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1Settings; +import java.time.Duration; + +public class SyncCreateAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessment(); + } + + public static void syncCreateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + RecaptchaEnterpriseServiceV1Beta1Settings.Builder + recaptchaEnterpriseServiceV1Beta1SettingsBuilder = + RecaptchaEnterpriseServiceV1Beta1Settings.newBuilder(); + recaptchaEnterpriseServiceV1Beta1SettingsBuilder + .createAssessmentSettings() + .setRetrySettings( + recaptchaEnterpriseServiceV1Beta1SettingsBuilder + .createAssessmentSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + RecaptchaEnterpriseServiceV1Beta1Settings recaptchaEnterpriseServiceV1Beta1Settings = + recaptchaEnterpriseServiceV1Beta1SettingsBuilder.build(); + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1settings_createassessment_sync] diff --git a/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/stub/recaptchaenterpriseservicev1beta1stubsettings/createassessment/SyncCreateAssessment.java b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/stub/recaptchaenterpriseservicev1beta1stubsettings/createassessment/SyncCreateAssessment.java new file mode 100644 index 000000000000..5c66453e75ea --- /dev/null +++ b/java-recaptchaenterprise/samples/snippets/generated/com/google/cloud/recaptchaenterprise/v1beta1/stub/recaptchaenterpriseservicev1beta1stubsettings/createassessment/SyncCreateAssessment.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.recaptchaenterprise.v1beta1.stub.samples; + +// [START +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1stubsettings_createassessment_sync] +import com.google.cloud.recaptchaenterprise.v1beta1.stub.RecaptchaEnterpriseServiceV1Beta1StubSettings; +import java.time.Duration; + +public class SyncCreateAssessment { + + public static void main(String[] args) throws Exception { + syncCreateAssessment(); + } + + public static void syncCreateAssessment() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + RecaptchaEnterpriseServiceV1Beta1StubSettings.Builder + recaptchaEnterpriseServiceV1Beta1SettingsBuilder = + RecaptchaEnterpriseServiceV1Beta1StubSettings.newBuilder(); + recaptchaEnterpriseServiceV1Beta1SettingsBuilder + .createAssessmentSettings() + .setRetrySettings( + recaptchaEnterpriseServiceV1Beta1SettingsBuilder + .createAssessmentSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + RecaptchaEnterpriseServiceV1Beta1StubSettings recaptchaEnterpriseServiceV1Beta1Settings = + recaptchaEnterpriseServiceV1Beta1SettingsBuilder.build(); + } +} +// [END +// recaptchaenterprise_v1beta1_generated_recaptchaenterpriseservicev1beta1stubsettings_createassessment_sync]