Documentation
¶
Index ¶
- Variables
- func NewAdapterResource() api.Resource
- func NewContractResource() api.Resource
- func NewLogResource() api.Resource
- func NewOpsResource(invoker *exec.Invoker, receiver *exec.Receiver) api.Resource
- func NewRouteResource() api.Resource
- func NewSystemResource(registry *auth.OutboundRegistry, inboundRegistry *auth.InboundRegistry, ...) api.Resource
- type AdapterParams
- type AdapterResource
- type AdapterSearch
- type ContractParams
- type ContractResource
- type ContractSearch
- type DryRunInboundParams
- type DryRunParams
- type InboundRequestParams
- type LogResource
- type LogSearch
- type OpsResource
- func (*OpsResource) DiagnoseRoutes(ctx fiber.Ctx, db orm.DB) error
- func (r *OpsResource) DryRun(ctx fiber.Ctx, db orm.DB, params DryRunParams) error
- func (r *OpsResource) DryRunInbound(ctx fiber.Ctx, db orm.DB, params DryRunInboundParams) error
- func (r *OpsResource) TestConnection(ctx fiber.Ctx, db orm.DB, params TestConnectionParams) error
- type RouteParams
- type RouteResource
- type RouteSearch
- type SystemParams
- type SystemResource
- type SystemSearch
- type TestConnectionParams
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Module( "vef:integration:resource", fx.Provide( fx.Annotate(NewContractResource, fx.ResultTags(`group:"vef:api:resources"`)), fx.Annotate(NewSystemResource, fx.ResultTags(`group:"vef:api:resources"`)), fx.Annotate(NewAdapterResource, fx.ResultTags(`group:"vef:api:resources"`)), fx.Annotate(NewRouteResource, fx.ResultTags(`group:"vef:api:resources"`)), fx.Annotate(NewLogResource, fx.ResultTags(`group:"vef:api:resources"`)), fx.Annotate(NewOpsResource, fx.ResultTags(`group:"vef:api:resources"`)), ), )
Module provides all integration API resources.
Functions ¶
func NewAdapterResource ¶
NewAdapterResource creates the adapter management resource.
func NewContractResource ¶
NewContractResource creates the contract management resource. Schemas are compiled at save time so a broken contract never reaches an invocation.
func NewLogResource ¶
NewLogResource creates the invocation log resource.
func NewOpsResource ¶
NewOpsResource creates the operational resource.
func NewRouteResource ¶
NewRouteResource creates the route management resource.
func NewSystemResource ¶
func NewSystemResource(registry *auth.OutboundRegistry, inboundRegistry *auth.InboundRegistry, codec *definition.SecretCodec, invoker *exec.Invoker) api.Resource
NewSystemResource creates the system management resource.
Types ¶
type AdapterParams ¶
type AdapterParams struct {
api.P
ID string `json:"id"`
SystemID string `json:"systemId" validate:"required"`
ContractID string `json:"contractId" validate:"required"`
Direction integration.Direction `json:"direction"`
Script string `json:"script" validate:"required"`
TimeoutMs int `json:"timeoutMs"`
IsEnabled bool `json:"isEnabled"`
}
AdapterParams contains the create/update parameters for an adapter.
type AdapterResource ¶
type AdapterResource struct {
api.Resource
crud.FindPage[integration.Adapter, AdapterSearch]
crud.FindAll[integration.Adapter, AdapterSearch]
crud.Create[integration.Adapter, AdapterParams]
crud.Update[integration.Adapter, AdapterParams]
crud.Delete[integration.Adapter]
}
AdapterResource handles adapter CRUD. Scripts are compile-checked at save time; the database's unique and foreign keys guard the binding itself.
type AdapterSearch ¶
type AdapterSearch struct {
crud.Sortable
SystemID string `json:"systemId" search:"eq,column=system_id"`
ContractID string `json:"contractId" search:"eq,column=contract_id"`
Direction integration.Direction `json:"direction" search:"eq,column=direction"`
IsEnabled *bool `json:"isEnabled" search:"eq,column=is_enabled"`
}
AdapterSearch contains the search parameters for adapters.
type ContractParams ¶
type ContractParams struct {
api.P
ID string `json:"id"`
Code string `json:"code" validate:"required"`
Name string `json:"name" validate:"required"`
Description *string `json:"description"`
Labels map[string]string `json:"labels"`
InputSchema json.RawMessage `json:"inputSchema"`
OutputSchema json.RawMessage `json:"outputSchema"`
IsEnabled bool `json:"isEnabled"`
}
ContractParams contains the create/update parameters for a contract.
type ContractResource ¶
type ContractResource struct {
api.Resource
crud.FindPage[integration.Contract, ContractSearch]
crud.FindAll[integration.Contract, ContractSearch]
crud.Create[integration.Contract, ContractParams]
crud.Update[integration.Contract, ContractParams]
crud.Delete[integration.Contract]
}
ContractResource handles contract CRUD using the standard api generics.
type ContractSearch ¶
type ContractSearch struct {
crud.Sortable
Code string `json:"code" search:"contains"`
Name string `json:"name" search:"contains"`
IsEnabled *bool `json:"isEnabled" search:"eq,column=is_enabled"`
// Labels filters by equality on every pair; it is applied through
// filterContractsByLabels because the search tag pipeline cannot express
// JSON-path predicates.
Labels map[string]string `json:"labels"`
}
ContractSearch contains the search parameters for contracts.
type DryRunInboundParams ¶
type DryRunInboundParams struct {
api.P
SystemCode string `json:"systemCode" validate:"required"`
ContractCode string `json:"contractCode" validate:"required"`
Script string `json:"script"`
Request InboundRequestParams `json:"request"`
HandlerOutput json.RawMessage `json:"handlerOutput"`
}
DryRunInboundParams contains the parameters of an inbound dry run. Script may be unsaved editor content (empty falls back to the saved inbound adapter script); HandlerOutput is the sample the stubbed business handler returns.
type DryRunParams ¶
type DryRunParams struct {
api.P
SystemCode string `json:"systemCode" validate:"required"`
ContractCode string `json:"contractCode" validate:"required"`
Script string `json:"script"`
Input json.RawMessage `json:"input"`
}
DryRunParams contains the parameters of a dry run. Script may be unsaved editor content; empty falls back to the saved adapter script.
type InboundRequestParams ¶
type InboundRequestParams struct {
Method string `json:"method"`
Path string `json:"path"`
Headers map[string]string `json:"headers"`
Query map[string]string `json:"query"`
Body string `json:"body"`
}
InboundRequestParams is the synthetic external request of an inbound dry run.
type LogResource ¶
type LogResource struct {
api.Resource
crud.FindPage[integration.InvocationLog, LogSearch]
crud.FindOne[integration.InvocationLog, LogSearch]
}
LogResource exposes the invocation log read-only: the page view for browsing and the single-record view for the full captures.
type LogSearch ¶
type LogSearch struct {
crud.Sortable
SystemCode string `json:"systemCode" search:"eq,column=system_code"`
ContractCode string `json:"contractCode" search:"eq,column=contract_code"`
Direction integration.Direction `json:"direction" search:"eq,column=direction"`
FailureKind string `json:"failureKind" search:"eq,column=failure_kind"`
RequestID string `json:"requestId" search:"eq,column=request_id"`
}
LogSearch contains the search parameters for invocation logs.
type OpsResource ¶
OpsResource hosts the operational endpoints of the integration engine: the script test consoles (dry_run, dry_run_inbound), the connection probe (test_connection), and the routing diagnosis (diagnose_routes). Dry run and probing operate on disabled definitions too — testing precedes enabling.
func (*OpsResource) DiagnoseRoutes ¶
DiagnoseRoutes reports the routing table's configuration gaps — dangling adapters, disabled targets, uncovered contracts — before they surface as runtime errors.
func (*OpsResource) DryRun ¶
func (r *OpsResource) DryRun(ctx fiber.Ctx, db orm.DB, params DryRunParams) error
DryRun executes a script against a system under a contract and returns the output, the failure classification, and the full wire trace. The calls it makes are real; nothing is recorded to statistics or the invocation log.
func (*OpsResource) DryRunInbound ¶
func (r *OpsResource) DryRunInbound(ctx fiber.Ctx, db orm.DB, params DryRunInboundParams) error
DryRunInbound executes an inbound script against a synthetic external request with the business handler stubbed to return the supplied sample output. Nothing runs against business code and nothing is recorded; verification is bypassed — the console tests translation, not credentials.
func (*OpsResource) TestConnection ¶
func (r *OpsResource) TestConnection(ctx fiber.Ctx, db orm.DB, params TestConnectionParams) error
TestConnection probes a saved system with a single request.
type RouteParams ¶
type RouteParams struct {
api.P
ID string `json:"id"`
RouteKey string `json:"routeKey"`
ContractID string `json:"contractId"`
SystemID string `json:"systemId" validate:"required"`
IsEnabled bool `json:"isEnabled"`
}
RouteParams contains the create/update parameters for a route. An empty RouteKey is the default route; an empty ContractID scopes the rule to every contract.
type RouteResource ¶
type RouteResource struct {
api.Resource
crud.FindPage[integration.Route, RouteSearch]
crud.FindAll[integration.Route, RouteSearch]
crud.Create[integration.Route, RouteParams]
crud.Update[integration.Route, RouteParams]
crud.Delete[integration.Route]
}
RouteResource handles route CRUD. The contract reference is validated at save time because the column carries the empty-string wildcard sentinel and has no foreign key.
type RouteSearch ¶
type RouteSearch struct {
crud.Sortable
RouteKey string `json:"routeKey" search:"contains,column=route_key"`
ContractID string `json:"contractId" search:"eq,column=contract_id"`
SystemID string `json:"systemId" search:"eq,column=system_id"`
IsEnabled *bool `json:"isEnabled" search:"eq,column=is_enabled"`
}
RouteSearch contains the search parameters for routes.
type SystemParams ¶
type SystemParams struct {
api.P
ID string `json:"id"`
Code string `json:"code" validate:"required"`
Name string `json:"name" validate:"required"`
BaseURL string `json:"baseUrl"`
OutboundAuth *integration.OutboundAuthConfig `json:"outboundAuth"`
OutboundEnvelope *integration.OutboundEnvelopeConfig `json:"outboundEnvelope"`
InboundAuth *integration.InboundAuthConfig `json:"inboundAuth"`
DataSource *integration.DataSourceConfig `json:"dataSource"`
Params map[string]string `json:"params"`
TimeoutMs int `json:"timeoutMs"`
Retry *integration.RetryPolicy `json:"retry"`
IsEnabled bool `json:"isEnabled"`
}
SystemParams contains the create/update parameters for a system. Sensitive auth parameter values and the data source password may carry integration.MaskedSecret to keep the stored value unchanged.
type SystemResource ¶
type SystemResource struct {
api.Resource
crud.FindPage[integration.System, SystemSearch]
crud.FindAll[integration.System, SystemSearch]
crud.Create[integration.System, SystemParams]
crud.Update[integration.System, SystemParams]
crud.Delete[integration.System]
}
SystemResource handles system CRUD. Writes encrypt sensitive auth parameters and the data source password, resolving masked placeholders; reads always mask them. Deleting a system (or removing/renaming its data source) releases its datasource registry entry.