public class NightfallClient extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
NightfallClient.Builder
A builder class that configures, validates, then creates instances of a Nightfall Client.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this client and releases underlying system resources.
|
ScanFileResponse |
scanFile(ScanFileRequest request,
InputStream content,
long contentSizeBytes)
A convenience method that abstracts the details of the multi-step file upload and scan process.
|
ScanFileResponse |
scanFile(ScanFileRequest request,
InputStream content,
long contentSizeBytes,
Duration timeout)
A convenience method that abstracts the details of the multi-step file upload and scan process.
|
ScanTextResponse |
scanText(ScanTextRequest request)
Scans the provided plaintext against the provided detectors, and returns all findings.
|
public void close()
close in interface Closeableclose in interface AutoCloseablepublic ScanTextResponse scanText(ScanTextRequest request)
i in the findings array will
correspond one-to-one with the input request payload list, so all findings stored in a given sub-list refer to
matches that occurred in the ith index of the request payload.request - the data to scan, along with the configuration describing how to scan the data. The
request payload may not exceed 500KB.NightfallAPIException - thrown if a non-2xx status code is returned by the API.NightfallClientException - thrown if a I/O error occurs while processing the requestIllegalArgumentException - thrown if request is nullNightfallRequestTimeoutException - thrown if the request is aborted because the timeout is exceededpublic ScanFileResponse scanFile(ScanFileRequest request, InputStream content, long contentSizeBytes)
The maximum allowed contentSizeBytes is dependent on the terms of your current
Nightfall usage plan agreement; check the Nightfall dashboard for more details.
This method consumes the provided InputStream, but it *does not* close it; closing remains
the caller's responsibility.
request - contains configuration describing which detectors to use to scan the file, as well as a webhook
URL for delivering the results of the scan.content - a stream of the bytes representing the file to uploadcontentSizeBytes - the size of the input streamNightfallAPIException - thrown if a non-2xx status code is returned by the API.NightfallClientException - thrown if a I/O error occurs while processing the requestNightfallRequestTimeoutException - thrown if the request is aborted because read/write timeout is exceededpublic ScanFileResponse scanFile(ScanFileRequest request, InputStream content, long contentSizeBytes, Duration timeout)
The maximum allowed contentSizeBytes is dependent on the terms of your current
Nightfall usage plan agreement; check the Nightfall dashboard for more details.
This method consumes the provided InputStream, but it *does not* close it; closing remains
the caller's responsibility.
request - contains configuration describing which detectors to use to scan the file, as well as a webhook
URL for delivering the results of the scan.content - a stream of the bytes representing the file to uploadcontentSizeBytes - the size of the input streamtimeout - the allowed duration for the request; if the execution time exceeds this duration, the request
will be aborted.NightfallAPIException - thrown if a non-2xx status code is returned by the API.NightfallClientException - thrown if a I/O error occurs while processing the requestNightfallRequestTimeoutException - thrown if execution time exceeds the provided timeout,
or if an HTTP request is terminated by the client for exceeding read/write timeouts.Copyright © 2022. All rights reserved.