@BetaApi @Generated(value="by gapic-generator-java") public class WebSecurityScannerClient extends Object implements BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of WebSecurityScannerSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
WebSecurityScannerSettings webSecurityScannerSettings =
WebSecurityScannerSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
WebSecurityScannerClient webSecurityScannerClient =
WebSecurityScannerClient.create(webSecurityScannerSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
WebSecurityScannerSettings webSecurityScannerSettings =
WebSecurityScannerSettings.newBuilder().setEndpoint(myEndpoint).build();
WebSecurityScannerClient webSecurityScannerClient =
WebSecurityScannerClient.create(webSecurityScannerSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
WebSecurityScannerSettings webSecurityScannerSettings =
WebSecurityScannerSettings.newBuilder()
.setTransportChannelProvider(
WebSecurityScannerSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
WebSecurityScannerClient webSecurityScannerClient =
WebSecurityScannerClient.create(webSecurityScannerSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Modifier and Type | Class and Description |
---|---|
static class |
WebSecurityScannerClient.ListCrawledUrlsFixedSizeCollection |
static class |
WebSecurityScannerClient.ListCrawledUrlsPage |
static class |
WebSecurityScannerClient.ListCrawledUrlsPagedResponse |
static class |
WebSecurityScannerClient.ListFindingsFixedSizeCollection |
static class |
WebSecurityScannerClient.ListFindingsPage |
static class |
WebSecurityScannerClient.ListFindingsPagedResponse |
static class |
WebSecurityScannerClient.ListScanConfigsFixedSizeCollection |
static class |
WebSecurityScannerClient.ListScanConfigsPage |
static class |
WebSecurityScannerClient.ListScanConfigsPagedResponse |
static class |
WebSecurityScannerClient.ListScanRunsFixedSizeCollection |
static class |
WebSecurityScannerClient.ListScanRunsPage |
static class |
WebSecurityScannerClient.ListScanRunsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
WebSecurityScannerClient(WebSecurityScannerSettings settings)
Constructs an instance of WebSecurityScannerClient, using the given settings.
|
protected |
WebSecurityScannerClient(WebSecurityScannerStub stub) |
protected WebSecurityScannerClient(WebSecurityScannerSettings settings) throws IOException
IOException
protected WebSecurityScannerClient(WebSecurityScannerStub stub)
public static final WebSecurityScannerClient create() throws IOException
IOException
public static final WebSecurityScannerClient create(WebSecurityScannerSettings settings) throws IOException
IOException
public static final WebSecurityScannerClient create(WebSecurityScannerStub stub)
public final WebSecurityScannerSettings getSettings()
public WebSecurityScannerStub getStub()
public final ScanConfig createScanConfig(ProjectName parent, ScanConfig scanConfig)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ScanConfig scanConfig = ScanConfig.newBuilder().build();
ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
}
parent
- Required. The parent resource name where the scan is created, which should be a
project resource name in the format 'projects/{projectId}'.scanConfig
- Required. The ScanConfig to be created.ApiException
- if the remote call failspublic final ScanConfig createScanConfig(String parent, ScanConfig scanConfig)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
ScanConfig scanConfig = ScanConfig.newBuilder().build();
ScanConfig response = webSecurityScannerClient.createScanConfig(parent, scanConfig);
}
parent
- Required. The parent resource name where the scan is created, which should be a
project resource name in the format 'projects/{projectId}'.scanConfig
- Required. The ScanConfig to be created.ApiException
- if the remote call failspublic final ScanConfig createScanConfig(CreateScanConfigRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
CreateScanConfigRequest request =
CreateScanConfigRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setScanConfig(ScanConfig.newBuilder().build())
.build();
ScanConfig response = webSecurityScannerClient.createScanConfig(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<CreateScanConfigRequest,ScanConfig> createScanConfigCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
CreateScanConfigRequest request =
CreateScanConfigRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setScanConfig(ScanConfig.newBuilder().build())
.build();
ApiFuture<ScanConfig> future =
webSecurityScannerClient.createScanConfigCallable().futureCall(request);
// Do something.
ScanConfig response = future.get();
}
public final void deleteScanConfig(ScanConfigName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
webSecurityScannerClient.deleteScanConfig(name);
}
name
- Required. The resource name of the ScanConfig to be deleted. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.ApiException
- if the remote call failspublic final void deleteScanConfig(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
webSecurityScannerClient.deleteScanConfig(name);
}
name
- Required. The resource name of the ScanConfig to be deleted. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.ApiException
- if the remote call failspublic final void deleteScanConfig(DeleteScanConfigRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
DeleteScanConfigRequest request =
DeleteScanConfigRequest.newBuilder()
.setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
.build();
webSecurityScannerClient.deleteScanConfig(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<DeleteScanConfigRequest,Empty> deleteScanConfigCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
DeleteScanConfigRequest request =
DeleteScanConfigRequest.newBuilder()
.setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
.build();
ApiFuture<Empty> future =
webSecurityScannerClient.deleteScanConfigCallable().futureCall(request);
// Do something.
future.get();
}
public final ScanConfig getScanConfig(ScanConfigName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
ScanConfig response = webSecurityScannerClient.getScanConfig(name);
}
name
- Required. The resource name of the ScanConfig to be returned. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.ApiException
- if the remote call failspublic final ScanConfig getScanConfig(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
ScanConfig response = webSecurityScannerClient.getScanConfig(name);
}
name
- Required. The resource name of the ScanConfig to be returned. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.ApiException
- if the remote call failspublic final ScanConfig getScanConfig(GetScanConfigRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
GetScanConfigRequest request =
GetScanConfigRequest.newBuilder()
.setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
.build();
ScanConfig response = webSecurityScannerClient.getScanConfig(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetScanConfigRequest,ScanConfig> getScanConfigCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
GetScanConfigRequest request =
GetScanConfigRequest.newBuilder()
.setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
.build();
ApiFuture<ScanConfig> future =
webSecurityScannerClient.getScanConfigCallable().futureCall(request);
// Do something.
ScanConfig response = future.get();
}
public final WebSecurityScannerClient.ListScanConfigsPagedResponse listScanConfigs(ProjectName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
for (ScanConfig element : webSecurityScannerClient.listScanConfigs(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent resource name, which should be a project resource name in
the format 'projects/{projectId}'.ApiException
- if the remote call failspublic final WebSecurityScannerClient.ListScanConfigsPagedResponse listScanConfigs(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
for (ScanConfig element : webSecurityScannerClient.listScanConfigs(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent resource name, which should be a project resource name in
the format 'projects/{projectId}'.ApiException
- if the remote call failspublic final WebSecurityScannerClient.ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListScanConfigsRequest,WebSecurityScannerClient.ListScanConfigsPagedResponse> listScanConfigsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ListScanConfigsRequest request =
ListScanConfigsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<ScanConfig> future =
webSecurityScannerClient.listScanConfigsPagedCallable().futureCall(request);
// Do something.
for (ScanConfig element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListScanConfigsRequest,ListScanConfigsResponse> listScanConfigsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ListScanConfigsRequest request =
ListScanConfigsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while (true) {
ListScanConfigsResponse response =
webSecurityScannerClient.listScanConfigsCallable().call(request);
for (ScanConfig element : response.getScanConfigsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final ScanConfig updateScanConfig(ScanConfig scanConfig, FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanConfig scanConfig = ScanConfig.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
ScanConfig response = webSecurityScannerClient.updateScanConfig(scanConfig, updateMask);
}
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.updateMask
- Required. The update mask applies to the resource. For the `FieldMask`
definition, see
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmaskApiException
- if the remote call failspublic final ScanConfig updateScanConfig(UpdateScanConfigRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
UpdateScanConfigRequest request =
UpdateScanConfigRequest.newBuilder()
.setScanConfig(ScanConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ScanConfig response = webSecurityScannerClient.updateScanConfig(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<UpdateScanConfigRequest,ScanConfig> updateScanConfigCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
UpdateScanConfigRequest request =
UpdateScanConfigRequest.newBuilder()
.setScanConfig(ScanConfig.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<ScanConfig> future =
webSecurityScannerClient.updateScanConfigCallable().futureCall(request);
// Do something.
ScanConfig response = future.get();
}
public final ScanRun startScanRun(ScanConfigName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
ScanRun response = webSecurityScannerClient.startScanRun(name);
}
name
- Required. The resource name of the ScanConfig to be used. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.ApiException
- if the remote call failspublic final ScanRun startScanRun(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
ScanRun response = webSecurityScannerClient.startScanRun(name);
}
name
- Required. The resource name of the ScanConfig to be used. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.ApiException
- if the remote call failspublic final ScanRun startScanRun(StartScanRunRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
StartScanRunRequest request =
StartScanRunRequest.newBuilder()
.setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
.build();
ScanRun response = webSecurityScannerClient.startScanRun(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<StartScanRunRequest,ScanRun> startScanRunCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
StartScanRunRequest request =
StartScanRunRequest.newBuilder()
.setName(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
.build();
ApiFuture<ScanRun> future =
webSecurityScannerClient.startScanRunCallable().futureCall(request);
// Do something.
ScanRun response = future.get();
}
public final ScanRun getScanRun(ScanRunName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
ScanRun response = webSecurityScannerClient.getScanRun(name);
}
name
- Required. The resource name of the ScanRun to be returned. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.ApiException
- if the remote call failspublic final ScanRun getScanRun(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
ScanRun response = webSecurityScannerClient.getScanRun(name);
}
name
- Required. The resource name of the ScanRun to be returned. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.ApiException
- if the remote call failspublic final ScanRun getScanRun(GetScanRunRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
GetScanRunRequest request =
GetScanRunRequest.newBuilder()
.setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
.build();
ScanRun response = webSecurityScannerClient.getScanRun(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetScanRunRequest,ScanRun> getScanRunCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
GetScanRunRequest request =
GetScanRunRequest.newBuilder()
.setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
.build();
ApiFuture<ScanRun> future = webSecurityScannerClient.getScanRunCallable().futureCall(request);
// Do something.
ScanRun response = future.get();
}
public final WebSecurityScannerClient.ListScanRunsPagedResponse listScanRuns(ScanConfigName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanConfigName parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]");
for (ScanRun element : webSecurityScannerClient.listScanRuns(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent resource name, which should be a scan resource name in the
format 'projects/{projectId}/scanConfigs/{scanConfigId}'.ApiException
- if the remote call failspublic final WebSecurityScannerClient.ListScanRunsPagedResponse listScanRuns(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String parent = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString();
for (ScanRun element : webSecurityScannerClient.listScanRuns(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent resource name, which should be a scan resource name in the
format 'projects/{projectId}/scanConfigs/{scanConfigId}'.ApiException
- if the remote call failspublic final WebSecurityScannerClient.ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListScanRunsRequest,WebSecurityScannerClient.ListScanRunsPagedResponse> listScanRunsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ListScanRunsRequest request =
ListScanRunsRequest.newBuilder()
.setParent(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<ScanRun> future =
webSecurityScannerClient.listScanRunsPagedCallable().futureCall(request);
// Do something.
for (ScanRun element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListScanRunsRequest,ListScanRunsResponse> listScanRunsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ListScanRunsRequest request =
ListScanRunsRequest.newBuilder()
.setParent(ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while (true) {
ListScanRunsResponse response =
webSecurityScannerClient.listScanRunsCallable().call(request);
for (ScanRun element : response.getScanRunsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final ScanRun stopScanRun(ScanRunName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanRunName name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
ScanRun response = webSecurityScannerClient.stopScanRun(name);
}
name
- Required. The resource name of the ScanRun to be stopped. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.ApiException
- if the remote call failspublic final ScanRun stopScanRun(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String name = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
ScanRun response = webSecurityScannerClient.stopScanRun(name);
}
name
- Required. The resource name of the ScanRun to be stopped. The name follows the
format of 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.ApiException
- if the remote call failspublic final ScanRun stopScanRun(StopScanRunRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
StopScanRunRequest request =
StopScanRunRequest.newBuilder()
.setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
.build();
ScanRun response = webSecurityScannerClient.stopScanRun(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<StopScanRunRequest,ScanRun> stopScanRunCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
StopScanRunRequest request =
StopScanRunRequest.newBuilder()
.setName(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
.build();
ApiFuture<ScanRun> future =
webSecurityScannerClient.stopScanRunCallable().futureCall(request);
// Do something.
ScanRun response = future.get();
}
public final WebSecurityScannerClient.ListCrawledUrlsPagedResponse listCrawledUrls(ScanRunName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent resource name, which should be a scan run resource name in
the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.ApiException
- if the remote call failspublic final WebSecurityScannerClient.ListCrawledUrlsPagedResponse listCrawledUrls(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
for (CrawledUrl element : webSecurityScannerClient.listCrawledUrls(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. The parent resource name, which should be a scan run resource name in
the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.ApiException
- if the remote call failspublic final WebSecurityScannerClient.ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListCrawledUrlsRequest,WebSecurityScannerClient.ListCrawledUrlsPagedResponse> listCrawledUrlsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ListCrawledUrlsRequest request =
ListCrawledUrlsRequest.newBuilder()
.setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<CrawledUrl> future =
webSecurityScannerClient.listCrawledUrlsPagedCallable().futureCall(request);
// Do something.
for (CrawledUrl element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListCrawledUrlsRequest,ListCrawledUrlsResponse> listCrawledUrlsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ListCrawledUrlsRequest request =
ListCrawledUrlsRequest.newBuilder()
.setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while (true) {
ListCrawledUrlsResponse response =
webSecurityScannerClient.listCrawledUrlsCallable().call(request);
for (CrawledUrl element : response.getCrawledUrlsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Finding getFinding(FindingName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
FindingName name = FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]");
Finding response = webSecurityScannerClient.getFinding(name);
}
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}'.ApiException
- if the remote call failspublic final Finding getFinding(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String name =
FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]").toString();
Finding response = webSecurityScannerClient.getFinding(name);
}
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}'.ApiException
- if the remote call failspublic final Finding getFinding(GetFindingRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
GetFindingRequest request =
GetFindingRequest.newBuilder()
.setName(
FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]")
.toString())
.build();
Finding response = webSecurityScannerClient.getFinding(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetFindingRequest,Finding> getFindingCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
GetFindingRequest request =
GetFindingRequest.newBuilder()
.setName(
FindingName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]", "[FINDING]")
.toString())
.build();
ApiFuture<Finding> future = webSecurityScannerClient.getFindingCallable().futureCall(request);
// Do something.
Finding response = future.get();
}
public final WebSecurityScannerClient.ListFindingsPagedResponse listFindings(ScanRunName parent, String filter)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
parent
- Required. The parent resource name, which should be a scan run resource name in
the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.filter
- Required. The filter expression. The expression must be in the format:
<field> <operator> <value>. Supported field: 'finding_type'. Supported
operator: '='.ApiException
- if the remote call failspublic final WebSecurityScannerClient.ListFindingsPagedResponse listFindings(String parent, String filter)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
parent
- Required. The parent resource name, which should be a scan run resource name in
the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.filter
- Required. The filter expression. The expression must be in the format:
<field> <operator> <value>. Supported field: 'finding_type'. Supported
operator: '='.ApiException
- if the remote call failspublic final WebSecurityScannerClient.ListFindingsPagedResponse listFindings(ListFindingsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListFindingsRequest,WebSecurityScannerClient.ListFindingsPagedResponse> listFindingsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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<Finding> future =
webSecurityScannerClient.listFindingsPagedCallable().futureCall(request);
// Do something.
for (Finding element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListFindingsRequest,ListFindingsResponse> listFindingsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (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();
while (true) {
ListFindingsResponse response =
webSecurityScannerClient.listFindingsCallable().call(request);
for (Finding element : response.getFindingsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final ListFindingTypeStatsResponse listFindingTypeStats(ScanRunName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(parent);
}
parent
- Required. The parent resource name, which should be a scan run resource name in
the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.ApiException
- if the remote call failspublic final ListFindingTypeStatsResponse listFindingTypeStats(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
String parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString();
ListFindingTypeStatsResponse response = webSecurityScannerClient.listFindingTypeStats(parent);
}
parent
- Required. The parent resource name, which should be a scan run resource name in
the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.ApiException
- if the remote call failspublic final ListFindingTypeStatsResponse listFindingTypeStats(ListFindingTypeStatsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ListFindingTypeStatsRequest request =
ListFindingTypeStatsRequest.newBuilder()
.setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
.build();
ListFindingTypeStatsResponse response =
webSecurityScannerClient.listFindingTypeStats(request);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListFindingTypeStatsRequest,ListFindingTypeStatsResponse> listFindingTypeStatsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ListFindingTypeStatsRequest request =
ListFindingTypeStatsRequest.newBuilder()
.setParent(ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]").toString())
.build();
ApiFuture<ListFindingTypeStatsResponse> future =
webSecurityScannerClient.listFindingTypeStatsCallable().futureCall(request);
// Do something.
ListFindingTypeStatsResponse response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2022 Google LLC. All rights reserved.