From 61ac100f8f8ce7ab8c30bf0450dc7903e9bdb38b Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 9 Feb 2021 10:30:05 -0800 Subject: [PATCH] feat: generate sample code in the Java microgenerator (#360) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/b5715173-fa09-4f29-8c69-530ae787b970/targets - [ ] To automatically regenerate this PR, check this box. PiperOrigin-RevId: 356341083 Source-Link: https://github.com/googleapis/googleapis/commit/8d8c008e56f1af31d57f75561e0f1848ffb29eeb --- .../v1/WebSecurityScannerClient.java | 409 +++++++++++ .../websecurityscanner/v1/package-info.java | 11 + .../v1alpha/WebSecurityScannerClient.java | 693 ++++++++++++++++++ .../v1alpha/package-info.java | 8 + .../v1beta/WebSecurityScannerClient.java | 693 ++++++++++++++++++ .../v1beta/package-info.java | 8 + synth.metadata | 12 +- 7 files changed, 1828 insertions(+), 6 deletions(-) diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClient.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClient.java index 54a891b9..e836e37d 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClient.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/WebSecurityScannerClient.java @@ -44,6 +44,17 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *

{@code
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ *   CreateScanConfigRequest request =
+ *       CreateScanConfigRequest.newBuilder()
+ *           .setParent("parent-995424086")
+ *           .setScanConfig(ScanConfig.newBuilder().build())
+ *           .build();
+ *   ScanConfig response = webSecurityScannerClient.createScanConfig(request);
+ * }
+ * }
+ * *

Note: close() needs to be called on the WebSecurityScannerClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -150,6 +161,19 @@ public WebSecurityScannerStub getStub() { /** * Creates a new ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   CreateScanConfigRequest request =
+   *       CreateScanConfigRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .build();
+   *   ScanConfig response = webSecurityScannerClient.createScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -162,6 +186,20 @@ public final ScanConfig createScanConfig(CreateScanConfigRequest request) { * Creates a new ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   CreateScanConfigRequest request =
+   *       CreateScanConfigRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.createScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ScanConfig response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createScanConfigCallable() { return stub.createScanConfigCallable(); @@ -171,6 +209,16 @@ public final UnaryCallable createScanConfig /** * Deletes an existing ScanConfig and its child resources. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   DeleteScanConfigRequest request =
+   *       DeleteScanConfigRequest.newBuilder().setName("name3373707").build();
+   *   webSecurityScannerClient.deleteScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -183,6 +231,17 @@ public final void deleteScanConfig(DeleteScanConfigRequest request) { * Deletes an existing ScanConfig and its child resources. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   DeleteScanConfigRequest request =
+   *       DeleteScanConfigRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.deleteScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteScanConfigCallable() { return stub.deleteScanConfigCallable(); @@ -192,6 +251,16 @@ public final UnaryCallable deleteScanConfigCalla /** * Gets a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanConfigRequest request =
+   *       GetScanConfigRequest.newBuilder().setName("name3373707").build();
+   *   ScanConfig response = webSecurityScannerClient.getScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -204,6 +273,17 @@ public final ScanConfig getScanConfig(GetScanConfigRequest request) { * Gets a ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanConfigRequest request =
+   *       GetScanConfigRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.getScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ScanConfig response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getScanConfigCallable() { return stub.getScanConfigCallable(); @@ -213,6 +293,22 @@ public final UnaryCallable getScanConfigCallab /** * Lists ScanConfigs under a given project. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanConfigsRequest request =
+   *       ListScanConfigsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (ScanConfig element : webSecurityScannerClient.listScanConfigs(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -225,6 +321,23 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest * Lists ScanConfigs under a given project. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanConfigsRequest request =
+   *       ListScanConfigsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listScanConfigsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (ScanConfig element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanConfigsPagedCallable() { @@ -236,6 +349,24 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest * Lists ScanConfigs under a given project. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListScanConfigsResponse response =
+   *         webSecurityScannerClient.listScanConfigsCallable().call(request);
+   *     for (ScanConfig element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanConfigsCallable() { @@ -246,6 +377,19 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest /** * Updates a ScanConfig. This method support partial update of a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   UpdateScanConfigRequest request =
+   *       UpdateScanConfigRequest.newBuilder()
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ScanConfig response = webSecurityScannerClient.updateScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -258,6 +402,20 @@ public final ScanConfig updateScanConfig(UpdateScanConfigRequest request) { * Updates a ScanConfig. This method support partial update of a ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   UpdateScanConfigRequest request =
+   *       UpdateScanConfigRequest.newBuilder()
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.updateScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ScanConfig response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateScanConfigCallable() { return stub.updateScanConfigCallable(); @@ -267,6 +425,15 @@ public final UnaryCallable updateScanConfig /** * Start a ScanRun according to the given ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StartScanRunRequest request = StartScanRunRequest.newBuilder().setName("name3373707").build();
+   *   ScanRun response = webSecurityScannerClient.startScanRun(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -279,6 +446,16 @@ public final ScanRun startScanRun(StartScanRunRequest request) { * Start a ScanRun according to the given ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StartScanRunRequest request = StartScanRunRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.startScanRunCallable().futureCall(request);
+   *   // Do something.
+   *   ScanRun response = future.get();
+   * }
+   * }
*/ public final UnaryCallable startScanRunCallable() { return stub.startScanRunCallable(); @@ -288,6 +465,15 @@ public final UnaryCallable startScanRunCallable() /** * Gets a ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanRunRequest request = GetScanRunRequest.newBuilder().setName("name3373707").build();
+   *   ScanRun response = webSecurityScannerClient.getScanRun(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -300,6 +486,15 @@ public final ScanRun getScanRun(GetScanRunRequest request) { * Gets a ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanRunRequest request = GetScanRunRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = webSecurityScannerClient.getScanRunCallable().futureCall(request);
+   *   // Do something.
+   *   ScanRun response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getScanRunCallable() { return stub.getScanRunCallable(); @@ -309,6 +504,22 @@ public final UnaryCallable getScanRunCallable() { /** * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanRunsRequest request =
+   *       ListScanRunsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (ScanRun element : webSecurityScannerClient.listScanRuns(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -321,6 +532,23 @@ public final ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request) * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanRunsRequest request =
+   *       ListScanRunsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listScanRunsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (ScanRun element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanRunsPagedCallable() { @@ -332,6 +560,24 @@ public final ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request) * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListScanRunsResponse response =
+   *         webSecurityScannerClient.listScanRunsCallable().call(request);
+   *     for (ScanRun element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanRunsCallable() { return stub.listScanRunsCallable(); @@ -341,6 +587,15 @@ public final UnaryCallable listScanRu /** * Stops a ScanRun. The stopped ScanRun is returned. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StopScanRunRequest request = StopScanRunRequest.newBuilder().setName("name3373707").build();
+   *   ScanRun response = webSecurityScannerClient.stopScanRun(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -353,6 +608,16 @@ public final ScanRun stopScanRun(StopScanRunRequest request) { * Stops a ScanRun. The stopped ScanRun is returned. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StopScanRunRequest request = StopScanRunRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.stopScanRunCallable().futureCall(request);
+   *   // Do something.
+   *   ScanRun response = future.get();
+   * }
+   * }
*/ public final UnaryCallable stopScanRunCallable() { return stub.stopScanRunCallable(); @@ -362,6 +627,22 @@ public final UnaryCallable stopScanRunCallable() { /** * List CrawledUrls under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListCrawledUrlsRequest request =
+   *       ListCrawledUrlsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -374,6 +655,23 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest * List CrawledUrls under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListCrawledUrlsRequest request =
+   *       ListCrawledUrlsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listCrawledUrlsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (CrawledUrl element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listCrawledUrlsPagedCallable() { @@ -385,6 +683,24 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest * List CrawledUrls under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListCrawledUrlsResponse response =
+   *         webSecurityScannerClient.listCrawledUrlsCallable().call(request);
+   *     for (CrawledUrl element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listCrawledUrlsCallable() { @@ -395,6 +711,15 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest /** * Gets a Finding. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetFindingRequest request = GetFindingRequest.newBuilder().setName("name3373707").build();
+   *   Finding response = webSecurityScannerClient.getFinding(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -407,6 +732,15 @@ public final Finding getFinding(GetFindingRequest request) { * Gets a Finding. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetFindingRequest request = GetFindingRequest.newBuilder().setName("name3373707").build();
+   *   ApiFuture future = webSecurityScannerClient.getFindingCallable().futureCall(request);
+   *   // Do something.
+   *   Finding response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getFindingCallable() { return stub.getFindingCallable(); @@ -416,6 +750,23 @@ public final UnaryCallable getFindingCallable() { /** * List Findings under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingsRequest request =
+   *       ListFindingsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setFilter("filter-1274492040")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (Finding element : webSecurityScannerClient.listFindings(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -428,6 +779,24 @@ public final ListFindingsPagedResponse listFindings(ListFindingsRequest request) * List Findings under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingsRequest request =
+   *       ListFindingsRequest.newBuilder()
+   *           .setParent("parent-995424086")
+   *           .setFilter("filter-1274492040")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listFindingsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Finding element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listFindingsPagedCallable() { @@ -439,6 +808,24 @@ public final ListFindingsPagedResponse listFindings(ListFindingsRequest request) * List Findings under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListFindingsResponse response =
+   *         webSecurityScannerClient.listFindingsCallable().call(request);
+   *     for (Finding element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listFindingsCallable() { return stub.listFindingsCallable(); @@ -448,6 +835,17 @@ public final UnaryCallable listFindin /** * List all FindingTypeStats under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingTypeStatsRequest request =
+   *       ListFindingTypeStatsRequest.newBuilder().setParent("parent-995424086").build();
+   *   ListFindingTypeStatsResponse response =
+   *       webSecurityScannerClient.listFindingTypeStats(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -461,6 +859,17 @@ public final ListFindingTypeStatsResponse listFindingTypeStats( * List all FindingTypeStats under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingTypeStatsRequest request =
+   *       ListFindingTypeStatsRequest.newBuilder().setParent("parent-995424086").build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listFindingTypeStatsCallable().futureCall(request);
+   *   // Do something.
+   *   ListFindingTypeStatsResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable listFindingTypeStatsCallable() { diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/package-info.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/package-info.java index 9c47ead9..8353b7dd 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/package-info.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1/package-info.java @@ -24,6 +24,17 @@ * user inputs and event handlers as possible. * *

Sample for WebSecurityScannerClient: + * + *

{@code
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ *   CreateScanConfigRequest request =
+ *       CreateScanConfigRequest.newBuilder()
+ *           .setParent("parent-995424086")
+ *           .setScanConfig(ScanConfig.newBuilder().build())
+ *           .build();
+ *   ScanConfig response = webSecurityScannerClient.createScanConfig(request);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.websecurityscanner.v1; diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java index 72a1db01..29927941 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java @@ -45,6 +45,14 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *

{@code
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ *   ProjectName parent = ProjectName.of("[PROJECT]");
+ *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+ *   ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
+ * }
+ * }
+ * *

Note: close() needs to be called on the WebSecurityScannerClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -152,6 +160,16 @@ public WebSecurityScannerStub getStub() { /** * Creates a new ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+   *   ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
+   * }
+   * }
+ * * @param parent Required. The parent resource name where the scan is created, which should be a * project resource name in the format 'projects/{projectId}'. * @param scanConfig Required. The ScanConfig to be created. @@ -170,6 +188,16 @@ public final ScanConfig createScanConfig(ProjectName parent, ScanConfig scanConf /** * Creates a new ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+   *   ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
+   * }
+   * }
+ * * @param parent Required. The parent resource name where the scan is created, which should be a * project resource name in the format 'projects/{projectId}'. * @param scanConfig Required. The ScanConfig to be created. @@ -185,6 +213,19 @@ public final ScanConfig createScanConfig(String parent, ScanConfig scanConfig) { /** * Creates a new ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   CreateScanConfigRequest request =
+   *       CreateScanConfigRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .build();
+   *   ScanConfig response = webSecurityScannerClient.createScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -197,6 +238,20 @@ public final ScanConfig createScanConfig(CreateScanConfigRequest request) { * Creates a new ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   CreateScanConfigRequest request =
+   *       CreateScanConfigRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.createScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ScanConfig response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createScanConfigCallable() { return stub.createScanConfigCallable(); @@ -206,6 +261,15 @@ public final UnaryCallable createScanConfig /** * Deletes an existing ScanConfig and its child resources. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   webSecurityScannerClient.deleteScanConfig(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be deleted. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -220,6 +284,15 @@ public final void deleteScanConfig(ScanConfigName name) { /** * Deletes an existing ScanConfig and its child resources. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
+   *   webSecurityScannerClient.deleteScanConfig(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be deleted. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -233,6 +306,18 @@ public final void deleteScanConfig(String name) { /** * Deletes an existing ScanConfig and its child resources. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   DeleteScanConfigRequest request =
+   *       DeleteScanConfigRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   webSecurityScannerClient.deleteScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -245,6 +330,19 @@ public final void deleteScanConfig(DeleteScanConfigRequest request) { * Deletes an existing ScanConfig and its child resources. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   DeleteScanConfigRequest request =
+   *       DeleteScanConfigRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.deleteScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteScanConfigCallable() { return stub.deleteScanConfigCallable(); @@ -254,6 +352,15 @@ public final UnaryCallable deleteScanConfigCalla /** * Gets a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfig response = webSecurityScannerClient.getScanConfig(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be returned. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -268,6 +375,15 @@ public final ScanConfig getScanConfig(ScanConfigName name) { /** * Gets a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
+   *   ScanConfig response = webSecurityScannerClient.getScanConfig(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be returned. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -281,6 +397,18 @@ public final ScanConfig getScanConfig(String name) { /** * Gets a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanConfigRequest request =
+   *       GetScanConfigRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ScanConfig response = webSecurityScannerClient.getScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -293,6 +421,19 @@ public final ScanConfig getScanConfig(GetScanConfigRequest request) { * Gets a ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanConfigRequest request =
+   *       GetScanConfigRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.getScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ScanConfig response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getScanConfigCallable() { return stub.getScanConfigCallable(); @@ -302,6 +443,17 @@ public final UnaryCallable getScanConfigCallab /** * Lists ScanConfigs under a given project. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (ScanConfig element : webSecurityScannerClient.listScanConfigs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a project resource name in * the format 'projects/{projectId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -318,6 +470,17 @@ public final ListScanConfigsPagedResponse listScanConfigs(ProjectName parent) { /** * Lists ScanConfigs under a given project. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   for (ScanConfig element : webSecurityScannerClient.listScanConfigs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a project resource name in * the format 'projects/{projectId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -331,6 +494,22 @@ public final ListScanConfigsPagedResponse listScanConfigs(String parent) { /** * Lists ScanConfigs under a given project. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanConfigsRequest request =
+   *       ListScanConfigsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (ScanConfig element : webSecurityScannerClient.listScanConfigs(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -343,6 +522,23 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest * Lists ScanConfigs under a given project. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanConfigsRequest request =
+   *       ListScanConfigsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listScanConfigsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (ScanConfig element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanConfigsPagedCallable() { @@ -354,6 +550,24 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest * Lists ScanConfigs under a given project. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListScanConfigsResponse response =
+   *         webSecurityScannerClient.listScanConfigsCallable().call(request);
+   *     for (ScanConfig element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanConfigsCallable() { @@ -364,6 +578,16 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest /** * Updates a ScanConfig. This method support partial update of a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   ScanConfig response = webSecurityScannerClient.updateScanConfig(scanConfig, updateMask);
+   * }
+   * }
+ * * @param scanConfig Required. The ScanConfig to be updated. The name field must be set to * identify the resource to be updated. The values of fields not covered by the mask will be * ignored. @@ -385,6 +609,19 @@ public final ScanConfig updateScanConfig(ScanConfig scanConfig, FieldMask update /** * Updates a ScanConfig. This method support partial update of a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   UpdateScanConfigRequest request =
+   *       UpdateScanConfigRequest.newBuilder()
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ScanConfig response = webSecurityScannerClient.updateScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -397,6 +634,20 @@ public final ScanConfig updateScanConfig(UpdateScanConfigRequest request) { * Updates a ScanConfig. This method support partial update of a ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   UpdateScanConfigRequest request =
+   *       UpdateScanConfigRequest.newBuilder()
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.updateScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ScanConfig response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateScanConfigCallable() { return stub.updateScanConfigCallable(); @@ -406,6 +657,15 @@ public final UnaryCallable updateScanConfig /** * Start a ScanRun according to the given ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanRun response = webSecurityScannerClient.startScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be used. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -420,6 +680,15 @@ public final ScanRun startScanRun(ScanConfigName name) { /** * Start a ScanRun according to the given ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
+   *   ScanRun response = webSecurityScannerClient.startScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be used. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -433,6 +702,18 @@ public final ScanRun startScanRun(String name) { /** * Start a ScanRun according to the given ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StartScanRunRequest request =
+   *       StartScanRunRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ScanRun response = webSecurityScannerClient.startScanRun(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -445,6 +726,19 @@ public final ScanRun startScanRun(StartScanRunRequest request) { * Start a ScanRun according to the given ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StartScanRunRequest request =
+   *       StartScanRunRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.startScanRunCallable().futureCall(request);
+   *   // Do something.
+   *   ScanRun response = future.get();
+   * }
+   * }
*/ public final UnaryCallable startScanRunCallable() { return stub.startScanRunCallable(); @@ -454,6 +748,15 @@ public final UnaryCallable startScanRunCallable() /** * Gets a ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   ScanRun response = webSecurityScannerClient.getScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanRun to be returned. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -468,6 +771,15 @@ public final ScanRun getScanRun(ScanRunName name) { /** * Gets a ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   ScanRun response = webSecurityScannerClient.getScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanRun to be returned. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -481,6 +793,18 @@ public final ScanRun getScanRun(String name) { /** * Gets a ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanRunRequest request =
+   *       GetScanRunRequest.newBuilder()
+   *           .setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ScanRun response = webSecurityScannerClient.getScanRun(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -493,6 +817,18 @@ public final ScanRun getScanRun(GetScanRunRequest request) { * Gets a ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanRunRequest request =
+   *       GetScanRunRequest.newBuilder()
+   *           .setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ApiFuture future = webSecurityScannerClient.getScanRunCallable().futureCall(request);
+   *   // Do something.
+   *   ScanRun response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getScanRunCallable() { return stub.getScanRunCallable(); @@ -502,6 +838,17 @@ public final UnaryCallable getScanRunCallable() { /** * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   for (ScanRun element : webSecurityScannerClient.listScanRuns(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan resource name in the * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -518,6 +865,17 @@ public final ListScanRunsPagedResponse listScanRuns(ScanConfigName parent) { /** * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
+   *   for (ScanRun element : webSecurityScannerClient.listScanRuns(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan resource name in the * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -531,6 +889,22 @@ public final ListScanRunsPagedResponse listScanRuns(String parent) { /** * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanRunsRequest request =
+   *       ListScanRunsRequest.newBuilder()
+   *           .setParent(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (ScanRun element : webSecurityScannerClient.listScanRuns(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -543,6 +917,23 @@ public final ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request) * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanRunsRequest request =
+   *       ListScanRunsRequest.newBuilder()
+   *           .setParent(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listScanRunsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (ScanRun element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanRunsPagedCallable() { @@ -554,6 +945,24 @@ public final ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request) * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListScanRunsResponse response =
+   *         webSecurityScannerClient.listScanRunsCallable().call(request);
+   *     for (ScanRun element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanRunsCallable() { return stub.listScanRunsCallable(); @@ -563,6 +972,15 @@ public final UnaryCallable listScanRu /** * Stops a ScanRun. The stopped ScanRun is returned. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   ScanRun response = webSecurityScannerClient.stopScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanRun to be stopped. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -577,6 +995,15 @@ public final ScanRun stopScanRun(ScanRunName name) { /** * Stops a ScanRun. The stopped ScanRun is returned. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   ScanRun response = webSecurityScannerClient.stopScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanRun to be stopped. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -590,6 +1017,18 @@ public final ScanRun stopScanRun(String name) { /** * Stops a ScanRun. The stopped ScanRun is returned. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StopScanRunRequest request =
+   *       StopScanRunRequest.newBuilder()
+   *           .setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ScanRun response = webSecurityScannerClient.stopScanRun(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -602,6 +1041,19 @@ public final ScanRun stopScanRun(StopScanRunRequest request) { * Stops a ScanRun. The stopped ScanRun is returned. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StopScanRunRequest request =
+   *       StopScanRunRequest.newBuilder()
+   *           .setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.stopScanRunCallable().futureCall(request);
+   *   // Do something.
+   *   ScanRun response = future.get();
+   * }
+   * }
*/ public final UnaryCallable stopScanRunCallable() { return stub.stopScanRunCallable(); @@ -611,6 +1063,17 @@ public final UnaryCallable stopScanRunCallable() { /** * List CrawledUrls under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -627,6 +1090,17 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ScanRunName parent) { /** * List CrawledUrls under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -640,6 +1114,22 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(String parent) { /** * List CrawledUrls under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListCrawledUrlsRequest request =
+   *       ListCrawledUrlsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -652,6 +1142,23 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest * List CrawledUrls under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListCrawledUrlsRequest request =
+   *       ListCrawledUrlsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listCrawledUrlsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (CrawledUrl element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listCrawledUrlsPagedCallable() { @@ -663,6 +1170,24 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest * List CrawledUrls under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListCrawledUrlsResponse response =
+   *         webSecurityScannerClient.listCrawledUrlsCallable().call(request);
+   *     for (CrawledUrl element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listCrawledUrlsCallable() { @@ -673,6 +1198,15 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest /** * Gets a Finding. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   FindingName name = FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
+   *   Finding response = webSecurityScannerClient.getFinding(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the Finding to be returned. The name follows the * format of * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. @@ -688,6 +1222,16 @@ public final Finding getFinding(FindingName name) { /** * Gets a Finding. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name =
+   *       FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]").toString();
+   *   Finding response = webSecurityScannerClient.getFinding(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the Finding to be returned. The name follows the * format of * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. @@ -702,6 +1246,20 @@ public final Finding getFinding(String name) { /** * Gets a Finding. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetFindingRequest request =
+   *       GetFindingRequest.newBuilder()
+   *           .setName(
+   *               FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]")
+   *                   .toString())
+   *           .build();
+   *   Finding response = webSecurityScannerClient.getFinding(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -714,6 +1272,20 @@ public final Finding getFinding(GetFindingRequest request) { * Gets a Finding. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetFindingRequest request =
+   *       GetFindingRequest.newBuilder()
+   *           .setName(
+   *               FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = webSecurityScannerClient.getFindingCallable().futureCall(request);
+   *   // Do something.
+   *   Finding response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getFindingCallable() { return stub.getFindingCallable(); @@ -723,6 +1295,18 @@ public final UnaryCallable getFindingCallable() { /** * List Findings under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   String filter = "filter-1274492040";
+   *   for (Finding element : webSecurityScannerClient.listFindings(parent, filter).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @param filter Required. The filter expression. The expression must be in the format: @@ -743,6 +1327,18 @@ public final ListFindingsPagedResponse listFindings(ScanRunName parent, String f /** * List Findings under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   String filter = "filter-1274492040";
+   *   for (Finding element : webSecurityScannerClient.listFindings(parent, filter).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @param filter Required. The filter expression. The expression must be in the format: @@ -760,6 +1356,23 @@ public final ListFindingsPagedResponse listFindings(String parent, String filter /** * List Findings under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingsRequest request =
+   *       ListFindingsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (Finding element : webSecurityScannerClient.listFindings(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -772,6 +1385,24 @@ public final ListFindingsPagedResponse listFindings(ListFindingsRequest request) * List Findings under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingsRequest request =
+   *       ListFindingsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listFindingsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Finding element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listFindingsPagedCallable() { @@ -783,6 +1414,24 @@ public final ListFindingsPagedResponse listFindings(ListFindingsRequest request) * List Findings under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListFindingsResponse response =
+   *         webSecurityScannerClient.listFindingsCallable().call(request);
+   *     for (Finding element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listFindingsCallable() { return stub.listFindingsCallable(); @@ -792,6 +1441,15 @@ public final UnaryCallable listFindin /** * List all FindingTypeStats under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(parent);
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -808,6 +1466,15 @@ public final ListFindingTypeStatsResponse listFindingTypeStats(ScanRunName paren /** * List all FindingTypeStats under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(parent);
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -822,6 +1489,19 @@ public final ListFindingTypeStatsResponse listFindingTypeStats(String parent) { /** * List all FindingTypeStats under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingTypeStatsRequest request =
+   *       ListFindingTypeStatsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ListFindingTypeStatsResponse response =
+   *       webSecurityScannerClient.listFindingTypeStats(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -835,6 +1515,19 @@ public final ListFindingTypeStatsResponse listFindingTypeStats( * List all FindingTypeStats under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingTypeStatsRequest request =
+   *       ListFindingTypeStatsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listFindingTypeStatsCallable().futureCall(request);
+   *   // Do something.
+   *   ListFindingTypeStatsResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable listFindingTypeStatsCallable() { diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/package-info.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/package-info.java index 16c52f4b..3893293a 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/package-info.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/package-info.java @@ -24,6 +24,14 @@ * exercise as many user inputs and event handlers as possible. * *

Sample for WebSecurityScannerClient: + * + *

{@code
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ *   ProjectName parent = ProjectName.of("[PROJECT]");
+ *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+ *   ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.websecurityscanner.v1alpha; diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerClient.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerClient.java index c768203d..636abdd9 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerClient.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/WebSecurityScannerClient.java @@ -45,6 +45,14 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *

{@code
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ *   ProjectName parent = ProjectName.of("[PROJECT]");
+ *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+ *   ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
+ * }
+ * }
+ * *

Note: close() needs to be called on the WebSecurityScannerClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -152,6 +160,16 @@ public WebSecurityScannerStub getStub() { /** * Creates a new ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+   *   ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
+   * }
+   * }
+ * * @param parent Required. The parent resource name where the scan is created, which should be a * project resource name in the format 'projects/{projectId}'. * @param scanConfig Required. The ScanConfig to be created. @@ -170,6 +188,16 @@ public final ScanConfig createScanConfig(ProjectName parent, ScanConfig scanConf /** * Creates a new ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+   *   ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
+   * }
+   * }
+ * * @param parent Required. The parent resource name where the scan is created, which should be a * project resource name in the format 'projects/{projectId}'. * @param scanConfig Required. The ScanConfig to be created. @@ -185,6 +213,19 @@ public final ScanConfig createScanConfig(String parent, ScanConfig scanConfig) { /** * Creates a new ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   CreateScanConfigRequest request =
+   *       CreateScanConfigRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .build();
+   *   ScanConfig response = webSecurityScannerClient.createScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -197,6 +238,20 @@ public final ScanConfig createScanConfig(CreateScanConfigRequest request) { * Creates a new ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   CreateScanConfigRequest request =
+   *       CreateScanConfigRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.createScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ScanConfig response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createScanConfigCallable() { return stub.createScanConfigCallable(); @@ -206,6 +261,15 @@ public final UnaryCallable createScanConfig /** * Deletes an existing ScanConfig and its child resources. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   webSecurityScannerClient.deleteScanConfig(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be deleted. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -220,6 +284,15 @@ public final void deleteScanConfig(ScanConfigName name) { /** * Deletes an existing ScanConfig and its child resources. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
+   *   webSecurityScannerClient.deleteScanConfig(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be deleted. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -233,6 +306,18 @@ public final void deleteScanConfig(String name) { /** * Deletes an existing ScanConfig and its child resources. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   DeleteScanConfigRequest request =
+   *       DeleteScanConfigRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   webSecurityScannerClient.deleteScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -245,6 +330,19 @@ public final void deleteScanConfig(DeleteScanConfigRequest request) { * Deletes an existing ScanConfig and its child resources. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   DeleteScanConfigRequest request =
+   *       DeleteScanConfigRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.deleteScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteScanConfigCallable() { return stub.deleteScanConfigCallable(); @@ -254,6 +352,15 @@ public final UnaryCallable deleteScanConfigCalla /** * Gets a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanConfig response = webSecurityScannerClient.getScanConfig(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be returned. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -268,6 +375,15 @@ public final ScanConfig getScanConfig(ScanConfigName name) { /** * Gets a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
+   *   ScanConfig response = webSecurityScannerClient.getScanConfig(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be returned. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -281,6 +397,18 @@ public final ScanConfig getScanConfig(String name) { /** * Gets a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanConfigRequest request =
+   *       GetScanConfigRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ScanConfig response = webSecurityScannerClient.getScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -293,6 +421,19 @@ public final ScanConfig getScanConfig(GetScanConfigRequest request) { * Gets a ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanConfigRequest request =
+   *       GetScanConfigRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.getScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ScanConfig response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getScanConfigCallable() { return stub.getScanConfigCallable(); @@ -302,6 +443,17 @@ public final UnaryCallable getScanConfigCallab /** * Lists ScanConfigs under a given project. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (ScanConfig element : webSecurityScannerClient.listScanConfigs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a project resource name in * the format 'projects/{projectId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -318,6 +470,17 @@ public final ListScanConfigsPagedResponse listScanConfigs(ProjectName parent) { /** * Lists ScanConfigs under a given project. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   for (ScanConfig element : webSecurityScannerClient.listScanConfigs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a project resource name in * the format 'projects/{projectId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -331,6 +494,22 @@ public final ListScanConfigsPagedResponse listScanConfigs(String parent) { /** * Lists ScanConfigs under a given project. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanConfigsRequest request =
+   *       ListScanConfigsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (ScanConfig element : webSecurityScannerClient.listScanConfigs(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -343,6 +522,23 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest * Lists ScanConfigs under a given project. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanConfigsRequest request =
+   *       ListScanConfigsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listScanConfigsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (ScanConfig element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanConfigsPagedCallable() { @@ -354,6 +550,24 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest * Lists ScanConfigs under a given project. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListScanConfigsResponse response =
+   *         webSecurityScannerClient.listScanConfigsCallable().call(request);
+   *     for (ScanConfig element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanConfigsCallable() { @@ -364,6 +578,16 @@ public final ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest /** * Updates a ScanConfig. This method support partial update of a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   ScanConfig response = webSecurityScannerClient.updateScanConfig(scanConfig, updateMask);
+   * }
+   * }
+ * * @param scanConfig Required. The ScanConfig to be updated. The name field must be set to * identify the resource to be updated. The values of fields not covered by the mask will be * ignored. @@ -385,6 +609,19 @@ public final ScanConfig updateScanConfig(ScanConfig scanConfig, FieldMask update /** * Updates a ScanConfig. This method support partial update of a ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   UpdateScanConfigRequest request =
+   *       UpdateScanConfigRequest.newBuilder()
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ScanConfig response = webSecurityScannerClient.updateScanConfig(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -397,6 +634,20 @@ public final ScanConfig updateScanConfig(UpdateScanConfigRequest request) { * Updates a ScanConfig. This method support partial update of a ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   UpdateScanConfigRequest request =
+   *       UpdateScanConfigRequest.newBuilder()
+   *           .setScanConfig(ScanConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.updateScanConfigCallable().futureCall(request);
+   *   // Do something.
+   *   ScanConfig response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateScanConfigCallable() { return stub.updateScanConfigCallable(); @@ -406,6 +657,15 @@ public final UnaryCallable updateScanConfig /** * Start a ScanRun according to the given ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   ScanRun response = webSecurityScannerClient.startScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be used. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -420,6 +680,15 @@ public final ScanRun startScanRun(ScanConfigName name) { /** * Start a ScanRun according to the given ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
+   *   ScanRun response = webSecurityScannerClient.startScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanConfig to be used. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -433,6 +702,18 @@ public final ScanRun startScanRun(String name) { /** * Start a ScanRun according to the given ScanConfig. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StartScanRunRequest request =
+   *       StartScanRunRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ScanRun response = webSecurityScannerClient.startScanRun(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -445,6 +726,19 @@ public final ScanRun startScanRun(StartScanRunRequest request) { * Start a ScanRun according to the given ScanConfig. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StartScanRunRequest request =
+   *       StartScanRunRequest.newBuilder()
+   *           .setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.startScanRunCallable().futureCall(request);
+   *   // Do something.
+   *   ScanRun response = future.get();
+   * }
+   * }
*/ public final UnaryCallable startScanRunCallable() { return stub.startScanRunCallable(); @@ -454,6 +748,15 @@ public final UnaryCallable startScanRunCallable() /** * Gets a ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   ScanRun response = webSecurityScannerClient.getScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanRun to be returned. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -468,6 +771,15 @@ public final ScanRun getScanRun(ScanRunName name) { /** * Gets a ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   ScanRun response = webSecurityScannerClient.getScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanRun to be returned. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -481,6 +793,18 @@ public final ScanRun getScanRun(String name) { /** * Gets a ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanRunRequest request =
+   *       GetScanRunRequest.newBuilder()
+   *           .setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ScanRun response = webSecurityScannerClient.getScanRun(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -493,6 +817,18 @@ public final ScanRun getScanRun(GetScanRunRequest request) { * Gets a ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetScanRunRequest request =
+   *       GetScanRunRequest.newBuilder()
+   *           .setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ApiFuture future = webSecurityScannerClient.getScanRunCallable().futureCall(request);
+   *   // Do something.
+   *   ScanRun response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getScanRunCallable() { return stub.getScanRunCallable(); @@ -502,6 +838,17 @@ public final UnaryCallable getScanRunCallable() { /** * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
+   *   for (ScanRun element : webSecurityScannerClient.listScanRuns(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan resource name in the * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -518,6 +865,17 @@ public final ListScanRunsPagedResponse listScanRuns(ScanConfigName parent) { /** * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
+   *   for (ScanRun element : webSecurityScannerClient.listScanRuns(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan resource name in the * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -531,6 +889,22 @@ public final ListScanRunsPagedResponse listScanRuns(String parent) { /** * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanRunsRequest request =
+   *       ListScanRunsRequest.newBuilder()
+   *           .setParent(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (ScanRun element : webSecurityScannerClient.listScanRuns(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -543,6 +917,23 @@ public final ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request) * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListScanRunsRequest request =
+   *       ListScanRunsRequest.newBuilder()
+   *           .setParent(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listScanRunsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (ScanRun element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanRunsPagedCallable() { @@ -554,6 +945,24 @@ public final ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request) * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListScanRunsResponse response =
+   *         webSecurityScannerClient.listScanRunsCallable().call(request);
+   *     for (ScanRun element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listScanRunsCallable() { return stub.listScanRunsCallable(); @@ -563,6 +972,15 @@ public final UnaryCallable listScanRu /** * Stops a ScanRun. The stopped ScanRun is returned. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   ScanRun response = webSecurityScannerClient.stopScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanRun to be stopped. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -577,6 +995,15 @@ public final ScanRun stopScanRun(ScanRunName name) { /** * Stops a ScanRun. The stopped ScanRun is returned. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   ScanRun response = webSecurityScannerClient.stopScanRun(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the ScanRun to be stopped. The name follows the * format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -590,6 +1017,18 @@ public final ScanRun stopScanRun(String name) { /** * Stops a ScanRun. The stopped ScanRun is returned. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StopScanRunRequest request =
+   *       StopScanRunRequest.newBuilder()
+   *           .setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ScanRun response = webSecurityScannerClient.stopScanRun(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -602,6 +1041,19 @@ public final ScanRun stopScanRun(StopScanRunRequest request) { * Stops a ScanRun. The stopped ScanRun is returned. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   StopScanRunRequest request =
+   *       StopScanRunRequest.newBuilder()
+   *           .setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.stopScanRunCallable().futureCall(request);
+   *   // Do something.
+   *   ScanRun response = future.get();
+   * }
+   * }
*/ public final UnaryCallable stopScanRunCallable() { return stub.stopScanRunCallable(); @@ -611,6 +1063,17 @@ public final UnaryCallable stopScanRunCallable() { /** * List CrawledUrls under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -627,6 +1090,17 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ScanRunName parent) { /** * List CrawledUrls under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -640,6 +1114,22 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(String parent) { /** * List CrawledUrls under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListCrawledUrlsRequest request =
+   *       ListCrawledUrlsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -652,6 +1142,23 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest * List CrawledUrls under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListCrawledUrlsRequest request =
+   *       ListCrawledUrlsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listCrawledUrlsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (CrawledUrl element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listCrawledUrlsPagedCallable() { @@ -663,6 +1170,24 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest * List CrawledUrls under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListCrawledUrlsResponse response =
+   *         webSecurityScannerClient.listCrawledUrlsCallable().call(request);
+   *     for (CrawledUrl element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listCrawledUrlsCallable() { @@ -673,6 +1198,15 @@ public final ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest /** * Gets a Finding. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   FindingName name = FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
+   *   Finding response = webSecurityScannerClient.getFinding(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the Finding to be returned. The name follows the * format of * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. @@ -688,6 +1222,16 @@ public final Finding getFinding(FindingName name) { /** * Gets a Finding. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String name =
+   *       FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]").toString();
+   *   Finding response = webSecurityScannerClient.getFinding(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the Finding to be returned. The name follows the * format of * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. @@ -702,6 +1246,20 @@ public final Finding getFinding(String name) { /** * Gets a Finding. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetFindingRequest request =
+   *       GetFindingRequest.newBuilder()
+   *           .setName(
+   *               FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]")
+   *                   .toString())
+   *           .build();
+   *   Finding response = webSecurityScannerClient.getFinding(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -714,6 +1272,20 @@ public final Finding getFinding(GetFindingRequest request) { * Gets a Finding. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   GetFindingRequest request =
+   *       GetFindingRequest.newBuilder()
+   *           .setName(
+   *               FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = webSecurityScannerClient.getFindingCallable().futureCall(request);
+   *   // Do something.
+   *   Finding response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getFindingCallable() { return stub.getFindingCallable(); @@ -723,6 +1295,18 @@ public final UnaryCallable getFindingCallable() { /** * List Findings under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   String filter = "filter-1274492040";
+   *   for (Finding element : webSecurityScannerClient.listFindings(parent, filter).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @param filter Required. The filter expression. The expression must be in the format: @@ -743,6 +1327,18 @@ public final ListFindingsPagedResponse listFindings(ScanRunName parent, String f /** * List Findings under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   String filter = "filter-1274492040";
+   *   for (Finding element : webSecurityScannerClient.listFindings(parent, filter).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @param filter Required. The filter expression. The expression must be in the format: @@ -760,6 +1356,23 @@ public final ListFindingsPagedResponse listFindings(String parent, String filter /** * List Findings under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingsRequest request =
+   *       ListFindingsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   for (Finding element : webSecurityScannerClient.listFindings(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -772,6 +1385,24 @@ public final ListFindingsPagedResponse listFindings(ListFindingsRequest request) * List Findings under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingsRequest request =
+   *       ListFindingsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setPageToken("pageToken873572522")
+   *           .setPageSize(883849137)
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listFindingsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Finding element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listFindingsPagedCallable() { @@ -783,6 +1414,24 @@ public final ListFindingsPagedResponse listFindings(ListFindingsRequest request) * List Findings under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   while (true) {
+   *     ListFindingsResponse response =
+   *         webSecurityScannerClient.listFindingsCallable().call(request);
+   *     for (Finding element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listFindingsCallable() { return stub.listFindingsCallable(); @@ -792,6 +1441,15 @@ public final UnaryCallable listFindin /** * List all FindingTypeStats under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
+   *   ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(parent);
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -808,6 +1466,15 @@ public final ListFindingTypeStatsResponse listFindingTypeStats(ScanRunName paren /** * List all FindingTypeStats under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   String parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
+   *   ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(parent);
+   * }
+   * }
+ * * @param parent Required. The parent resource name, which should be a scan run resource name in * the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -822,6 +1489,19 @@ public final ListFindingTypeStatsResponse listFindingTypeStats(String parent) { /** * List all FindingTypeStats under a given ScanRun. * + *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingTypeStatsRequest request =
+   *       ListFindingTypeStatsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ListFindingTypeStatsResponse response =
+   *       webSecurityScannerClient.listFindingTypeStats(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -835,6 +1515,19 @@ public final ListFindingTypeStatsResponse listFindingTypeStats( * List all FindingTypeStats under a given ScanRun. * *

Sample code: + * + *

{@code
+   * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+   *   ListFindingTypeStatsRequest request =
+   *       ListFindingTypeStatsRequest.newBuilder()
+   *           .setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       webSecurityScannerClient.listFindingTypeStatsCallable().futureCall(request);
+   *   // Do something.
+   *   ListFindingTypeStatsResponse response = future.get();
+   * }
+   * }
*/ public final UnaryCallable listFindingTypeStatsCallable() { diff --git a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/package-info.java b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/package-info.java index 21d5fea1..20e18b89 100644 --- a/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/package-info.java +++ b/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1beta/package-info.java @@ -24,6 +24,14 @@ * exercise as many user inputs and event handlers as possible. * *

Sample for WebSecurityScannerClient: + * + *

{@code
+ * try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
+ *   ProjectName parent = ProjectName.of("[PROJECT]");
+ *   ScanConfig scanConfig = ScanConfig.newBuilder().build();
+ *   ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.websecurityscanner.v1beta; diff --git a/synth.metadata b/synth.metadata index cf75aafb..e73313c8 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,24 +11,24 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {