Documentation
¶
Index ¶
- Constants
- type Analyzer
- type AnalyzerCategory
- type AnalyzerDefinition
- type AnalyzerList
- type AnalyzerResult
- type ExecuteRequest
- type ExecuteResult
- type ExecutionLog
- type Handler
- func (h *Handler) Cancel(ctx context.Context, name string, requestToken string) (*ExecuteResult, error)
- func (h *Handler) Execute(ctx context.Context, name string, input map[string]interface{}, ...) (*ExecuteResult, error)
- func (h *Handler) ExecuteAndWait(ctx context.Context, name string, input map[string]interface{}, ...) (*ExecuteResult, error)
- func (h *Handler) Get(ctx context.Context, name string) (*AnalyzerDefinition, error)
- func (h *Handler) GetDocumentation(ctx context.Context, name string) (string, error)
- func (h *Handler) GetInputSchema(ctx context.Context, name string) (map[string]interface{}, error)
- func (h *Handler) GetResultSchema(ctx context.Context, name string) (map[string]interface{}, error)
- func (h *Handler) List(ctx context.Context, filter string) (*AnalyzerList, error)
- func (h *Handler) Poll(ctx context.Context, name string, requestToken string, timeoutSeconds int) (*ExecuteResult, error)
- func (h *Handler) Validate(ctx context.Context, name string, input map[string]interface{}) (*ValidationResult, error)
- type ValidationResult
Constants ¶
const ( StatusCompleted = "COMPLETED" StatusRunning = "RUNNING" StatusAborted = "ABORTED" StatusFailed = "FAILED" )
Execution statuses reported by the analyzer API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analyzer ¶
type Analyzer struct {
Name string `json:"name"`
DisplayName string `json:"displayName"`
Description string `json:"description,omitempty"`
Category *AnalyzerCategory `json:"category,omitempty"`
Type string `json:"type,omitempty"`
BaseAnalyzer string `json:"baseAnalyzer,omitempty"`
}
Analyzer represents an analyzer definition
type AnalyzerCategory ¶
type AnalyzerCategory struct {
DisplayName string `json:"displayName"`
}
AnalyzerCategory represents the category of an analyzer
type AnalyzerDefinition ¶
type AnalyzerDefinition struct {
Name string `json:"name"`
DisplayName string `json:"displayName"`
Description string `json:"description,omitempty"`
Category *AnalyzerCategory `json:"category,omitempty"`
Type string `json:"type,omitempty"`
BaseAnalyzer string `json:"baseAnalyzer,omitempty"`
Labels []string `json:"labels,omitempty"`
Input json.RawMessage `json:"input,omitempty"`
Output json.RawMessage `json:"output,omitempty"`
AnalyzerCall json.RawMessage `json:"analyzerCall,omitempty"`
}
AnalyzerDefinition represents detailed analyzer definition
type AnalyzerList ¶
type AnalyzerList struct {
Analyzers []Analyzer `json:"analyzers"`
TotalCount int `json:"totalCount"`
NextPageKey string `json:"nextPageKey,omitempty"`
}
AnalyzerList represents a list of analyzers
type AnalyzerResult ¶
type AnalyzerResult struct {
ResultID string `json:"resultId"`
ResultStatus string `json:"resultStatus"`
ExecutionStatus string `json:"executionStatus"`
Input map[string]interface{} `json:"input,omitempty"`
Output []map[string]interface{} `json:"output,omitempty"`
Data []map[string]interface{} `json:"data,omitempty"`
Logs []ExecutionLog `json:"logs,omitempty"`
}
AnalyzerResult represents the result of an analyzer execution
type ExecuteRequest ¶
type ExecuteRequest struct {
Input map[string]interface{} `json:"input"`
}
ExecuteRequest represents an analyzer execution request
type ExecuteResult ¶
type ExecuteResult struct {
RequestToken string `json:"requestToken,omitempty"`
TTLInSeconds int64 `json:"ttlInSeconds,omitempty"`
Result *AnalyzerResult `json:"result"`
}
ExecuteResult represents an analyzer execution result
type ExecutionLog ¶
type ExecutionLog struct {
Level string `json:"level"`
Message string `json:"message"`
Path string `json:"path,omitempty"`
}
ExecutionLog represents an execution log entry
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles Davis analyzer resources
func NewHandler ¶
func NewHandler(c *httpclient.Client) *Handler
NewHandler creates a new analyzer handler
func (*Handler) Cancel ¶
func (h *Handler) Cancel(ctx context.Context, name string, requestToken string) (*ExecuteResult, error)
Cancel cancels a running analyzer execution
func (*Handler) Execute ¶
func (h *Handler) Execute(ctx context.Context, 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).
Only COMPLETED is a success; ABORTED and FAILED are errors. Any other status that comes with a request token is polled, because a status added to the API later is more likely in flight than terminal.
func (*Handler) GetDocumentation ¶
GetDocumentation retrieves the documentation for an analyzer
func (*Handler) GetInputSchema ¶
GetInputSchema retrieves the JSON schema for analyzer input
func (*Handler) GetResultSchema ¶
GetResultSchema retrieves the JSON schema for analyzer result
type ValidationResult ¶
type ValidationResult struct {
Valid bool `json:"valid"`
Details map[string]interface{} `json:"details,omitempty"`
}
ValidationResult represents the result of input validation