Documentation
¶
Index ¶
- type AuditHandler
- type AuditRecordResponse
- type BudgetRequest
- type CreateTemplateRequest
- type ErrorResponse
- type HealthHandler
- type HealthResponse
- type InstantiateTemplateRequest
- type InstantiateTemplateResponse
- type ListAuditResponse
- type ListTemplatesResponse
- type ScheduleRequest
- type TemplateHandler
- type TemplateResponse
- type TemplateVarRequest
- type TemplateVarResponse
- type UpdateTemplateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditHandler ¶
type AuditHandler struct {
// contains filtered or unexported fields
}
AuditHandler handles audit log endpoints
func NewAuditHandler ¶
func NewAuditHandler(auditRepo storage.AuditRepository, logger *slog.Logger) (*AuditHandler, error)
NewAuditHandler creates a new audit handler
func (*AuditHandler) ServeHTTP ¶
func (h *AuditHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles GET /api/v1/audit
type AuditRecordResponse ¶
type AuditRecordResponse struct {
ID string `json:"id"`
EventType string `json:"event_type"`
Severity string `json:"severity"`
Timestamp string `json:"timestamp"`
APIKeyID string `json:"api_key_id,omitempty"`
ActorAddress string `json:"actor_address,omitempty"`
SignRequestID *string `json:"sign_request_id,omitempty"`
SignerAddress *string `json:"signer_address,omitempty"`
ChainType *string `json:"chain_type,omitempty"`
ChainID *string `json:"chain_id,omitempty"`
RuleID *string `json:"rule_id,omitempty"`
Details json.RawMessage `json:"details,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
RequestMethod string `json:"request_method,omitempty"`
RequestPath string `json:"request_path,omitempty"`
}
AuditRecordResponse represents an audit record in API responses
type BudgetRequest ¶
type BudgetRequest struct {
MaxTotal string `json:"max_total"`
MaxPerTx string `json:"max_per_tx"`
MaxTxCount int `json:"max_tx_count,omitempty"`
AlertPct int `json:"alert_pct,omitempty"`
}
BudgetRequest represents budget config in an instantiate request
type CreateTemplateRequest ¶
type CreateTemplateRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
Mode string `json:"mode"`
Variables []TemplateVarRequest `json:"variables,omitempty"`
Config map[string]interface{} `json:"config"`
BudgetMetering map[string]interface{} `json:"budget_metering,omitempty"`
TestVariables map[string]string `json:"test_variables,omitempty"`
Enabled bool `json:"enabled"`
}
CreateTemplateRequest represents a request to create a new template via API
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse represents an error response
type HealthHandler ¶
type HealthHandler struct {
// contains filtered or unexported fields
}
HealthHandler handles health check requests
func NewHealthHandler ¶
func NewHealthHandler(version string) *HealthHandler
NewHealthHandler creates a new health handler
func (*HealthHandler) ServeHTTP ¶
func (h *HealthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles GET /health
type HealthResponse ¶
HealthResponse represents the health check response
type InstantiateTemplateRequest ¶
type InstantiateTemplateRequest struct {
TemplateName string `json:"template_name,omitempty"`
Name string `json:"name,omitempty"`
Variables map[string]string `json:"variables"`
ChainType *string `json:"chain_type,omitempty"`
ChainID *string `json:"chain_id,omitempty"`
APIKeyID *string `json:"api_key_id,omitempty"`
SignerAddress *string `json:"signer_address,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
ExpiresIn *string `json:"expires_in,omitempty"` // duration string e.g. "24h", "168h"
Budget *BudgetRequest `json:"budget,omitempty"`
Schedule *ScheduleRequest `json:"schedule,omitempty"`
}
InstantiateTemplateRequest represents a request to create a rule instance from a template
type InstantiateTemplateResponse ¶
type InstantiateTemplateResponse struct {
Rule json.RawMessage `json:"rule"`
Budget json.RawMessage `json:"budget,omitempty"`
}
InstantiateTemplateResponse represents the response for creating a rule instance
type ListAuditResponse ¶
type ListAuditResponse struct {
Records []AuditRecordResponse `json:"records"`
Total int `json:"total"`
NextCursor *string `json:"next_cursor,omitempty"`
NextCursorID *string `json:"next_cursor_id,omitempty"`
HasMore bool `json:"has_more"`
}
ListAuditResponse represents the response for listing audit records
type ListTemplatesResponse ¶
type ListTemplatesResponse struct {
Templates []TemplateResponse `json:"templates"`
Total int `json:"total"`
}
ListTemplatesResponse represents the response for listing templates
type ScheduleRequest ¶
type ScheduleRequest struct {
Period string `json:"period"` // duration string e.g. "24h"
StartAt *time.Time `json:"start_at,omitempty"`
}
ScheduleRequest represents schedule config in an instantiate request
type TemplateHandler ¶
type TemplateHandler struct {
// contains filtered or unexported fields
}
TemplateHandler handles template management and instance creation endpoints
func NewTemplateHandler ¶
func NewTemplateHandler( templateRepo storage.TemplateRepository, templateService *service.TemplateService, logger *slog.Logger, ) (*TemplateHandler, error)
NewTemplateHandler creates a new template handler
func (*TemplateHandler) ServeHTTP ¶
func (h *TemplateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles /api/v1/templates and /api/v1/templates/{id}
func (*TemplateHandler) ServeInstanceHTTP ¶
func (h *TemplateHandler) ServeInstanceHTTP(w http.ResponseWriter, r *http.Request)
ServeInstanceHTTP handles /api/v1/templates/instances/{ruleID}/revoke
type TemplateResponse ¶
type TemplateResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
Mode string `json:"mode"`
Source string `json:"source"`
Variables []TemplateVarResponse `json:"variables,omitempty"`
Config json.RawMessage `json:"config,omitempty"`
BudgetMetering json.RawMessage `json:"budget_metering,omitempty"`
Enabled bool `json:"enabled"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
TemplateResponse represents a template in API responses
type TemplateVarRequest ¶
type TemplateVarRequest struct {
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description,omitempty"`
Required bool `json:"required"`
Default string `json:"default,omitempty"`
}
TemplateVarRequest represents a template variable in a create/update request
type TemplateVarResponse ¶
type TemplateVarResponse struct {
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description,omitempty"`
Required bool `json:"required"`
Default string `json:"default,omitempty"`
}
TemplateVarResponse represents a template variable in API responses
type UpdateTemplateRequest ¶
type UpdateTemplateRequest struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Config map[string]interface{} `json:"config,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
UpdateTemplateRequest represents a request to update an existing template