16
16
17
17
package com .google .cloud .webrisk .v1 ;
18
18
19
+ import com .google .api .core .BetaApi ;
19
20
import com .google .api .gax .core .BackgroundResource ;
21
+ import com .google .api .gax .httpjson .longrunning .OperationsClient ;
22
+ import com .google .api .gax .longrunning .OperationFuture ;
23
+ import com .google .api .gax .rpc .OperationCallable ;
20
24
import com .google .api .gax .rpc .UnaryCallable ;
21
25
import com .google .cloud .webrisk .v1 .stub .WebRiskServiceStub ;
22
26
import com .google .cloud .webrisk .v1 .stub .WebRiskServiceStubSettings ;
27
+ import com .google .longrunning .Operation ;
23
28
import com .google .protobuf .ByteString ;
24
29
import com .google .webrisk .v1 .ComputeThreatListDiffRequest ;
25
30
import com .google .webrisk .v1 .ComputeThreatListDiffResponse ;
30
35
import com .google .webrisk .v1 .SearchUrisRequest ;
31
36
import com .google .webrisk .v1 .SearchUrisResponse ;
32
37
import com .google .webrisk .v1 .Submission ;
38
+ import com .google .webrisk .v1 .SubmitUriMetadata ;
39
+ import com .google .webrisk .v1 .SubmitUriRequest ;
33
40
import com .google .webrisk .v1 .ThreatType ;
34
41
import java .io .IOException ;
35
42
import java .util .List ;
134
141
public class WebRiskServiceClient implements BackgroundResource {
135
142
private final WebRiskServiceSettings settings ;
136
143
private final WebRiskServiceStub stub ;
144
+ private final OperationsClient httpJsonOperationsClient ;
145
+ private final com .google .longrunning .OperationsClient operationsClient ;
137
146
138
147
/** Constructs an instance of WebRiskServiceClient with default settings. */
139
148
public static final WebRiskServiceClient create () throws IOException {
@@ -165,11 +174,17 @@ public static final WebRiskServiceClient create(WebRiskServiceStub stub) {
165
174
protected WebRiskServiceClient (WebRiskServiceSettings settings ) throws IOException {
166
175
this .settings = settings ;
167
176
this .stub = ((WebRiskServiceStubSettings ) settings .getStubSettings ()).createStub ();
177
+ this .operationsClient =
178
+ com .google .longrunning .OperationsClient .create (this .stub .getOperationsStub ());
179
+ this .httpJsonOperationsClient = OperationsClient .create (this .stub .getHttpJsonOperationsStub ());
168
180
}
169
181
170
182
protected WebRiskServiceClient (WebRiskServiceStub stub ) {
171
183
this .settings = null ;
172
184
this .stub = stub ;
185
+ this .operationsClient =
186
+ com .google .longrunning .OperationsClient .create (this .stub .getOperationsStub ());
187
+ this .httpJsonOperationsClient = OperationsClient .create (this .stub .getHttpJsonOperationsStub ());
173
188
}
174
189
175
190
public final WebRiskServiceSettings getSettings () {
@@ -180,6 +195,23 @@ public WebRiskServiceStub getStub() {
180
195
return stub ;
181
196
}
182
197
198
+ /**
199
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
200
+ * returned by another API method call.
201
+ */
202
+ public final com .google .longrunning .OperationsClient getOperationsClient () {
203
+ return operationsClient ;
204
+ }
205
+
206
+ /**
207
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
208
+ * returned by another API method call.
209
+ */
210
+ @ BetaApi
211
+ public final OperationsClient getHttpJsonOperationsClient () {
212
+ return httpJsonOperationsClient ;
213
+ }
214
+
183
215
// AUTO-GENERATED DOCUMENTATION AND METHOD.
184
216
/**
185
217
* Gets the most recent threat list diffs. These diffs should be applied to a local database of
@@ -640,6 +672,121 @@ public final UnaryCallable<CreateSubmissionRequest, Submission> createSubmission
640
672
return stub .createSubmissionCallable ();
641
673
}
642
674
675
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
676
+ /**
677
+ * Submits a URI suspected of containing malicious content to be reviewed. Returns a
678
+ * google.longrunning.Operation which, once the review is complete, is updated with its result.
679
+ * You can use the [Pub/Sub API] (https://cloud.google.com/pubsub) to receive notifications for
680
+ * the returned Operation. If the result verifies the existence of malicious content, the site
681
+ * will be added to the [Google's Social Engineering lists]
682
+ * (https://support.google.com/webmasters/answer/6350487/) in order to protect users that could
683
+ * get exposed to this threat in the future. Only allowlisted projects can use this method during
684
+ * Early Access. Please reach out to Sales or your customer engineer to obtain access.
685
+ *
686
+ * <p>Sample code:
687
+ *
688
+ * <pre>{@code
689
+ * // This snippet has been automatically generated and should be regarded as a code template only.
690
+ * // It will require modifications to work:
691
+ * // - It may require correct/in-range values for request initialization.
692
+ * // - It may require specifying regional endpoints when creating the service client as shown in
693
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
694
+ * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
695
+ * SubmitUriRequest request =
696
+ * SubmitUriRequest.newBuilder()
697
+ * .setParent(ProjectName.of("[PROJECT]").toString())
698
+ * .setSubmission(Submission.newBuilder().build())
699
+ * .setThreatInfo(ThreatInfo.newBuilder().build())
700
+ * .setThreatDiscovery(ThreatDiscovery.newBuilder().build())
701
+ * .build();
702
+ * Submission response = webRiskServiceClient.submitUriAsync(request).get();
703
+ * }
704
+ * }</pre>
705
+ *
706
+ * @param request The request object containing all of the parameters for the API call.
707
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
708
+ */
709
+ public final OperationFuture <Submission , SubmitUriMetadata > submitUriAsync (
710
+ SubmitUriRequest request ) {
711
+ return submitUriOperationCallable ().futureCall (request );
712
+ }
713
+
714
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
715
+ /**
716
+ * Submits a URI suspected of containing malicious content to be reviewed. Returns a
717
+ * google.longrunning.Operation which, once the review is complete, is updated with its result.
718
+ * You can use the [Pub/Sub API] (https://cloud.google.com/pubsub) to receive notifications for
719
+ * the returned Operation. If the result verifies the existence of malicious content, the site
720
+ * will be added to the [Google's Social Engineering lists]
721
+ * (https://support.google.com/webmasters/answer/6350487/) in order to protect users that could
722
+ * get exposed to this threat in the future. Only allowlisted projects can use this method during
723
+ * Early Access. Please reach out to Sales or your customer engineer to obtain access.
724
+ *
725
+ * <p>Sample code:
726
+ *
727
+ * <pre>{@code
728
+ * // This snippet has been automatically generated and should be regarded as a code template only.
729
+ * // It will require modifications to work:
730
+ * // - It may require correct/in-range values for request initialization.
731
+ * // - It may require specifying regional endpoints when creating the service client as shown in
732
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
733
+ * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
734
+ * SubmitUriRequest request =
735
+ * SubmitUriRequest.newBuilder()
736
+ * .setParent(ProjectName.of("[PROJECT]").toString())
737
+ * .setSubmission(Submission.newBuilder().build())
738
+ * .setThreatInfo(ThreatInfo.newBuilder().build())
739
+ * .setThreatDiscovery(ThreatDiscovery.newBuilder().build())
740
+ * .build();
741
+ * OperationFuture<Submission, SubmitUriMetadata> future =
742
+ * webRiskServiceClient.submitUriOperationCallable().futureCall(request);
743
+ * // Do something.
744
+ * Submission response = future.get();
745
+ * }
746
+ * }</pre>
747
+ */
748
+ public final OperationCallable <SubmitUriRequest , Submission , SubmitUriMetadata >
749
+ submitUriOperationCallable () {
750
+ return stub .submitUriOperationCallable ();
751
+ }
752
+
753
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
754
+ /**
755
+ * Submits a URI suspected of containing malicious content to be reviewed. Returns a
756
+ * google.longrunning.Operation which, once the review is complete, is updated with its result.
757
+ * You can use the [Pub/Sub API] (https://cloud.google.com/pubsub) to receive notifications for
758
+ * the returned Operation. If the result verifies the existence of malicious content, the site
759
+ * will be added to the [Google's Social Engineering lists]
760
+ * (https://support.google.com/webmasters/answer/6350487/) in order to protect users that could
761
+ * get exposed to this threat in the future. Only allowlisted projects can use this method during
762
+ * Early Access. Please reach out to Sales or your customer engineer to obtain access.
763
+ *
764
+ * <p>Sample code:
765
+ *
766
+ * <pre>{@code
767
+ * // This snippet has been automatically generated and should be regarded as a code template only.
768
+ * // It will require modifications to work:
769
+ * // - It may require correct/in-range values for request initialization.
770
+ * // - It may require specifying regional endpoints when creating the service client as shown in
771
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
772
+ * try (WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.create()) {
773
+ * SubmitUriRequest request =
774
+ * SubmitUriRequest.newBuilder()
775
+ * .setParent(ProjectName.of("[PROJECT]").toString())
776
+ * .setSubmission(Submission.newBuilder().build())
777
+ * .setThreatInfo(ThreatInfo.newBuilder().build())
778
+ * .setThreatDiscovery(ThreatDiscovery.newBuilder().build())
779
+ * .build();
780
+ * ApiFuture<Operation> future = webRiskServiceClient.submitUriCallable().futureCall(request);
781
+ * // Do something.
782
+ * Operation response = future.get();
783
+ * }
784
+ * }</pre>
785
+ */
786
+ public final UnaryCallable <SubmitUriRequest , Operation > submitUriCallable () {
787
+ return stub .submitUriCallable ();
788
+ }
789
+
643
790
@ Override
644
791
public final void close () {
645
792
stub .close ();
0 commit comments