hosted

package
v0.123.11 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostedAgent

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

HostedAgent implements the Agent interface for remote analysis services

func NewHostedAgent

func NewHostedAgent(opts *HostedAgentOptions) (*HostedAgent, error)

NewHostedAgent creates a new hosted analysis agent

func (*HostedAgent) Analyze

func (a *HostedAgent) Analyze(ctx context.Context, data []byte, analyzers []analyzer.AnalyzerSpec) (*analyzer.AgentResult, error)

Analyze performs analysis using the hosted service

func (*HostedAgent) Capabilities

func (a *HostedAgent) Capabilities() []string

Capabilities returns the agent's capabilities

func (*HostedAgent) GetEndpoint

func (a *HostedAgent) GetEndpoint() string

GetEndpoint returns the current endpoint URL

func (*HostedAgent) GetStats

func (a *HostedAgent) GetStats() HostedAgentStats

GetStats returns usage statistics for the hosted agent

func (*HostedAgent) HealthCheck

func (a *HostedAgent) HealthCheck(ctx context.Context) error

HealthCheck verifies the hosted service is accessible and functioning

func (*HostedAgent) IsAvailable

func (a *HostedAgent) IsAvailable() bool

IsAvailable checks if the hosted service is available

func (*HostedAgent) Name

func (a *HostedAgent) Name() string

Name returns the agent name

func (*HostedAgent) SetEnabled

func (a *HostedAgent) SetEnabled(enabled bool)

SetEnabled enables or disables the hosted agent

func (*HostedAgent) Stop

func (a *HostedAgent) Stop()

Stop cleanly shuts down the hosted agent and stops background goroutines

func (*HostedAgent) UpdateCredentials

func (a *HostedAgent) UpdateCredentials(apiKey string) error

UpdateCredentials updates the API key for authentication

type HostedAgentOptions

type HostedAgentOptions struct {
	Endpoint           string
	APIKey             string
	Timeout            time.Duration
	MaxRetries         int
	RateLimit          int // requests per minute
	InsecureSkipVerify bool
	CustomHeaders      map[string]string
}

HostedAgentOptions configures the hosted agent

type HostedAgentStats

type HostedAgentStats struct {
	Enabled          bool    `json:"enabled"`
	Endpoint         string  `json:"endpoint"`
	Version          string  `json:"version"`
	Capabilities     int     `json:"capabilities"`
	RequestsThisHour int64   `json:"requestsThisHour,omitempty"`
	SuccessRate      float64 `json:"successRate,omitempty"`
	AverageLatency   string  `json:"averageLatency,omitempty"`
}

HostedAgentStats provides usage statistics

type HostedAnalysisOptions

type HostedAnalysisOptions struct {
	IncludeRemediation bool     `json:"includeRemediation"`
	AnalysisTypes      []string `json:"analysisTypes,omitempty"`
	Priority           string   `json:"priority,omitempty"`
	Timeout            int      `json:"timeout,omitempty"`
}

HostedAnalysisOptions configures the analysis request

type HostedAnalysisRequest

type HostedAnalysisRequest struct {
	BundleData []byte                  `json:"bundleData"`
	Analyzers  []analyzer.AnalyzerSpec `json:"analyzers"`
	Options    HostedAnalysisOptions   `json:"options"`
	Metadata   RequestMetadata         `json:"metadata"`
}

HostedAnalysisRequest represents the request payload for hosted analysis

type HostedAnalysisResponse

type HostedAnalysisResponse struct {
	Results   []*analyzer.AnalyzerResult `json:"results"`
	Metadata  HostedResponseMetadata     `json:"metadata"`
	Errors    []string                   `json:"errors,omitempty"`
	Status    string                     `json:"status"`
	RequestID string                     `json:"requestId"`
}

HostedAnalysisResponse represents the response from hosted analysis

type HostedResponseMetadata

type HostedResponseMetadata struct {
	Duration       time.Duration `json:"duration"`
	AnalyzerCount  int           `json:"analyzerCount"`
	ServiceVersion string        `json:"serviceVersion"`
	ModelVersion   string        `json:"modelVersion,omitempty"`
	Confidence     float64       `json:"confidence,omitempty"`
}

HostedResponseMetadata provides analysis metadata from the service

type RateLimiter

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

RateLimiter manages API rate limiting

func NewRateLimiter

func NewRateLimiter(requestsPerMinute int) *RateLimiter

NewRateLimiter creates a new rate limiter

func (*RateLimiter) Stop

func (rl *RateLimiter) Stop()

Stop cleanly shuts down the rate limiter and stops the replenishment goroutine

type RequestMetadata

type RequestMetadata struct {
	RequestID     string            `json:"requestId"`
	ClientVersion string            `json:"clientVersion"`
	Timestamp     time.Time         `json:"timestamp"`
	Labels        map[string]string `json:"labels,omitempty"`
}

RequestMetadata provides context about the request

type RetryConfig

type RetryConfig struct {
	MaxRetries int
	BaseDelay  time.Duration
	MaxDelay   time.Duration
	Multiplier float64
}

RetryConfig defines retry behavior

Jump to

Keyboard shortcuts

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