detectant

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 8 Imported by: 0

README

Detectant

Detectant Go SDK

Detectant is a malware scanning API with support for Go

Scan files for malware from Go services and applications.

Install

go get github.com/Detectant/go-sdk

Set your API key in the environment:

export DETECTANT_API_KEY="your-api-key"

Create a client

import (
    "os"

    detectant "github.com/Detectant/go-sdk/client"
    "github.com/Detectant/go-sdk/option"
)

client := detectant.NewClient(
    option.WithAPIKey(os.Getenv("DETECTANT_API_KEY")),
)

By default, requests are sent to https://api.detectant.com.

Scan one file

file, err := os.Open("./invoice.pdf")
if err != nil {
    log.Fatal(err)
}
defer file.Close()

result, err := client.Scan(context.Background(), file)
if err != nil {
    log.Fatal(err)
}

fmt.Println(result.Verdict, result.Detections)

The call completes after the file has been analyzed and returns its scan result. The SDK accepts any io.Reader, so large files do not need to be loaded into memory.

Filename and content type

Use NewFileParam when you need to supply file metadata explicitly:

fileParam := detectantsdk.NewFileParam(file, "invoice.pdf", "application/pdf")
result, err := client.Scan(context.Background(), fileParam)

Import the root module as detectantsdk "github.com/Detectant/go-sdk".

Scan a batch

Upload between 1 and 20 files. Results are returned in the same order as the inputs.

batch, err := client.ScanBatch(
    context.Background(),
    []io.Reader{invoice, archive},
)
if err != nil {
    log.Fatal(err)
}

for _, item := range batch.Results {
    fmt.Println(item.Filename)
}

One file can fail without preventing the other files in the batch from being scanned.

Configuration

Request options can change retries, headers, the base URL, or the HTTP client:

client := detectant.NewClient(
    option.WithAPIKey(os.Getenv("DETECTANT_API_KEY")),
    option.WithMaxAttempts(4),
    option.WithHTTPClient(customHTTPClient),
)

See the Detectant documentation for the complete guide.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Environments = struct {
	Default string
}{
	Default: "https://api.detectant.com",
}

Environments defines all of the API environments. These values can be used with the WithBaseURL RequestOption to override the client's default environment, if any.

View Source
var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{
	503: func(apiError *core.APIError) error {
		return &ServiceUnavailableError{
			APIError: apiError,
		}
	},
	400: func(apiError *core.APIError) error {
		return &BadRequestError{
			APIError: apiError,
		}
	},
	401: func(apiError *core.APIError) error {
		return &UnauthorizedError{
			APIError: apiError,
		}
	},
	429: func(apiError *core.APIError) error {
		return &TooManyRequestsError{
			APIError: apiError,
		}
	},
	500: func(apiError *core.APIError) error {
		return &InternalServerError{
			APIError: apiError,
		}
	},
	404: func(apiError *core.APIError) error {
		return &NotFoundError{
			APIError: apiError,
		}
	},
	403: func(apiError *core.APIError) error {
		return &ForbiddenError{
			APIError: apiError,
		}
	},
	413: func(apiError *core.APIError) error {
		return &ContentTooLargeError{
			APIError: apiError,
		}
	},
}

Functions

func Bool

func Bool(b bool) *bool

Bool returns a pointer to the given bool value.

func Byte

func Byte(b byte) *byte

Byte returns a pointer to the given byte value.

func Bytes

func Bytes(b []byte) *[]byte

Bytes returns a pointer to the given []byte value.

func Complex64

func Complex64(c complex64) *complex64

Complex64 returns a pointer to the given complex64 value.

func Complex128

func Complex128(c complex128) *complex128

Complex128 returns a pointer to the given complex128 value.

func Float32

func Float32(f float32) *float32

Float32 returns a pointer to the given float32 value.

func Float64

func Float64(f float64) *float64

Float64 returns a pointer to the given float64 value.

func Int

func Int(i int) *int

Int returns a pointer to the given int value.

func Int8

func Int8(i int8) *int8

Int8 returns a pointer to the given int8 value.

func Int16

func Int16(i int16) *int16

Int16 returns a pointer to the given int16 value.

func Int32

func Int32(i int32) *int32

Int32 returns a pointer to the given int32 value.

func Int64

func Int64(i int64) *int64

Int64 returns a pointer to the given int64 value.

func MustParseDate

func MustParseDate(date string) time.Time

MustParseDate attempts to parse the given string as a date time.Time, and panics upon failure.

func MustParseDateTime

func MustParseDateTime(datetime string) time.Time

MustParseDateTime attempts to parse the given string as a datetime time.Time, and panics upon failure.

func Rune

func Rune(r rune) *rune

Rune returns a pointer to the given rune value.

func String

func String(s string) *string

String returns a pointer to the given string value.

func Time

func Time(t time.Time) *time.Time

Time returns a pointer to the given time.Time value.

func UUID

func UUID(u uuid.UUID) *uuid.UUID

UUID returns a pointer to the given uuid.UUID value.

func Uint

func Uint(u uint) *uint

Uint returns a pointer to the given uint value.

func Uint8

func Uint8(u uint8) *uint8

Uint8 returns a pointer to the given uint8 value.

func Uint16

func Uint16(u uint16) *uint16

Uint16 returns a pointer to the given uint16 value.

func Uint32

func Uint32(u uint32) *uint32

Uint32 returns a pointer to the given uint32 value.

func Uint64

func Uint64(u uint64) *uint64

Uint64 returns a pointer to the given uint64 value.

func Uintptr

func Uintptr(u uintptr) *uintptr

Uintptr returns a pointer to the given uintptr value.

Types

type APIError

type APIError struct {
	// Stable machine-readable error code.
	Code string `json:"code" url:"code"`
	// Human-readable error message.
	Message string `json:"message" url:"message"`
	// Context such as the ID of a failed stored scan. Empty when no context applies.
	Details map[string]string `json:"details" url:"details"`
	// contains filtered or unexported fields
}

func (*APIError) GetCode

func (a *APIError) GetCode() string

func (*APIError) GetDetails

func (a *APIError) GetDetails() map[string]string

func (*APIError) GetExtraProperties

func (a *APIError) GetExtraProperties() map[string]interface{}

func (*APIError) GetMessage

func (a *APIError) GetMessage() string

func (*APIError) MarshalJSON

func (a *APIError) MarshalJSON() ([]byte, error)

func (*APIError) SetCode

func (a *APIError) SetCode(code string)

SetCode sets the Code field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*APIError) SetDetails

func (a *APIError) SetDetails(details map[string]string)

SetDetails sets the Details field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*APIError) SetMessage

func (a *APIError) SetMessage(message string)

SetMessage sets the Message field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*APIError) String

func (a *APIError) String() string

func (*APIError) UnmarshalJSON

func (a *APIError) UnmarshalJSON(data []byte) error

type BadRequestError

type BadRequestError struct {
	*core.APIError
	Body *ErrorResponse
}

The request parameters or upload are invalid.

func (*BadRequestError) MarshalJSON

func (b *BadRequestError) MarshalJSON() ([]byte, error)

func (*BadRequestError) UnmarshalJSON

func (b *BadRequestError) UnmarshalJSON(data []byte) error

func (*BadRequestError) Unwrap

func (b *BadRequestError) Unwrap() error

type ContentTooLargeError

type ContentTooLargeError struct {
	*core.APIError
	Body *ErrorResponse
}

The upload or safely expanded content exceeds a scanner limit.

func (*ContentTooLargeError) MarshalJSON

func (c *ContentTooLargeError) MarshalJSON() ([]byte, error)

func (*ContentTooLargeError) UnmarshalJSON

func (c *ContentTooLargeError) UnmarshalJSON(data []byte) error

func (*ContentTooLargeError) Unwrap

func (c *ContentTooLargeError) Unwrap() error

type ErrorResponse

type ErrorResponse struct {
	Error *APIError `json:"error" url:"error"`
	// contains filtered or unexported fields
}

func (*ErrorResponse) GetError

func (e *ErrorResponse) GetError() *APIError

func (*ErrorResponse) GetExtraProperties

func (e *ErrorResponse) GetExtraProperties() map[string]interface{}

func (*ErrorResponse) MarshalJSON

func (e *ErrorResponse) MarshalJSON() ([]byte, error)

func (*ErrorResponse) SetError

func (e *ErrorResponse) SetError(error_ *APIError)

SetError sets the Error field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ErrorResponse) String

func (e *ErrorResponse) String() string

func (*ErrorResponse) UnmarshalJSON

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

type FileParam

type FileParam struct {
	io.Reader
	// contains filtered or unexported fields
}

FileParam is a file type suitable for multipart/form-data uploads.

func NewFileParam

func NewFileParam(
	reader io.Reader,
	filename string,
	contentType string,
	opts ...FileParamOption,
) *FileParam

NewFileParam returns a *FileParam type suitable for multipart/form-data uploads. All file upload endpoints accept a simple io.Reader, which is usually created by opening a file via os.Open.

However, some endpoints require additional metadata about the file such as a specific Content-Type or custom filename. FileParam makes it easier to create the correct type signature for these endpoints.

func (*FileParam) ContentType

func (f *FileParam) ContentType() string

func (*FileParam) Name

func (f *FileParam) Name() string

type FileParamOption

type FileParamOption interface {
	// contains filtered or unexported methods
}

FileParamOption adapts the behavior of the FileParam. No options are implemented yet, but this interface allows for future extensibility.

type ForbiddenError

type ForbiddenError struct {
	*core.APIError
	Body *ErrorResponse
}

A dashboard session was supplied where an API key is required.

func (*ForbiddenError) MarshalJSON

func (f *ForbiddenError) MarshalJSON() ([]byte, error)

func (*ForbiddenError) UnmarshalJSON

func (f *ForbiddenError) UnmarshalJSON(data []byte) error

func (*ForbiddenError) Unwrap

func (f *ForbiddenError) Unwrap() error

type GetScanRequest

type GetScanRequest struct {
	// Scan identifier returned by `createScan` or `listScans`.
	ScanID string `json:"-" url:"-"`
	// contains filtered or unexported fields
}

func (*GetScanRequest) SetScanID

func (g *GetScanRequest) SetScanID(scanID string)

SetScanID sets the ScanID field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

type HealthResponse

type HealthResponse struct {
	Status HealthResponseStatus `json:"status" url:"status"`
	// contains filtered or unexported fields
}

func (*HealthResponse) GetExtraProperties

func (h *HealthResponse) GetExtraProperties() map[string]interface{}

func (*HealthResponse) GetStatus

func (h *HealthResponse) GetStatus() HealthResponseStatus

func (*HealthResponse) MarshalJSON

func (h *HealthResponse) MarshalJSON() ([]byte, error)

func (*HealthResponse) SetStatus

func (h *HealthResponse) SetStatus(status HealthResponseStatus)

SetStatus sets the Status field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*HealthResponse) String

func (h *HealthResponse) String() string

func (*HealthResponse) UnmarshalJSON

func (h *HealthResponse) UnmarshalJSON(data []byte) error

type HealthResponseStatus

type HealthResponseStatus string
const (
	HealthResponseStatusOk       HealthResponseStatus = "ok"
	HealthResponseStatusDegraded HealthResponseStatus = "degraded"
)

func NewHealthResponseStatusFromString

func NewHealthResponseStatusFromString(s string) (HealthResponseStatus, error)

func (HealthResponseStatus) Ptr

type InternalServerError

type InternalServerError struct {
	*core.APIError
	Body *ErrorResponse
}

An unexpected internal failure occurred.

func (*InternalServerError) MarshalJSON

func (i *InternalServerError) MarshalJSON() ([]byte, error)

func (*InternalServerError) UnmarshalJSON

func (i *InternalServerError) UnmarshalJSON(data []byte) error

func (*InternalServerError) Unwrap

func (i *InternalServerError) Unwrap() error

type ListScansRequest

type ListScansRequest struct {
	// Maximum results to return. Values above 200 are capped at 200; omission uses 50.
	Limit *int `json:"-" url:"limit,omitempty"`
	// Opaque cursor returned as `next_cursor` by a previous request.
	Cursor *string `json:"-" url:"cursor,omitempty"`
	// Case-sensitive PostgreSQL `LIKE` fragment matched against the stored verdict; `%` and `_` act as wildcards.
	Verdict *string `json:"-" url:"verdict,omitempty"`
	// Case-insensitive fragment matched against the scan identifier.
	ScanID *string `json:"-" url:"scan_id,omitempty"`
	// Return direct API scans or scans submitted by an S3 integration.
	SourceType *ListScansRequestSourceType `json:"-" url:"source_type,omitempty"`
	// Return scans submitted by this S3 integration.
	StorageIntegrationID *string `json:"-" url:"storage_integration_id,omitempty"`
	// Return scans by failure presence or customer-facing failure code.
	Failure *ListScansRequestFailure `json:"-" url:"failure,omitempty"`
	// Case-sensitive PostgreSQL `LIKE` fragment matched against the stored filename; `%` and `_` act as wildcards.
	Filename *string `json:"-" url:"filename,omitempty"`
	// Case-sensitive PostgreSQL `LIKE` fragment matched against the stored engine signature; `%` and `_` act as wildcards.
	EngineSignature *string `json:"-" url:"engine_signature,omitempty"`
	// Case-sensitive PostgreSQL `LIKE` fragment matched against stored detection rules; `%` and `_` act as wildcards.
	DetectionRule *string `json:"-" url:"detection_rule,omitempty"`
	// contains filtered or unexported fields
}

func (*ListScansRequest) SetCursor

func (l *ListScansRequest) SetCursor(cursor *string)

SetCursor sets the Cursor field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ListScansRequest) SetDetectionRule

func (l *ListScansRequest) SetDetectionRule(detectionRule *string)

SetDetectionRule sets the DetectionRule field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ListScansRequest) SetEngineSignature

func (l *ListScansRequest) SetEngineSignature(engineSignature *string)

SetEngineSignature sets the EngineSignature field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ListScansRequest) SetFailure

func (l *ListScansRequest) SetFailure(failure *ListScansRequestFailure)

SetFailure sets the Failure field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ListScansRequest) SetFilename

func (l *ListScansRequest) SetFilename(filename *string)

SetFilename sets the Filename field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ListScansRequest) SetLimit

func (l *ListScansRequest) SetLimit(limit *int)

SetLimit sets the Limit field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ListScansRequest) SetScanID

func (l *ListScansRequest) SetScanID(scanID *string)

SetScanID sets the ScanID field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ListScansRequest) SetSourceType

func (l *ListScansRequest) SetSourceType(sourceType *ListScansRequestSourceType)

SetSourceType sets the SourceType field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ListScansRequest) SetStorageIntegrationID

func (l *ListScansRequest) SetStorageIntegrationID(storageIntegrationID *string)

SetStorageIntegrationID sets the StorageIntegrationID field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ListScansRequest) SetVerdict

func (l *ListScansRequest) SetVerdict(verdict *string)

SetVerdict sets the Verdict field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

type ListScansRequestFailure

type ListScansRequestFailure string
const (
	ListScansRequestFailureAny                           ListScansRequestFailure = "any"
	ListScansRequestFailureNone                          ListScansRequestFailure = "none"
	ListScansRequestFailureScannerUnavailable            ListScansRequestFailure = "SCANNER_UNAVAILABLE"
	ListScansRequestFailureContentExpansionLimitExceeded ListScansRequestFailure = "CONTENT_EXPANSION_LIMIT_EXCEEDED"
)

func NewListScansRequestFailureFromString

func NewListScansRequestFailureFromString(s string) (ListScansRequestFailure, error)

func (ListScansRequestFailure) Ptr

type ListScansRequestSourceType

type ListScansRequestSourceType string
const (
	ListScansRequestSourceTypeAPI ListScansRequestSourceType = "api"
	ListScansRequestSourceTypeS3  ListScansRequestSourceType = "s3"
)

func NewListScansRequestSourceTypeFromString

func NewListScansRequestSourceTypeFromString(s string) (ListScansRequestSourceType, error)

func (ListScansRequestSourceType) Ptr

type NotFoundError

type NotFoundError struct {
	*core.APIError
	Body *ErrorResponse
}

No scan with this identifier exists for the authenticated account.

func (*NotFoundError) MarshalJSON

func (n *NotFoundError) MarshalJSON() ([]byte, error)

func (*NotFoundError) UnmarshalJSON

func (n *NotFoundError) UnmarshalJSON(data []byte) error

func (*NotFoundError) Unwrap

func (n *NotFoundError) Unwrap() error

type Scan

type Scan struct {
	// Server-generated scan identifier.
	ID        string      `json:"id" url:"id"`
	CreatedAt time.Time   `json:"created_at" url:"created_at"`
	Status    ScanStatus  `json:"status" url:"status"`
	Verdict   ScanVerdict `json:"verdict" url:"verdict"`
	// Filename supplied by the multipart upload.
	Filename   string       `json:"filename" url:"filename"`
	Sha256     string       `json:"sha256" url:"sha256"`
	SizeBytes  int64        `json:"size_bytes" url:"size_bytes"`
	DurationMs float64      `json:"duration_ms" url:"duration_ms"`
	Timings    *ScanTimings `json:"timings" url:"timings"`
	// Failure information, or `null` when the scan completed.
	Failure *ScanFailure `json:"failure,omitempty" url:"failure,omitempty"`
	// Detection names reported for the file. Empty when no threats were detected.
	Detections   []string      `json:"detections" url:"detections"`
	TypeAnalysis *TypeAnalysis `json:"type_analysis" url:"type_analysis"`
	Source       *ScanSource   `json:"source" url:"source"`
	// contains filtered or unexported fields
}

func (*Scan) GetCreatedAt

func (s *Scan) GetCreatedAt() time.Time

func (*Scan) GetDetections

func (s *Scan) GetDetections() []string

func (*Scan) GetDurationMs

func (s *Scan) GetDurationMs() float64

func (*Scan) GetExtraProperties

func (s *Scan) GetExtraProperties() map[string]interface{}

func (*Scan) GetFailure

func (s *Scan) GetFailure() *ScanFailure

func (*Scan) GetFilename

func (s *Scan) GetFilename() string

func (*Scan) GetID

func (s *Scan) GetID() string

func (*Scan) GetSha256

func (s *Scan) GetSha256() string

func (*Scan) GetSizeBytes

func (s *Scan) GetSizeBytes() int64

func (*Scan) GetSource

func (s *Scan) GetSource() *ScanSource

func (*Scan) GetStatus

func (s *Scan) GetStatus() ScanStatus

func (*Scan) GetTimings

func (s *Scan) GetTimings() *ScanTimings

func (*Scan) GetTypeAnalysis

func (s *Scan) GetTypeAnalysis() *TypeAnalysis

func (*Scan) GetVerdict

func (s *Scan) GetVerdict() ScanVerdict

func (*Scan) MarshalJSON

func (s *Scan) MarshalJSON() ([]byte, error)

func (*Scan) SetCreatedAt

func (s *Scan) SetCreatedAt(createdAt time.Time)

SetCreatedAt sets the CreatedAt field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetDetections

func (s *Scan) SetDetections(detections []string)

SetDetections sets the Detections field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetDurationMs

func (s *Scan) SetDurationMs(durationMs float64)

SetDurationMs sets the DurationMs field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetFailure

func (s *Scan) SetFailure(failure *ScanFailure)

SetFailure sets the Failure field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetFilename

func (s *Scan) SetFilename(filename string)

SetFilename sets the Filename field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetID

func (s *Scan) SetID(id string)

SetID sets the ID field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetSha256

func (s *Scan) SetSha256(sha256 string)

SetSha256 sets the Sha256 field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetSizeBytes

func (s *Scan) SetSizeBytes(sizeBytes int64)

SetSizeBytes sets the SizeBytes field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetSource

func (s *Scan) SetSource(source *ScanSource)

SetSource sets the Source field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetStatus

func (s *Scan) SetStatus(status ScanStatus)

SetStatus sets the Status field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetTimings

func (s *Scan) SetTimings(timings *ScanTimings)

SetTimings sets the Timings field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetTypeAnalysis

func (s *Scan) SetTypeAnalysis(typeAnalysis *TypeAnalysis)

SetTypeAnalysis sets the TypeAnalysis field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) SetVerdict

func (s *Scan) SetVerdict(verdict ScanVerdict)

SetVerdict sets the Verdict field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*Scan) String

func (s *Scan) String() string

func (*Scan) UnmarshalJSON

func (s *Scan) UnmarshalJSON(data []byte) error

type ScanBatchResponse

type ScanBatchResponse struct {
	// One outcome per submitted file, in submission order.
	Results []*ScanBatchResult `json:"results" url:"results"`
	// contains filtered or unexported fields
}

func (*ScanBatchResponse) GetExtraProperties

func (s *ScanBatchResponse) GetExtraProperties() map[string]interface{}

func (*ScanBatchResponse) GetResults

func (s *ScanBatchResponse) GetResults() []*ScanBatchResult

func (*ScanBatchResponse) MarshalJSON

func (s *ScanBatchResponse) MarshalJSON() ([]byte, error)

func (*ScanBatchResponse) SetResults

func (s *ScanBatchResponse) SetResults(results []*ScanBatchResult)

SetResults sets the Results field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanBatchResponse) String

func (s *ScanBatchResponse) String() string

func (*ScanBatchResponse) UnmarshalJSON

func (s *ScanBatchResponse) UnmarshalJSON(data []byte) error

type ScanBatchResult

type ScanBatchResult struct {
	// Zero-based position of the submitted file.
	Index int `json:"index" url:"index"`
	// Filename supplied by the multipart part.
	Filename string `json:"filename" url:"filename"`
	// HTTP status that the equivalent single-file request would return.
	HTTPStatus int `json:"http_status" url:"http_status"`
	// Stored scan result, including its scan ID, or null when validation failed before a scan was created.
	Scan *Scan `json:"scan,omitempty" url:"scan,omitempty"`
	// Per-file validation or scanning error, or null when the scan completed.
	Error *APIError `json:"error,omitempty" url:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*ScanBatchResult) GetError

func (s *ScanBatchResult) GetError() *APIError

func (*ScanBatchResult) GetExtraProperties

func (s *ScanBatchResult) GetExtraProperties() map[string]interface{}

func (*ScanBatchResult) GetFilename

func (s *ScanBatchResult) GetFilename() string

func (*ScanBatchResult) GetHTTPStatus

func (s *ScanBatchResult) GetHTTPStatus() int

func (*ScanBatchResult) GetIndex

func (s *ScanBatchResult) GetIndex() int

func (*ScanBatchResult) GetScan

func (s *ScanBatchResult) GetScan() *Scan

func (*ScanBatchResult) MarshalJSON

func (s *ScanBatchResult) MarshalJSON() ([]byte, error)

func (*ScanBatchResult) SetError

func (s *ScanBatchResult) SetError(error_ *APIError)

SetError sets the Error field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanBatchResult) SetFilename

func (s *ScanBatchResult) SetFilename(filename string)

SetFilename sets the Filename field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanBatchResult) SetHTTPStatus

func (s *ScanBatchResult) SetHTTPStatus(httpStatus int)

SetHTTPStatus sets the HTTPStatus field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanBatchResult) SetIndex

func (s *ScanBatchResult) SetIndex(index int)

SetIndex sets the Index field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanBatchResult) SetScan

func (s *ScanBatchResult) SetScan(scan *Scan)

SetScan sets the Scan field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanBatchResult) String

func (s *ScanBatchResult) String() string

func (*ScanBatchResult) UnmarshalJSON

func (s *ScanBatchResult) UnmarshalJSON(data []byte) error

type ScanFailure

type ScanFailure struct {
	Code    ScanFailureCode `json:"code" url:"code"`
	Message string          `json:"message" url:"message"`
	// contains filtered or unexported fields
}

func (*ScanFailure) GetCode

func (s *ScanFailure) GetCode() ScanFailureCode

func (*ScanFailure) GetExtraProperties

func (s *ScanFailure) GetExtraProperties() map[string]interface{}

func (*ScanFailure) GetMessage

func (s *ScanFailure) GetMessage() string

func (*ScanFailure) MarshalJSON

func (s *ScanFailure) MarshalJSON() ([]byte, error)

func (*ScanFailure) SetCode

func (s *ScanFailure) SetCode(code ScanFailureCode)

SetCode sets the Code field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanFailure) SetMessage

func (s *ScanFailure) SetMessage(message string)

SetMessage sets the Message field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanFailure) String

func (s *ScanFailure) String() string

func (*ScanFailure) UnmarshalJSON

func (s *ScanFailure) UnmarshalJSON(data []byte) error

type ScanFailureCode

type ScanFailureCode string
const (
	ScanFailureCodeScannerUnavailable            ScanFailureCode = "SCANNER_UNAVAILABLE"
	ScanFailureCodeContentExpansionLimitExceeded ScanFailureCode = "CONTENT_EXPANSION_LIMIT_EXCEEDED"
)

func NewScanFailureCodeFromString

func NewScanFailureCodeFromString(s string) (ScanFailureCode, error)

func (ScanFailureCode) Ptr

type ScanList

type ScanList struct {
	// Scan records. Empty when the account has no scans.
	Items []*Scan `json:"items" url:"items"`
	// Opaque cursor for the next page, or `null` when no next page exists.
	NextCursor *string `json:"next_cursor,omitempty" url:"next_cursor,omitempty"`
	// contains filtered or unexported fields
}

func (*ScanList) GetExtraProperties

func (s *ScanList) GetExtraProperties() map[string]interface{}

func (*ScanList) GetItems

func (s *ScanList) GetItems() []*Scan

func (*ScanList) GetNextCursor

func (s *ScanList) GetNextCursor() *string

func (*ScanList) MarshalJSON

func (s *ScanList) MarshalJSON() ([]byte, error)

func (*ScanList) SetItems

func (s *ScanList) SetItems(items []*Scan)

SetItems sets the Items field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanList) SetNextCursor

func (s *ScanList) SetNextCursor(nextCursor *string)

SetNextCursor sets the NextCursor field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanList) String

func (s *ScanList) String() string

func (*ScanList) UnmarshalJSON

func (s *ScanList) UnmarshalJSON(data []byte) error

type ScanSource

type ScanSource struct {
	Type ScanSourceType `json:"type" url:"type"`
	// S3 integration identifier, or `null` for direct API scans.
	IntegrationID *string `json:"integration_id,omitempty" url:"integration_id,omitempty"`
	// S3 integration name, or `null` for direct API scans.
	IntegrationName *string `json:"integration_name,omitempty" url:"integration_name,omitempty"`
	// contains filtered or unexported fields
}

func (*ScanSource) GetExtraProperties

func (s *ScanSource) GetExtraProperties() map[string]interface{}

func (*ScanSource) GetIntegrationID

func (s *ScanSource) GetIntegrationID() *string

func (*ScanSource) GetIntegrationName

func (s *ScanSource) GetIntegrationName() *string

func (*ScanSource) GetType

func (s *ScanSource) GetType() ScanSourceType

func (*ScanSource) MarshalJSON

func (s *ScanSource) MarshalJSON() ([]byte, error)

func (*ScanSource) SetIntegrationID

func (s *ScanSource) SetIntegrationID(integrationID *string)

SetIntegrationID sets the IntegrationID field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanSource) SetIntegrationName

func (s *ScanSource) SetIntegrationName(integrationName *string)

SetIntegrationName sets the IntegrationName field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanSource) SetType

func (s *ScanSource) SetType(type_ ScanSourceType)

SetType sets the Type field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanSource) String

func (s *ScanSource) String() string

func (*ScanSource) UnmarshalJSON

func (s *ScanSource) UnmarshalJSON(data []byte) error

type ScanSourceType

type ScanSourceType string
const (
	ScanSourceTypeAPI ScanSourceType = "api"
	ScanSourceTypeS3  ScanSourceType = "s3"
)

func NewScanSourceTypeFromString

func NewScanSourceTypeFromString(s string) (ScanSourceType, error)

func (ScanSourceType) Ptr

func (s ScanSourceType) Ptr() *ScanSourceType

type ScanStatus

type ScanStatus string
const (
	ScanStatusCompleted ScanStatus = "completed"
	ScanStatusFailed    ScanStatus = "failed"
)

func NewScanStatusFromString

func NewScanStatusFromString(s string) (ScanStatus, error)

func (ScanStatus) Ptr

func (s ScanStatus) Ptr() *ScanStatus

type ScanTimings

type ScanTimings struct {
	FileTypeMs    float64 `json:"file_type_ms" url:"file_type_ms"`
	MalwareScanMs float64 `json:"malware_scan_ms" url:"malware_scan_ms"`
	// contains filtered or unexported fields
}

func (*ScanTimings) GetExtraProperties

func (s *ScanTimings) GetExtraProperties() map[string]interface{}

func (*ScanTimings) GetFileTypeMs

func (s *ScanTimings) GetFileTypeMs() float64

func (*ScanTimings) GetMalwareScanMs

func (s *ScanTimings) GetMalwareScanMs() float64

func (*ScanTimings) MarshalJSON

func (s *ScanTimings) MarshalJSON() ([]byte, error)

func (*ScanTimings) SetFileTypeMs

func (s *ScanTimings) SetFileTypeMs(fileTypeMs float64)

SetFileTypeMs sets the FileTypeMs field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanTimings) SetMalwareScanMs

func (s *ScanTimings) SetMalwareScanMs(malwareScanMs float64)

SetMalwareScanMs sets the MalwareScanMs field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*ScanTimings) String

func (s *ScanTimings) String() string

func (*ScanTimings) UnmarshalJSON

func (s *ScanTimings) UnmarshalJSON(data []byte) error

type ScanVerdict

type ScanVerdict string
const (
	ScanVerdictClean      ScanVerdict = "clean"
	ScanVerdictMalicious  ScanVerdict = "malicious"
	ScanVerdictSuspicious ScanVerdict = "suspicious"
	ScanVerdictUnknown    ScanVerdict = "unknown"
)

func NewScanVerdictFromString

func NewScanVerdictFromString(s string) (ScanVerdict, error)

func (ScanVerdict) Ptr

func (s ScanVerdict) Ptr() *ScanVerdict

type ServiceUnavailableError

type ServiceUnavailableError struct {
	*core.APIError
	Body any
}

One or more required dependencies are unavailable or degraded.

func (*ServiceUnavailableError) MarshalJSON

func (s *ServiceUnavailableError) MarshalJSON() ([]byte, error)

func (*ServiceUnavailableError) UnmarshalJSON

func (s *ServiceUnavailableError) UnmarshalJSON(data []byte) error

func (*ServiceUnavailableError) Unwrap

func (s *ServiceUnavailableError) Unwrap() error

type TooManyRequestsError

type TooManyRequestsError struct {
	*core.APIError
	Body *ErrorResponse
}

The plan's current-period scan allowance, global request rate, or concurrent scanner capacity was exceeded. Plan exhaustion uses `USAGE_LIMIT_EXCEEDED` and includes the plan, limit, and reset time in `details`.

func (*TooManyRequestsError) MarshalJSON

func (t *TooManyRequestsError) MarshalJSON() ([]byte, error)

func (*TooManyRequestsError) UnmarshalJSON

func (t *TooManyRequestsError) UnmarshalJSON(data []byte) error

func (*TooManyRequestsError) Unwrap

func (t *TooManyRequestsError) Unwrap() error

type TypeAnalysis

type TypeAnalysis struct {
	Declared          *TypeDeclaration       `json:"declared" url:"declared"`
	Identified        *TypeIdentification    `json:"identified" url:"identified"`
	Status            TypeAnalysisStatus     `json:"status" url:"status"`
	StructurallyValid *bool                  `json:"structurally_valid,omitempty" url:"structurally_valid,omitempty"`
	Confidence        TypeAnalysisConfidence `json:"confidence" url:"confidence"`
	Reason            *TypeAnalysisReason    `json:"reason,omitempty" url:"reason,omitempty"`
	// contains filtered or unexported fields
}

func (*TypeAnalysis) GetConfidence

func (t *TypeAnalysis) GetConfidence() TypeAnalysisConfidence

func (*TypeAnalysis) GetDeclared

func (t *TypeAnalysis) GetDeclared() *TypeDeclaration

func (*TypeAnalysis) GetExtraProperties

func (t *TypeAnalysis) GetExtraProperties() map[string]interface{}

func (*TypeAnalysis) GetIdentified

func (t *TypeAnalysis) GetIdentified() *TypeIdentification

func (*TypeAnalysis) GetReason

func (t *TypeAnalysis) GetReason() *TypeAnalysisReason

func (*TypeAnalysis) GetStatus

func (t *TypeAnalysis) GetStatus() TypeAnalysisStatus

func (*TypeAnalysis) GetStructurallyValid

func (t *TypeAnalysis) GetStructurallyValid() *bool

func (*TypeAnalysis) MarshalJSON

func (t *TypeAnalysis) MarshalJSON() ([]byte, error)

func (*TypeAnalysis) SetConfidence

func (t *TypeAnalysis) SetConfidence(confidence TypeAnalysisConfidence)

SetConfidence sets the Confidence field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeAnalysis) SetDeclared

func (t *TypeAnalysis) SetDeclared(declared *TypeDeclaration)

SetDeclared sets the Declared field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeAnalysis) SetIdentified

func (t *TypeAnalysis) SetIdentified(identified *TypeIdentification)

SetIdentified sets the Identified field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeAnalysis) SetReason

func (t *TypeAnalysis) SetReason(reason *TypeAnalysisReason)

SetReason sets the Reason field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeAnalysis) SetStatus

func (t *TypeAnalysis) SetStatus(status TypeAnalysisStatus)

SetStatus sets the Status field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeAnalysis) SetStructurallyValid

func (t *TypeAnalysis) SetStructurallyValid(structurallyValid *bool)

SetStructurallyValid sets the StructurallyValid field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeAnalysis) String

func (t *TypeAnalysis) String() string

func (*TypeAnalysis) UnmarshalJSON

func (t *TypeAnalysis) UnmarshalJSON(data []byte) error

type TypeAnalysisConfidence

type TypeAnalysisConfidence string
const (
	TypeAnalysisConfidenceHigh   TypeAnalysisConfidence = "high"
	TypeAnalysisConfidenceMedium TypeAnalysisConfidence = "medium"
	TypeAnalysisConfidenceLow    TypeAnalysisConfidence = "low"
)

func NewTypeAnalysisConfidenceFromString

func NewTypeAnalysisConfidenceFromString(s string) (TypeAnalysisConfidence, error)

func (TypeAnalysisConfidence) Ptr

type TypeAnalysisReason

type TypeAnalysisReason struct {
	Code     TypeAnalysisReasonCode `json:"code" url:"code"`
	Claimed  *string                `json:"claimed,omitempty" url:"claimed,omitempty"`
	Detected *string                `json:"detected,omitempty" url:"detected,omitempty"`
	// contains filtered or unexported fields
}

func (*TypeAnalysisReason) GetClaimed

func (t *TypeAnalysisReason) GetClaimed() *string

func (*TypeAnalysisReason) GetCode

func (*TypeAnalysisReason) GetDetected

func (t *TypeAnalysisReason) GetDetected() *string

func (*TypeAnalysisReason) GetExtraProperties

func (t *TypeAnalysisReason) GetExtraProperties() map[string]interface{}

func (*TypeAnalysisReason) MarshalJSON

func (t *TypeAnalysisReason) MarshalJSON() ([]byte, error)

func (*TypeAnalysisReason) SetClaimed

func (t *TypeAnalysisReason) SetClaimed(claimed *string)

SetClaimed sets the Claimed field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeAnalysisReason) SetCode

func (t *TypeAnalysisReason) SetCode(code TypeAnalysisReasonCode)

SetCode sets the Code field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeAnalysisReason) SetDetected

func (t *TypeAnalysisReason) SetDetected(detected *string)

SetDetected sets the Detected field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeAnalysisReason) String

func (t *TypeAnalysisReason) String() string

func (*TypeAnalysisReason) UnmarshalJSON

func (t *TypeAnalysisReason) UnmarshalJSON(data []byte) error

type TypeAnalysisReasonCode

type TypeAnalysisReasonCode string
const (
	TypeAnalysisReasonCodeMalformedFile                 TypeAnalysisReasonCode = "malformed_file"
	TypeAnalysisReasonCodeEncryptedArchive              TypeAnalysisReasonCode = "encrypted_archive"
	TypeAnalysisReasonCodeUnsupportedArchive            TypeAnalysisReasonCode = "unsupported_archive"
	TypeAnalysisReasonCodeContentExpansionLimitExceeded TypeAnalysisReasonCode = "content_expansion_limit_exceeded"
	TypeAnalysisReasonCodeFileTypeMismatch              TypeAnalysisReasonCode = "file_type_mismatch"
)

func NewTypeAnalysisReasonCodeFromString

func NewTypeAnalysisReasonCodeFromString(s string) (TypeAnalysisReasonCode, error)

func (TypeAnalysisReasonCode) Ptr

type TypeAnalysisStatus

type TypeAnalysisStatus string
const (
	TypeAnalysisStatusMatch       TypeAnalysisStatus = "match"
	TypeAnalysisStatusCompatible  TypeAnalysisStatus = "compatible"
	TypeAnalysisStatusMismatch    TypeAnalysisStatus = "mismatch"
	TypeAnalysisStatusMalformed   TypeAnalysisStatus = "malformed"
	TypeAnalysisStatusUnscannable TypeAnalysisStatus = "unscannable"
	TypeAnalysisStatusUnknown     TypeAnalysisStatus = "unknown"
)

func NewTypeAnalysisStatusFromString

func NewTypeAnalysisStatusFromString(s string) (TypeAnalysisStatus, error)

func (TypeAnalysisStatus) Ptr

type TypeDeclaration

type TypeDeclaration struct {
	// Raw extension from the uploaded filename, without the leading dot.
	Extension *string `json:"extension,omitempty" url:"extension,omitempty"`
	// Normalized MIME type declared by the multipart part.
	Mime *string `json:"mime,omitempty" url:"mime,omitempty"`
	// contains filtered or unexported fields
}

func (*TypeDeclaration) GetExtension

func (t *TypeDeclaration) GetExtension() *string

func (*TypeDeclaration) GetExtraProperties

func (t *TypeDeclaration) GetExtraProperties() map[string]interface{}

func (*TypeDeclaration) GetMime

func (t *TypeDeclaration) GetMime() *string

func (*TypeDeclaration) MarshalJSON

func (t *TypeDeclaration) MarshalJSON() ([]byte, error)

func (*TypeDeclaration) SetExtension

func (t *TypeDeclaration) SetExtension(extension *string)

SetExtension sets the Extension field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeDeclaration) SetMime

func (t *TypeDeclaration) SetMime(mime *string)

SetMime sets the Mime field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeDeclaration) String

func (t *TypeDeclaration) String() string

func (*TypeDeclaration) UnmarshalJSON

func (t *TypeDeclaration) UnmarshalJSON(data []byte) error

type TypeIdentification

type TypeIdentification struct {
	// Canonical format identified from file content.
	Format *string `json:"format,omitempty" url:"format,omitempty"`
	// Canonical MIME type identified from file content.
	Mime *string `json:"mime,omitempty" url:"mime,omitempty"`
	// contains filtered or unexported fields
}

func (*TypeIdentification) GetExtraProperties

func (t *TypeIdentification) GetExtraProperties() map[string]interface{}

func (*TypeIdentification) GetFormat

func (t *TypeIdentification) GetFormat() *string

func (*TypeIdentification) GetMime

func (t *TypeIdentification) GetMime() *string

func (*TypeIdentification) MarshalJSON

func (t *TypeIdentification) MarshalJSON() ([]byte, error)

func (*TypeIdentification) SetFormat

func (t *TypeIdentification) SetFormat(format *string)

SetFormat sets the Format field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeIdentification) SetMime

func (t *TypeIdentification) SetMime(mime *string)

SetMime sets the Mime field and marks it as non-optional; this prevents an empty or null value for this field from being omitted during serialization.

func (*TypeIdentification) String

func (t *TypeIdentification) String() string

func (*TypeIdentification) UnmarshalJSON

func (t *TypeIdentification) UnmarshalJSON(data []byte) error

type UnauthorizedError

type UnauthorizedError struct {
	*core.APIError
	Body *ErrorResponse
}

The API key is missing or invalid.

func (*UnauthorizedError) MarshalJSON

func (u *UnauthorizedError) MarshalJSON() ([]byte, error)

func (*UnauthorizedError) UnmarshalJSON

func (u *UnauthorizedError) UnmarshalJSON(data []byte) error

func (*UnauthorizedError) Unwrap

func (u *UnauthorizedError) Unwrap() error

Directories

Path Synopsis
Service health probes.
Service health probes.
Submit files and retrieve account-scoped scan results.
Submit files and retrieve account-scoped scan results.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL