Documentation
¶
Index ¶
Constants ¶
const (
// Base64Prefix is the prefix for Base64 format imports
Base64Prefix = "TGB64"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base64Importer ¶
type Base64Importer struct {
// contains filtered or unexported fields
}
Base64Importer imports data from Base64-encoded JSONL format
func NewBase64Importer ¶
func NewBase64Importer() *Base64Importer
NewBase64Importer creates a new Base64 importer
func (*Base64Importer) Format ¶
func (i *Base64Importer) Format() Format
Format returns the format type
func (*Base64Importer) Import ¶
func (i *Base64Importer) Import(data string, globalConfig *config.Config, opts ImportOptions) (*ImportResult, error)
Import imports data from Base64 format
type ImportLine ¶
type ImportLine struct {
Type string `json:"type"`
}
ImportLine is the base type for all import lines
type ImportMetadata ¶
type ImportMetadata struct {
Type string `json:"type"`
Version string `json:"version"`
ExportedAt string `json:"exported_at"`
}
ImportMetadata represents the metadata line
type ImportOptions ¶
type ImportOptions struct {
// OnProviderConflict specifies what to do when a provider already exists.
// "use" - use existing provider, "skip" - skip this provider, "suffix" - create with suffixed name
OnProviderConflict string
// OnRuleConflict specifies what to do when a rule already exists.
// "skip" - skip import, "update" - update existing rule, "new" - create with new name
OnRuleConflict string
// Quiet suppresses progress output
Quiet bool
}
ImportOptions controls how imports are handled when conflicts occur
type ImportProviderData ¶
type ImportProviderData struct {
Type string `json:"type"`
UUID string `json:"uuid"`
Name string `json:"name"`
APIBase string `json:"api_base"`
APIStyle string `json:"api_style"`
AuthType string `json:"auth_type"`
Token string `json:"token"`
OAuthDetail *typ.OAuthDetail `json:"oauth_detail"`
Enabled bool `json:"enabled"`
ProxyURL string `json:"proxy_url"`
Timeout int64 `json:"timeout"`
Tags []string `json:"tags"`
Models []string `json:"models"`
}
ImportProviderData represents the provider import data
type ImportResult ¶
type ImportResult struct {
RuleCreated bool
RuleUpdated bool
ProvidersCreated int
ProvidersUsed int
Providers []ProviderImportInfo
ProviderMap map[string]string // old UUID -> new UUID
}
ImportResult contains the results of an import operation
func Import ¶
func Import(data string, globalConfig *config.Config, format Format, opts ImportOptions) (*ImportResult, error)
Import imports a rule with providers from data in the specified format
type ImportRuleData ¶
type ImportRuleData struct {
Type string `json:"type"`
UUID string `json:"uuid"`
Scenario string `json:"scenario"`
RequestModel string `json:"request_model"`
ResponseModel string `json:"response_model"`
Description string `json:"description"`
Services []*loadbalance.Service `json:"services"`
LBTactic typ.Tactic `json:"lb_tactic"`
Active bool `json:"active"`
SmartEnabled bool `json:"smart_enabled"`
SmartRouting []interface{} `json:"smart_routing"`
}
ImportRuleData represents the rule import data
type Importer ¶
type Importer interface {
Import(data string, globalConfig *config.Config, opts ImportOptions) (*ImportResult, error)
Format() Format
}
Importer defines the interface for import implementations
func NewImporter ¶
NewImporter creates an importer for the specified format
type JSONLImporter ¶
type JSONLImporter struct{}
JSONLImporter imports data from JSONL format
func NewJSONLImporter ¶
func NewJSONLImporter() *JSONLImporter
NewJSONLImporter creates a new JSONL importer
func (*JSONLImporter) Format ¶
func (i *JSONLImporter) Format() Format
Format returns the format type
func (*JSONLImporter) Import ¶
func (i *JSONLImporter) Import(data string, globalConfig *config.Config, opts ImportOptions) (*ImportResult, error)
Import imports data from JSONL format
type ProviderImportInfo ¶
type ProviderImportInfo struct {
UUID string
Name string
Action string // "created", "used", "skipped"
}
ProviderImportInfo contains information about an imported or used provider