Skip to main content

file_security.go (package eai)

Source: sdks/go/file_security.go. Back to the Go SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class FileSecurityService​

FileSecurityService groups the endpoints of /v1/file-security: every file is quarantined, scanned by ClamAV and YARA-X, then released only when clean. Engine status, tenant policy, explicit scans, rescans, sample purge, stats.

FileSecurityService.GetScan​

GetScan(ctx context.Context, scanID string, opts ...CallOption) (json.RawMessage, error)

Get a scan record. One scan record: status, verdict, reasons, source and its reference, file name, declared and detected type, size, SHA-256, answer of each engine, whether a sample is kept, the scan it rescans, creator and dates (creation, scan, sample expiry). Requires a tenant principal; a record of someone else is visible only to tenant_admin, security_officer and auditor (404 not_found otherwise).

Route: /v1/file-security/scans/{scan_id} (GET).

NameTypeDefaultRequiredDescription
ctxcontext.ContextyesContext of the call: cancellation and deadline.
scanIDstringyesIdentifier of the scan record.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Get a scan record". The error is a typed error of the SDK, nil on success.

Raises: error, the typed errors of the transport (Errors).

FileSecurityService.ListScans​

ListScans(ctx context.Context, opts ...CallOption) (json.RawMessage, error)

List the scan records. Scan records of the tenant, newest first; a principal without a reader role (tenant_admin, security_officer, auditor) only sees its own scans. Requires a tenant principal. An unknown status, verdict or source answers 400 invalid_request; a malformed cursor 400 invalid_cursor.

Route: /v1/file-security/scans (GET).

NameTypeDefaultRequiredDescription
ctxcontext.ContextyesContext of the call: cancellation and deadline.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "List the scan records". The error is a typed error of the SDK, nil on success.

Raises: error, the typed errors of the transport (Errors).

FileSecurityService.Policy​

Policy(ctx context.Context, opts ...CallOption) (json.RawMessage, error)

Read the file security policy. Effective policy of the tenant: the locked rules, every editable rule (stored values over the defaults, the size never above the platform ceiling EAI_FILE_SCAN_MAX_BYTES), the known file types, and when and by whom it was last changed. Requires a tenant principal with tenant_admin, security_officer or auditor (403 forbidden).

Route: /v1/file-security/policy (GET).

NameTypeDefaultRequiredDescription
ctxcontext.ContextyesContext of the call: cancellation and deadline.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Read the file security policy". The error is a typed error of the SDK, nil on success.

Raises: error, the typed errors of the transport (Errors).

FileSecurityService.PurgeSample​

PurgeSample(ctx context.Context, scanID string, opts ...CallOption) (json.RawMessage, error)

Purge the sample of a blocked file. Deletes the encrypted sample of a blocked file now, without waiting for the end of its retention, and answers sample_retained: false. The purge is audited (file_security.sample.purge) with the SHA-256 of the file. Requires a tenant principal with security_officer or tenant_admin (403 forbidden). A scan that is unknown or not visible to the caller answers 404 not_found.

Route: /v1/file-security/scans/{scan_id}/sample (DELETE).

NameTypeDefaultRequiredDescription
ctxcontext.ContextyesContext of the call: cancellation and deadline.
scanIDstringyesIdentifier of the scan record.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Purge the sample of a blocked file". The error is a typed error of the SDK, nil on success.

Raises: error, the typed errors of the transport (Errors).

FileSecurityService.Rescan​

Rescan(ctx context.Context, scanID string, opts ...CallOption) (json.RawMessage, error)

Rescan the sample of a blocked file. Scans the retained sample of a blocked file again, for example after a signature update, and answers 201 with a new record whose rescan_of names the original scan. The original upload is never released: a clean result only informs. Requires a tenant principal with security_officer or tenant_admin (403 forbidden). Without a retained sample: 409 file_sample_unavailable; unknown or invisible scan: 404 not_found.

Route: /v1/file-security/scans/{scan_id}/rescan (POST).

NameTypeDefaultRequiredDescription
ctxcontext.ContextyesContext of the call: cancellation and deadline.
scanIDstringyesIdentifier of the blocked scan record whose sample is scanned again.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Rescan the sample of a blocked file". The error is a typed error of the SDK, nil on success.

Raises: error, the typed errors of the transport (Errors).

FileSecurityService.Scan​

Scan(ctx context.Context, in FileScanInput, opts ...CallOption) (json.RawMessage, error)

Scan a file without ingesting it. Scans a file without ingesting it and answers 201 with the record, released or blocked (a blocked file is not an error here). Any tenant principal may call it (403 tenant_required otherwise).

Route: /v1/file-security/scans (POST).

NameTypeDefaultRequiredDescription
ctxcontext.ContextyesContext of the call: cancellation and deadline.
inFileScanInputyesFile to scan: Data is sent base64 encoded, Filename and MimeType only when set.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Scan a file without ingesting it". The error is a typed error of the SDK, nil on success.

Raises: error, the typed errors of the transport (Errors).

FileSecurityService.Stats​

Stats(ctx context.Context, opts ...CallOption) (json.RawMessage, error)

Read the scan statistics. Number of scans over the last window_hours hours, by status, by verdict and by source, with the time of the last blocked file. Readers (tenant_admin, security_officer, auditor) count every scan of the tenant, anyone else only its own. Requires a tenant principal. A window outside 1 to 8784 hours answers 400 invalid_request.

Route: /v1/file-security/stats (GET).

NameTypeDefaultRequiredDescription
ctxcontext.ContextyesContext of the call: cancellation and deadline.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Read the scan statistics". The error is a typed error of the SDK, nil on success.

Raises: error, the typed errors of the transport (Errors).

FileSecurityService.Status​

Status(ctx context.Context, opts ...CallOption) (json.RawMessage, error)

Read the scan engines status. Mode (enforce or dev), readiness, pipeline and every ClamAV gateway and YARA-X worker, probed live: version, signature version, publication and age with a stale flag against the policy, rules version, hash, count and load time, latency. The instance is ready when each engine has at least one healthy endpoint (in enforce mode, or when it is configured). Requires tenant_admin, security_officer or auditor (403 forbidden).

Route: /v1/file-security/status (GET).

NameTypeDefaultRequiredDescription
ctxcontext.ContextyesContext of the call: cancellation and deadline.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Read the scan engines status". The error is a typed error of the SDK, nil on success.

Raises: error, the typed errors of the transport (Errors).

FileSecurityService.UpdatePolicy​

UpdatePolicy(ctx context.Context, body any, opts ...CallOption) (json.RawMessage, error)

Change the file security policy. Changes the editable rules given in the body; the other rules keep their value. Sizes may only be tighter than the platform ceiling, and the locked rules never change (422 file_security_rule_locked). An unknown field, an unknown type or a value out of bounds answers 422 invalid_request with the field and the reason. Requires a tenant principal with security_officer or tenant_admin (403 forbidden). The change is audited (file_security.policy.update) with the values before and after; the answer is the new effective policy.

Route: /v1/file-security/policy (PUT).

NameTypeDefaultRequiredDescription
ctxcontext.ContextyesContext of the call: cancellation and deadline.
bodyanyyesEditable rules to change; omitted fields keep their value.
opts...CallOptionnoPer call options (query, idempotency key, traceparent, headers).

Returns: (json.RawMessage, error). Decoded JSON answer of the operation "Change the file security policy". The error is a typed error of the SDK, nil on success.

Raises: error, the typed errors of the transport (Errors).

Model FileScanInput​

FileScanInput is the body of POST /v1/file-security/scans; Data is sent as content_base64.

Fields:

NameTypeRequiredDescription
Data[]byteyesBytes of the file to scan, sent base64 encoded as content_base64.
FilenamestringyesName of the scanned file, kept in the scan record.
MimeTypestringyesMedia type of the content, for example application/pdf or image/png.