Skip to main content
A newer release of this product is available.

Create a Vscan On-Demand policy

Contributors

POST /protocols/vscan/{svm.uuid}/on-demand-policies

Creates a Vscan On-Demand policy. Created only on a data SVM.

Important notes:

  • Only one policy can be scheduled at a time on an SVM. Use schedule name or schedule uuid to schedule an On-Demand policy.

  • Scanning must be enabled on the SVM before the policy is scheduled to run.

  • The exclude_extensions setting overrides the include_extensions setting. Set scan_without_extension to true to scan files without extensions.

Required properties

  • svm.uuid - Existing SVM in which to create the Vscan On-Demand policy.

  • name - Name of the Vscan On-Demand policy. Maximum length is 256 characters.

  • log_path - Path from the Vserver root where the On-Demand policy report is created.

  • scan_paths - List of paths that need to be scanned.

  • schedule - Scan schedule. It is recommended to set the schedule property, as it dictates when to scan for viruses.

Default property values

If not specified in POST, the following default property values are assigned:

  • include_extensions - *

  • max_file_size - 10737418240

  • scan_without_extension - true

  • vserver vscan on-demand-task create

  • vserver vscan on-demand-task schedule

Parameters

Name Type In Required Description

return_records

boolean

query

False

The default is false. If set to true, the records are returned.

svm.uuid

string

path

True

UUID of the SVM to which this object belongs.

Request Body

Name Type Description

log_path

string

The path from the Vserver root where the task report is created.

name

string

On-Demand task name

scan_paths

array[string]

List of paths that need to be scanned.

schedule

schedule

Schedule of the task.

scope

scope

Example request
{
  "log_path": "/vol0/report_dir",
  "name": "task-1",
  "scan_paths": [
    "/vol1/",
    "/vol2/cifs/"
  ],
  "schedule": {
    "_links": {
      "self": {
        "href": "/api/resourcelink"
      }
    },
    "name": "weekly",
    "uuid": "1cd8a442-86d1-11e0-ae1c-123478563412"
  },
  "scope": {
    "exclude_extensions": [
      "mp3",
      "mp4"
    ],
    "exclude_paths": [
      "/vol1/cold-files/",
      "/vol1/cifs/names"
    ],
    "include_extensions": [
      "vmdk",
      "mp*"
    ],
    "max_file_size": 10737418240
  }
}

Response

Status: 201, Created
Name Type Description

_links

_links

num_records

integer

Number of records

records

array[vscan_on_demand]

Example response
{
  "_links": {
    "next": {
      "href": "/api/resourcelink"
    },
    "self": {
      "href": "/api/resourcelink"
    }
  },
  "records": {
    "log_path": "/vol0/report_dir",
    "name": "task-1",
    "scan_paths": [
      "/vol1/",
      "/vol2/cifs/"
    ],
    "schedule": {
      "_links": {
        "self": {
          "href": "/api/resourcelink"
        }
      },
      "name": "weekly",
      "uuid": "1cd8a442-86d1-11e0-ae1c-123478563412"
    },
    "scope": {
      "exclude_extensions": [
        "mp3",
        "mp4"
      ],
      "exclude_paths": [
        "/vol1/cold-files/",
        "/vol1/cifs/names"
      ],
      "include_extensions": [
        "vmdk",
        "mp*"
      ],
      "max_file_size": 10737418240
    }
  }
}

Error

Status: Default

ONTAP Error Response Codes

Error Code Description

10027101

The file size must be in the range 1KB to 1TB

10027107

The include extensions list cannot be empty. Specify at least one extension for inclusion.

10027164

An On-Demand policy cannot be scheduled, as the Vscan is disabled. Enable the Vscan and retry the operation.

10027167

The specified schedule does not exist. Create the schedule or create a policy without specifying the schedule.

10027168

The specified scan path does not exist. The scan path must be specified from the root of the SVM, and must begin with UNIX path delimiters (use “/” not “\”)

10027169

The specified scan path is not supported for scanning.

10027173

The new On-Demand policy cannot be created as the SVM has reached the maximum number of On-Demand policies allowed. Delete an existing policy in order to create a new policy.

10027174

The specified exclude path is invalid. The path must be specified from the root of the SVM, and must begin with UNIX path delimiters (use "/" not "\")

10027175

An On-Demand policy cannot be scheduled as the Vserver is not in an operational state.

10027176

The log-path specified does not exist. The log path must be specified from the root of the SVM, and must begin with UNIX path delimiters (use “/” not “\”).

10027177

The log path specified is not supported.

10027253

The number of paths specified exceeds the configured maximum number of paths. You cannot specify more than the maximum number of configured paths.

10027254

The number of extensions specified exceeds the configured maximum number of extensions. You cannot specify more than the maximum number of configured extensions.

10027255

Another policy is already scheduled. Only one policy per SVM is allowed to be scheduled at any one time. Create a policy without specifying a schedule.

Name Type Description

error

error

Example error
{
  "error": {
    "arguments": {
      "code": "string",
      "message": "string"
    },
    "code": "4",
    "message": "entry doesn't exist",
    "target": "uuid"
  }
}

Definitions

See Definitions

href

Name Type Description

href

string

Name Type Description

self

href

schedule

Schedule of the task.

Name Type Description

_links

_links

name

string

Job schedule name

uuid

string

Job schedule UUID

scope

Name Type Description

exclude_extensions

array[string]

List of file extensions for which scanning is not performed.

exclude_paths

array[string]

List of file paths for which scanning must not be performed.

include_extensions

array[string]

List of file extensions to be scanned.

max_file_size

integer

Maximum file size, in bytes, allowed for scanning.

scan_without_extension

boolean

Specifies whether or not files without any extension can be scanned.

vscan_on_demand

Use On-Demand scanning to check files for viruses on a schedule. An On-Demand policy defines the scope of an On-Demand scan.

Name Type Description

log_path

string

The path from the Vserver root where the task report is created.

name

string

On-Demand task name

scan_paths

array[string]

List of paths that need to be scanned.

schedule

schedule

Schedule of the task.

scope

scope

Name Type Description

next

href

self

href

error_arguments

Name Type Description

code

string

Argument code

message

string

Message argument

error

Name Type Description

arguments

array[error_arguments]

Message arguments

code

string

Error code

message

string

Error message

target

string

The target parameter that caused the error.