Views:

An API reference for the Node.js SDK for Trend Vision One File Security

AmaasGrpcClient

The AmaasGrpcClient class is the main class of the SDK and provides methods to interact with the API.
Create a new instance of the AmaasGrpcClient class.
constructor( amaasHostName: string, credent: string, timeout: number | undefined = 180, enableTLS: boolean | undefined = true)

AmaasGrpcClient Parameters

Parameter
Description
Default value
amaasHostName
The File Security server address or the region of your Trend Vision One account. The region is the location where you acquire your API key. Value provided must be one of the Vision One regions, for example:
  • ap-northeast-1
  • ap-south-1
  • ap-southeast-1
  • ap-southeast-2
  • eu-central-1
  • us-east-1
credent
Your Vision One API key.
timeout
Timeout to cancel the connection to the server, in seconds.
180
enableTLS
Enable or disable transport layer security (TLS). You should always enable TLS when connecting to the File Security server.
True
Return An AmaasGrpcClient instance

Scan file

Scan a file for malware and retrieve response data from the API.
scanFile (name: string, tags?: string[]), Promise<AMaaSScanResultObject

scanFile Parameters

Parameter
Description
Default Value
name
The name of the file with the path of the directory containing the file to scan.
 
tags
The list of tags that can be used to tag the scan. Tags are optional. The maximum number of tags is eight. The maximum size of each tag is 63 characters.
 
pml
Enables Predictive Machine Learning (PML).
false
feedback
Enables Trend Micro Smart Protection Network (SPN) Smart Feedback.
false
Return A Promise that resolves to the API response data.

Scan buffer

Scan a buffer for malware and retrieve response data from the API.
scanBuffer(fileName: string, buff: buffer, tags?: string[]): Promise<AmaasScanResultObject>

scanBuffer Parameters

Parameter
Description
 
fileName
The name of the file or object the buffer is created from. The name is used to identify the buffer.
 
buff
The buffer to scan.
 
tags
The list of tags that can be used to tag the scan. Tags are optional. The maximum number of tags is eight. The maximum size of each tag is eight characters.
 
pml
Enables Predictive Machine Learning (PML).
false
feedback
Enables Trend Micro Smart Protection Network (SPN) Smart Feedback.
false
Return A promise that resolves to the API response data.

Close connection

Close connection to the AMaaS server.
close(): void

close Parameters

Parameter
Description
none
none
Return Void

Set the logging level

setLoggingLevel(level: Loglevel): void
Configure the active logging level of the SDK. The change applies globally to all AMaaS Client instances. The default level, LogLevel.OFF, corresponds to all logging disabled. When logging is enabled, logs write to stdout unless custom logging is configured using configLoggingCallback().

setLoggingLevel Parameters

Parameter
Description
Default value
level (Loglevel)
Valid values:
  • LogLevel.DEBUG
  • LogLevel.ERROR
  • LogLevel.FATAL
  • LogLevel.INFO
  • LogLevel.OFF
  • LogLevel.WARN
LogLevel.OFF
Return Void

Logging callback

Set up custom logging by provisioning the SDK with a custom callback function that is invoked whether the SDK wants to record a log.
configLoggingCallBack (LogCallback: Function): void

configLoggingCallBack Parameters

Parameter
Description
LogCallback
A function with the type (level LogLevel, message: string) => void
Return Void

AmaasScanResult

The AmaasScanResultObject interface defines the structure of the response data that is retrieved from our API. The following are the fields in the interface.
interface AmaasScanResultObject {
  scanTimestamp: string        // Timestamp of the scan in ISO 8601 format
  version: string              // Scan result schema version
  fileName: string             // Name of the file scanned
  scanId: string               // ID of the scan
  scanResult: number           // Number of malwares found. A value of 0 means no malware was found
  foundMalwares: [             // A list of malware names and the filenames found by AMaaS
    {
      fileName: string; // File name which found the malware
      malwareName: string; // Malware name
    },
  ];
}

LogLevel

enum LogLevel {
  OFF, // 0
  FATAL, // 1
  ERROR, // 2
  WARN, // 3
  INFO, // 4
  DEBUG, // 5
}