Documentation
¶
Index ¶
- type ConfigValidator
- type CustomMetricDefinition
- type DatadogConf
- type EnrichmentSourceConfig
- type ErrorResponse
- type GQLField
- type GQLType
- type GraphQLConf
- type InputStep
- type LoggingConf
- type MetricRegistrationRule
- type MetricsConf
- type MiddlewareConf
- type OutputStep
- type ProcessingStep
- type ServiceConfig
- type ServiceDetails
- type StepsConf
- type TargetConf
- type TransformationRule
- type ValidationRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigValidator ¶
type ConfigValidator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator() *ConfigValidator
NewValidator cria uma nova instância do validador
func (*ConfigValidator) Validate ¶
func (cv *ConfigValidator) Validate(cfg *ServiceConfig) error
Validate realiza validações estruturais (tags) e semânticas (lógica)
type CustomMetricDefinition ¶
type DatadogConf ¶
type DatadogConf struct {
Enabled bool `yaml:"enabled" env:"DD_ENABLED"`
Addr string `yaml:"addr" env:"DD_AGENT_HOST" validate:"required_if=Enabled true"`
Namespace string `yaml:"namespace"`
CustomDefinitions []CustomMetricDefinition `yaml:"custom_definitions" validate:"dive"`
}
type EnrichmentSourceConfig ¶
type ErrorResponse ¶
type GQLField ¶
type GQLField struct {
Type string `yaml:"type"`
Description string `yaml:"description"`
Args map[string]string `yaml:"args"`
Source *EnrichmentSourceConfig `yaml:"source"`
}
type GraphQLConf ¶
type InputStep ¶
type InputStep struct {
Validations []ValidationRule `yaml:"validations" validate:"dive"`
}
type LoggingConf ¶
type MetricRegistrationRule ¶
type MetricsConf ¶
type MetricsConf struct {
Datadog DatadogConf `yaml:"datadog"`
}
type MiddlewareConf ¶
type OutputStep ¶
type OutputStep struct {
StatusCode int `yaml:"status_code" validate:"gte=200,lt=600"`
Body map[string]interface{} `yaml:"body" validate:"required"` // Mantido como MAP para o analyzer funcionar
Headers map[string]string `yaml:"headers"`
Target TargetConf `yaml:"target"`
Validations []ValidationRule `yaml:"validations" validate:"dive"`
Metrics []MetricRegistrationRule `yaml:"metrics" validate:"dive"`
}
type ProcessingStep ¶
type ProcessingStep struct {
Validations []ValidationRule `yaml:"validations" validate:"dive"`
Transformations []TransformationRule `yaml:"transformations" validate:"dive"`
}
type ServiceConfig ¶
type ServiceConfig struct {
Version string `yaml:"version" validate:"required"`
Service ServiceDetails `yaml:"service" validate:"required"`
Middlewares []MiddlewareConf `yaml:"middlewares" validate:"dive"`
Steps *StepsConf `yaml:"steps"` // Ponteiro para ser opcional no GraphQL
GraphQL GraphQLConf `yaml:"graphql"`
}
ServiceConfig representa a estrutura raiz do arquivo YAML de roteirização.
type ServiceDetails ¶
type ServiceDetails struct {
Name string `yaml:"name" validate:"required,hostname_rfc1123"`
Runtime string `yaml:"runtime" validate:"required,oneof=local lambda ecs eks ec2"`
Type string `yaml:"type"`
Port int `yaml:"port" validate:"required_if=Runtime local"` // Obrigatório apenas se local
Route string `yaml:"route" validate:"required,startswith=/"`
Timeout string `yaml:"timeout" validate:"required"` // Ex: "500ms", "2s"
OnTimeout ErrorResponse `yaml:"on_timeout"`
Logging LoggingConf `yaml:"logging"`
Metrics MetricsConf `yaml:"metrics"`
}
ServiceDetails contém os metadados e configurações de runtime do serviço.
func (ServiceDetails) GetTimeout ¶
func (s ServiceDetails) GetTimeout() time.Duration
type StepsConf ¶
type StepsConf struct {
Input InputStep `yaml:"input"`
Processing ProcessingStep `yaml:"processing"`
Output OutputStep `yaml:"output"`
}
type TargetConf ¶
type TransformationRule ¶
type ValidationRule ¶
type ValidationRule struct {
ID string `yaml:"id" validate:"required"`
Expr string `yaml:"expr" validate:"required"`
OnFail ErrorResponse `yaml:"on_fail" validate:"required"`
}
Click to show internal directories.
Click to hide internal directories.