Class WebSecurityScannerClient (2.2.1)

public class WebSecurityScannerClient implements BackgroundResource

Service Description: Web Security Scanner Service identifies security vulnerabilities in web applications hosted on Google Cloud. It crawls your application, and attempts to exercise as many user inputs and event handlers as possible.

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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 WebSecurityScannerSettings webSecurityScannerSettings =
     WebSecurityScannerSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 WebSecurityScannerClient webSecurityScannerClient =
     WebSecurityScannerClient.create(webSecurityScannerSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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.

Inheritance

java.lang.Object > WebSecurityScannerClient

Implements

BackgroundResource

Static Methods

create()

public static final WebSecurityScannerClient create()

Constructs an instance of WebSecurityScannerClient with default settings.

Returns
TypeDescription
WebSecurityScannerClient
Exceptions
TypeDescription
IOException

create(WebSecurityScannerSettings settings)

public static final WebSecurityScannerClient create(WebSecurityScannerSettings settings)

Constructs an instance of WebSecurityScannerClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsWebSecurityScannerSettings
Returns
TypeDescription
WebSecurityScannerClient
Exceptions
TypeDescription
IOException

create(WebSecurityScannerStub stub)

public static final WebSecurityScannerClient create(WebSecurityScannerStub stub)

Constructs an instance of WebSecurityScannerClient, using the given stub for making calls. This is for advanced usage - prefer using create(WebSecurityScannerSettings).

Parameter
NameDescription
stubWebSecurityScannerStub
Returns
TypeDescription
WebSecurityScannerClient

Constructors

WebSecurityScannerClient(WebSecurityScannerSettings settings)

protected WebSecurityScannerClient(WebSecurityScannerSettings settings)

Constructs an instance of WebSecurityScannerClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsWebSecurityScannerSettings

WebSecurityScannerClient(WebSecurityScannerStub stub)

protected WebSecurityScannerClient(WebSecurityScannerStub stub)
Parameter
NameDescription
stubWebSecurityScannerStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createScanConfig(CreateScanConfigRequest request)

public final ScanConfig createScanConfig(CreateScanConfigRequest request)

Creates a new ScanConfig.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   CreateScanConfigRequest request =
       CreateScanConfigRequest.newBuilder()
           .setParent("parent-995424086")
           .setScanConfig(ScanConfig.newBuilder().build())
           .build();
   ScanConfig response = webSecurityScannerClient.createScanConfig(request);
 }
 
Parameter
NameDescription
requestCreateScanConfigRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ScanConfig

createScanConfigCallable()

public final UnaryCallable<CreateScanConfigRequest,ScanConfig> createScanConfigCallable()

Creates a new ScanConfig.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   CreateScanConfigRequest request =
       CreateScanConfigRequest.newBuilder()
           .setParent("parent-995424086")
           .setScanConfig(ScanConfig.newBuilder().build())
           .build();
   ApiFuture<ScanConfig> future =
       webSecurityScannerClient.createScanConfigCallable().futureCall(request);
   // Do something.
   ScanConfig response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateScanConfigRequest,ScanConfig>

deleteScanConfig(DeleteScanConfigRequest request)

public final void deleteScanConfig(DeleteScanConfigRequest request)

Deletes an existing ScanConfig and its child resources.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   DeleteScanConfigRequest request =
       DeleteScanConfigRequest.newBuilder().setName("name3373707").build();
   webSecurityScannerClient.deleteScanConfig(request);
 }
 
Parameter
NameDescription
requestDeleteScanConfigRequest

The request object containing all of the parameters for the API call.

deleteScanConfigCallable()

public final UnaryCallable<DeleteScanConfigRequest,Empty> deleteScanConfigCallable()

Deletes an existing ScanConfig and its child resources.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   DeleteScanConfigRequest request =
       DeleteScanConfigRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Empty> future =
       webSecurityScannerClient.deleteScanConfigCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteScanConfigRequest,Empty>

getFinding(GetFindingRequest request)

public final Finding getFinding(GetFindingRequest request)

Gets a Finding.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   GetFindingRequest request = GetFindingRequest.newBuilder().setName("name3373707").build();
   Finding response = webSecurityScannerClient.getFinding(request);
 }
 
Parameter
NameDescription
requestGetFindingRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Finding

getFindingCallable()

public final UnaryCallable<GetFindingRequest,Finding> getFindingCallable()

Gets a Finding.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   GetFindingRequest request = GetFindingRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Finding> future = webSecurityScannerClient.getFindingCallable().futureCall(request);
   // Do something.
   Finding response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetFindingRequest,Finding>

getScanConfig(GetScanConfigRequest request)

public final ScanConfig getScanConfig(GetScanConfigRequest request)

Gets a ScanConfig.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   GetScanConfigRequest request =
       GetScanConfigRequest.newBuilder().setName("name3373707").build();
   ScanConfig response = webSecurityScannerClient.getScanConfig(request);
 }
 
Parameter
NameDescription
requestGetScanConfigRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ScanConfig

getScanConfigCallable()

public final UnaryCallable<GetScanConfigRequest,ScanConfig> getScanConfigCallable()

Gets a ScanConfig.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   GetScanConfigRequest request =
       GetScanConfigRequest.newBuilder().setName("name3373707").build();
   ApiFuture<ScanConfig> future =
       webSecurityScannerClient.getScanConfigCallable().futureCall(request);
   // Do something.
   ScanConfig response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetScanConfigRequest,ScanConfig>

getScanRun(GetScanRunRequest request)

public final ScanRun getScanRun(GetScanRunRequest request)

Gets a ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   GetScanRunRequest request = GetScanRunRequest.newBuilder().setName("name3373707").build();
   ScanRun response = webSecurityScannerClient.getScanRun(request);
 }
 
Parameter
NameDescription
requestGetScanRunRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ScanRun

getScanRunCallable()

public final UnaryCallable<GetScanRunRequest,ScanRun> getScanRunCallable()

Gets a ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   GetScanRunRequest request = GetScanRunRequest.newBuilder().setName("name3373707").build();
   ApiFuture<ScanRun> future = webSecurityScannerClient.getScanRunCallable().futureCall(request);
   // Do something.
   ScanRun response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetScanRunRequest,ScanRun>

getSettings()

public final WebSecurityScannerSettings getSettings()
Returns
TypeDescription
WebSecurityScannerSettings

getStub()

public WebSecurityScannerStub getStub()
Returns
TypeDescription
WebSecurityScannerStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listCrawledUrls(ListCrawledUrlsRequest request)

public final WebSecurityScannerClient.ListCrawledUrlsPagedResponse listCrawledUrls(ListCrawledUrlsRequest request)

List CrawledUrls under a given ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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);
   }
 }
 
Parameter
NameDescription
requestListCrawledUrlsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
WebSecurityScannerClient.ListCrawledUrlsPagedResponse

listCrawledUrlsCallable()

public final UnaryCallable<ListCrawledUrlsRequest,ListCrawledUrlsResponse> listCrawledUrlsCallable()

List CrawledUrls under a given ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListCrawledUrlsRequest request =
       ListCrawledUrlsRequest.newBuilder()
           .setParent("parent-995424086")
           .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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListCrawledUrlsRequest,ListCrawledUrlsResponse>

listCrawledUrlsPagedCallable()

public final UnaryCallable<ListCrawledUrlsRequest,WebSecurityScannerClient.ListCrawledUrlsPagedResponse> listCrawledUrlsPagedCallable()

List CrawledUrls under a given ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListCrawledUrlsRequest request =
       ListCrawledUrlsRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageToken("pageToken873572522")
           .setPageSize(883849137)
           .build();
   ApiFuture<CrawledUrl> future =
       webSecurityScannerClient.listCrawledUrlsPagedCallable().futureCall(request);
   // Do something.
   for (CrawledUrl element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListCrawledUrlsRequest,ListCrawledUrlsPagedResponse>

listFindingTypeStats(ListFindingTypeStatsRequest request)

public final ListFindingTypeStatsResponse listFindingTypeStats(ListFindingTypeStatsRequest request)

List all FindingTypeStats under a given ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListFindingTypeStatsRequest request =
       ListFindingTypeStatsRequest.newBuilder().setParent("parent-995424086").build();
   ListFindingTypeStatsResponse response =
       webSecurityScannerClient.listFindingTypeStats(request);
 }
 
Parameter
NameDescription
requestListFindingTypeStatsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ListFindingTypeStatsResponse

listFindingTypeStatsCallable()

public final UnaryCallable<ListFindingTypeStatsRequest,ListFindingTypeStatsResponse> listFindingTypeStatsCallable()

List all FindingTypeStats under a given ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListFindingTypeStatsRequest request =
       ListFindingTypeStatsRequest.newBuilder().setParent("parent-995424086").build();
   ApiFuture<ListFindingTypeStatsResponse> future =
       webSecurityScannerClient.listFindingTypeStatsCallable().futureCall(request);
   // Do something.
   ListFindingTypeStatsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ListFindingTypeStatsRequest,ListFindingTypeStatsResponse>

listFindings(ListFindingsRequest request)

public final WebSecurityScannerClient.ListFindingsPagedResponse listFindings(ListFindingsRequest request)

List Findings under a given ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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);
   }
 }
 
Parameter
NameDescription
requestListFindingsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
WebSecurityScannerClient.ListFindingsPagedResponse

listFindingsCallable()

public final UnaryCallable<ListFindingsRequest,ListFindingsResponse> listFindingsCallable()

List Findings under a given ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListFindingsRequest request =
       ListFindingsRequest.newBuilder()
           .setParent("parent-995424086")
           .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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListFindingsRequest,ListFindingsResponse>

listFindingsPagedCallable()

public final UnaryCallable<ListFindingsRequest,WebSecurityScannerClient.ListFindingsPagedResponse> listFindingsPagedCallable()

List Findings under a given ScanRun.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListFindingsRequest request =
       ListFindingsRequest.newBuilder()
           .setParent("parent-995424086")
           .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);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListFindingsRequest,ListFindingsPagedResponse>

listScanConfigs(ListScanConfigsRequest request)

public final WebSecurityScannerClient.ListScanConfigsPagedResponse listScanConfigs(ListScanConfigsRequest request)

Lists ScanConfigs under a given project.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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);
   }
 }
 
Parameter
NameDescription
requestListScanConfigsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
WebSecurityScannerClient.ListScanConfigsPagedResponse

listScanConfigsCallable()

public final UnaryCallable<ListScanConfigsRequest,ListScanConfigsResponse> listScanConfigsCallable()

Lists ScanConfigs under a given project.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListScanConfigsRequest request =
       ListScanConfigsRequest.newBuilder()
           .setParent("parent-995424086")
           .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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListScanConfigsRequest,ListScanConfigsResponse>

listScanConfigsPagedCallable()

public final UnaryCallable<ListScanConfigsRequest,WebSecurityScannerClient.ListScanConfigsPagedResponse> listScanConfigsPagedCallable()

Lists ScanConfigs under a given project.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListScanConfigsRequest request =
       ListScanConfigsRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageToken("pageToken873572522")
           .setPageSize(883849137)
           .build();
   ApiFuture<ScanConfig> future =
       webSecurityScannerClient.listScanConfigsPagedCallable().futureCall(request);
   // Do something.
   for (ScanConfig element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListScanConfigsRequest,ListScanConfigsPagedResponse>

listScanRuns(ListScanRunsRequest request)

public final WebSecurityScannerClient.ListScanRunsPagedResponse listScanRuns(ListScanRunsRequest request)

Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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);
   }
 }
 
Parameter
NameDescription
requestListScanRunsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
WebSecurityScannerClient.ListScanRunsPagedResponse

listScanRunsCallable()

public final UnaryCallable<ListScanRunsRequest,ListScanRunsResponse> listScanRunsCallable()

Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListScanRunsRequest request =
       ListScanRunsRequest.newBuilder()
           .setParent("parent-995424086")
           .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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListScanRunsRequest,ListScanRunsResponse>

listScanRunsPagedCallable()

public final UnaryCallable<ListScanRunsRequest,WebSecurityScannerClient.ListScanRunsPagedResponse> listScanRunsPagedCallable()

Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   ListScanRunsRequest request =
       ListScanRunsRequest.newBuilder()
           .setParent("parent-995424086")
           .setPageToken("pageToken873572522")
           .setPageSize(883849137)
           .build();
   ApiFuture<ScanRun> future =
       webSecurityScannerClient.listScanRunsPagedCallable().futureCall(request);
   // Do something.
   for (ScanRun element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListScanRunsRequest,ListScanRunsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

startScanRun(StartScanRunRequest request)

public final ScanRun startScanRun(StartScanRunRequest request)

Start a ScanRun according to the given ScanConfig.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   StartScanRunRequest request = StartScanRunRequest.newBuilder().setName("name3373707").build();
   ScanRun response = webSecurityScannerClient.startScanRun(request);
 }
 
Parameter
NameDescription
requestStartScanRunRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ScanRun

startScanRunCallable()

public final UnaryCallable<StartScanRunRequest,ScanRun> startScanRunCallable()

Start a ScanRun according to the given ScanConfig.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   StartScanRunRequest request = StartScanRunRequest.newBuilder().setName("name3373707").build();
   ApiFuture<ScanRun> future =
       webSecurityScannerClient.startScanRunCallable().futureCall(request);
   // Do something.
   ScanRun response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StartScanRunRequest,ScanRun>

stopScanRun(StopScanRunRequest request)

public final ScanRun stopScanRun(StopScanRunRequest request)

Stops a ScanRun. The stopped ScanRun is returned.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   StopScanRunRequest request = StopScanRunRequest.newBuilder().setName("name3373707").build();
   ScanRun response = webSecurityScannerClient.stopScanRun(request);
 }
 
Parameter
NameDescription
requestStopScanRunRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ScanRun

stopScanRunCallable()

public final UnaryCallable<StopScanRunRequest,ScanRun> stopScanRunCallable()

Stops a ScanRun. The stopped ScanRun is returned.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   StopScanRunRequest request = StopScanRunRequest.newBuilder().setName("name3373707").build();
   ApiFuture<ScanRun> future =
       webSecurityScannerClient.stopScanRunCallable().futureCall(request);
   // Do something.
   ScanRun response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StopScanRunRequest,ScanRun>

updateScanConfig(UpdateScanConfigRequest request)

public final ScanConfig updateScanConfig(UpdateScanConfigRequest request)

Updates a ScanConfig. This method support partial update of a ScanConfig.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
   UpdateScanConfigRequest request =
       UpdateScanConfigRequest.newBuilder()
           .setScanConfig(ScanConfig.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ScanConfig response = webSecurityScannerClient.updateScanConfig(request);
 }
 
Parameter
NameDescription
requestUpdateScanConfigRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ScanConfig

updateScanConfigCallable()

public final UnaryCallable<UpdateScanConfigRequest,ScanConfig> updateScanConfigCallable()

Updates a ScanConfig. This method support partial update of a ScanConfig.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateScanConfigRequest,ScanConfig>