Documentation
¶
Index ¶
- func Load(source string) (*localConfig.ServiceConfig, error)
- type AuthConfig
- type DynamoGetter
- type Engine
- type EnrichmentConfig
- type EnrichmentSource
- type Executor
- type Loader
- type RateLimitConfig
- type S3Downloader
- type ServiceEngine
- func (se *ServiceEngine) Execute(ctx context.Context, payload []byte) (int, []byte, map[string]string, error)
- func (se *ServiceEngine) GetGraphQLEngine() *graphql.GraphQLEngine
- func (se *ServiceEngine) Reload() error
- func (se *ServiceEngine) RunMiddlewares(ctx context.Context) (context.Context, error)
- type UniversalLoader
- type ValidationReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load(source string) (*localConfig.ServiceConfig, error)
Load é a função simplificada que o ServiceEngine chama. Ela abstrai a criação do UniversalLoader.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Provider string `json:"provider"`
TokenURL string `json:"token_url"`
ClientID string `json:"client_id"`
Secret string `json:"client_secret"`
Scope string `json:"scope"`
}
AuthConfig define a configuração para obtenção de tokens
type DynamoGetter ¶
type DynamoGetter interface {
GetItem(ctx context.Context, params *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
}
type Engine ¶
type Engine interface {
// Init inicializa o motor com a configuração fornecida.
// Retorna um Executor pronto para processar requisições ou erro.
Init(cfg *config.ServiceConfig) (Executor, error)
}
Engine é o cérebro do framework. É responsável por "compilar" a configuração em tempo de inicialização (Boot Time), preparando os middlewares, parsers CEL e clientes de conexão.
type EnrichmentConfig ¶
type EnrichmentConfig struct {
Strategy string `json:"strategy"`
Sources []EnrichmentSource `json:"sources"`
}
Estruturas auxiliares para decodificar a configuração dos middlewares "on the fly"
type EnrichmentSource ¶
type Executor ¶
type Executor interface {
// Execute processa uma única requisição seguindo o roteiro do serviço.
// Recebe o payload bruto (bytes) e retorna a resposta processada (bytes) ou erro.
Execute(ctx context.Context, payload []byte) (int, []byte, map[string]string, error)
// Shutdown realiza o encerramento gracioso de recursos (fechar conexões, flush de logs).
Shutdown(ctx context.Context) error
}
Executor é a interface de tempo de execução (Runtime). Ela deve ser extremamente performática e thread-safe, pois será chamada concorrentemente por cada requisição HTTP/Evento.
type Loader ¶
type Loader interface {
// Load lê a configuração a partir de uma origem e retorna a struct validada.
Load(ctx context.Context, source string) (*config.ServiceConfig, error)
}
Loader é responsável por carregar e decodificar a configuração do serviço. Ele abstrai a origem do arquivo (Sistema de arquivos, S3, URL, etc).
type RateLimitConfig ¶
type S3Downloader ¶
type S3Downloader interface {
GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
}
type ServiceEngine ¶
type ServiceEngine struct {
ConfigSource string
Config *config.ServiceConfig
Logger zerolog.Logger
Metrics metrics.Provider
MetricProcessor *metrics.Processor
RuleManager *rules.RuleManager
Responder *responder.ResponseBuilder
GraphQLEngine *graphql.GraphQLEngine
AuthManagers map[string]*auth.Manager
// contains filtered or unexported fields
}
func NewServiceEngine ¶
func NewServiceEngine(cfg *config.ServiceConfig, configSource string) (*ServiceEngine, error)
func (*ServiceEngine) GetGraphQLEngine ¶
func (se *ServiceEngine) GetGraphQLEngine() *graphql.GraphQLEngine
func (*ServiceEngine) RunMiddlewares ¶
type UniversalLoader ¶
type UniversalLoader struct {
// contains filtered or unexported fields
}
UniversalLoader suporta múltiplas fontes de configuração (Local, S3, DynamoDB).
func NewUniversalLoader ¶
func NewUniversalLoader() *UniversalLoader
NewUniversalLoader cria uma nova instância.
func (*UniversalLoader) Load ¶
func (ul *UniversalLoader) Load(ctx context.Context, source string) (*localConfig.ServiceConfig, error)
Load detecta o esquema da fonte e carrega a configuração.
type ValidationReport ¶
type ValidationReport struct {
Valid bool `json:"valid"`
Errors []string `json:"errors,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
ValidationReport contém o resultado detalhado da análise.
func Analyze ¶
func Analyze(cfg *config.ServiceConfig) (*ValidationReport, error)
Analyze realiza uma inspeção profunda na configuração.