analyzer

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseInputFromFile

func ParseInputFromFile(filename string) (map[string]interface{}, error)

ParseInputFromFile reads and parses analyzer input from a file. This is a CLI-layer helper and intentionally not part of the SDK.

func ParseInputFromFileWith

func ParseInputFromFileWith(env vfs.Env, filename string) (map[string]interface{}, error)

ParseInputFromFileWith is ParseInputFromFile through the given invocation Env.

Types

type Analyzer

type Analyzer struct {
	Name         string            `json:"name" table:"NAME"`
	DisplayName  string            `json:"displayName" table:"DISPLAY NAME"`
	Description  string            `json:"description,omitempty" table:"DESCRIPTION,wide"`
	Category     *AnalyzerCategory `json:"category,omitempty" table:"-"`
	CategoryName string            `json:"-" table:"CATEGORY"`
	Type         string            `json:"type,omitempty" table:"TYPE"`
	BaseAnalyzer string            `json:"baseAnalyzer,omitempty" table:"-"`
}

Analyzer represents an analyzer definition with CLI display fields.

func (Analyzer) MarshalYAML

func (a Analyzer) MarshalYAML() (any, error)

MarshalYAML renders the analyzer through its JSON shape so YAML output matches JSON: the display-only CategoryName (json:"-") is excluded, keys keep their camelCase, and omitempty is honored. Without it, yaml.v3 reflection would lowercase keys and leak categoryname.

type AnalyzerCategory

type AnalyzerCategory = sdkana.AnalyzerCategory

Re-export SDK types that don't need table tags as aliases.

type AnalyzerDefinition

type AnalyzerDefinition struct {
	Name         string            `json:"name" table:"NAME"`
	DisplayName  string            `json:"displayName" table:"DISPLAY NAME"`
	Description  string            `json:"description,omitempty" table:"DESCRIPTION"`
	Category     *AnalyzerCategory `json:"category,omitempty" table:"-"`
	CategoryName string            `json:"-" table:"CATEGORY"`
	Type         string            `json:"type,omitempty" table:"TYPE"`
	BaseAnalyzer string            `json:"baseAnalyzer,omitempty" table:"BASE ANALYZER"`
	Labels       []string          `json:"labels,omitempty" table:"-"`
	Input        json.RawMessage   `json:"input,omitempty" table:"-"`
	Output       json.RawMessage   `json:"output,omitempty" table:"-"`
	AnalyzerCall json.RawMessage   `json:"analyzerCall,omitempty" table:"-"`
}

AnalyzerDefinition represents detailed analyzer definition with CLI display fields.

func (AnalyzerDefinition) MarshalYAML

func (d AnalyzerDefinition) MarshalYAML() (any, error)

MarshalYAML renders the definition through its JSON shape so YAML output matches JSON. This is essential here: Input/Output/AnalyzerCall are json.RawMessage ([]byte), which yaml.v3 reflection would emit as a list of raw byte values instead of the structured schema; it also drops the display-only CategoryName and preserves camelCase keys.

type AnalyzerDescription

type AnalyzerDescription struct {
	Name         string                 `json:"name" table:"NAME"`
	DisplayName  string                 `json:"displayName" table:"DISPLAY NAME"`
	Description  string                 `json:"description,omitempty" table:"DESCRIPTION"`
	Category     string                 `json:"category,omitempty" table:"CATEGORY"`
	Type         string                 `json:"type,omitempty" table:"TYPE"`
	Labels       []string               `json:"labels,omitempty" table:"-"`
	InputSchema  map[string]interface{} `json:"inputSchema,omitempty" table:"-"`
	ResultSchema map[string]interface{} `json:"resultSchema,omitempty" table:"-"`
}

AnalyzerDescription is the enriched view returned by "dtctl describe analyzer". Unlike the raw AnalyzerDefinition (which carries the analyzer's internal input/output definition format), this bundles the resolved JSON Schemas so that agents and humans can see what inputs an analyzer requires without a second call. It is emitted in all output formats — a deliberate departure from the "describe == get in JSON mode" convention, because the schemas are the whole point of the command.

type AnalyzerList

type AnalyzerList struct {
	Analyzers  []Analyzer `json:"analyzers"`
	TotalCount int        `json:"totalCount"`
}

AnalyzerList represents a list of analyzers.

type AnalyzerResult

type AnalyzerResult = sdkana.AnalyzerResult

Re-export SDK types that don't need table tags as aliases.

type ExecuteRequest

type ExecuteRequest = sdkana.ExecuteRequest

Re-export SDK types that don't need table tags as aliases.

type ExecuteResult

type ExecuteResult struct {
	RequestToken string          `json:"requestToken,omitempty" table:"REQUEST TOKEN,wide"`
	TTLInSeconds int64           `json:"ttlInSeconds,omitempty" table:"-"`
	Result       *AnalyzerResult `json:"result" table:"-"`
	// Flattened fields for table display
	ResultID        string `json:"-" table:"RESULT ID"`
	ResultStatus    string `json:"-" table:"STATUS"`
	ExecutionStatus string `json:"-" table:"EXECUTION"`
}

ExecuteResult represents an analyzer execution result with CLI display fields.

func (ExecuteResult) MarshalYAML

func (r ExecuteResult) MarshalYAML() (any, error)

MarshalYAML renders the result through its JSON shape so YAML output matches JSON: the flattened display-only fields (ResultID/ResultStatus/ExecutionStatus, all json:"-") are excluded and keys keep their camelCase.

type ExecutionLog

type ExecutionLog = sdkana.ExecutionLog

Re-export SDK types that don't need table tags as aliases.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler handles Davis analyzer resources.

func NewHandler

func NewHandler(c *client.Client) *Handler

NewHandler creates a new analyzer handler

func (*Handler) Cancel

func (h *Handler) Cancel(name string, requestToken string) (*ExecuteResult, error)

Cancel cancels a running analyzer execution

func (*Handler) Execute

func (h *Handler) Execute(name string, input map[string]interface{}, timeoutSeconds int) (*ExecuteResult, error)

Execute runs an analyzer with the given input

func (*Handler) ExecuteAndWait

func (h *Handler) ExecuteAndWait(ctx context.Context, name string, input map[string]interface{}, maxWaitSeconds int) (*ExecuteResult, error)

ExecuteAndWait runs an analyzer and waits for completion. The context can be used to cancel a long-running poll (e.g. on SIGINT).

func (*Handler) Get

func (h *Handler) Get(name string) (*AnalyzerDefinition, error)

Get retrieves a specific analyzer definition

func (*Handler) GetDocumentation

func (h *Handler) GetDocumentation(name string) (string, error)

GetDocumentation retrieves the documentation for an analyzer

func (*Handler) GetInputSchema

func (h *Handler) GetInputSchema(name string) (map[string]interface{}, error)

GetInputSchema retrieves the JSON schema for analyzer input

func (*Handler) GetResultSchema

func (h *Handler) GetResultSchema(name string) (map[string]interface{}, error)

GetResultSchema retrieves the JSON schema for analyzer result

func (*Handler) List

func (h *Handler) List(filter string) (*AnalyzerList, error)

List retrieves all available analyzers

func (*Handler) Poll

func (h *Handler) Poll(name string, requestToken string, timeoutSeconds int) (*ExecuteResult, error)

Poll polls for the result of a started analyzer execution

func (*Handler) Validate

func (h *Handler) Validate(name string, input map[string]interface{}) (*ValidationResult, error)

Validate validates the input for an analyzer execution

type SchemaField

type SchemaField struct {
	Name        string
	Type        string
	Required    bool
	Description string
	// Composite is true when the property uses oneOf/anyOf/allOf/$ref and cannot
	// be represented as a simple typed field — callers should point the user at
	// the full schema (-o json) or the documentation (--doc).
	Composite bool
}

SchemaField is a single flattened property from a JSON Schema.

func FlattenSchema

func FlattenSchema(schema map[string]interface{}) (fields []SchemaField, introspectable bool)

FlattenSchema turns a top-level JSON Schema object into ordered fields for human display. It deliberately handles only the common case: top-level "properties" plus the "required" array. Required fields sort first, then alphabetically. The second return value (introspectable) is false when the schema has no top-level "properties" map, signalling that the caller should fall back to "-o json"/"--doc" rather than print an empty table.

type ValidationResult

type ValidationResult = sdkana.ValidationResult

Re-export SDK types that don't need table tags as aliases.

Jump to

Keyboard shortcuts

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