resource

package
v0.39.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func NewAdapterResource() api.Resource

NewAdapterResource creates the adapter management resource.

func NewContractResource

func NewContractResource() api.Resource

NewContractResource creates the contract management resource. Schemas are compiled at save time so a broken contract never reaches an invocation.

func NewLogResource

func NewLogResource() api.Resource

NewLogResource creates the invocation log resource.

func NewOpsResource

func NewOpsResource(invoker *exec.Invoker, receiver *exec.Receiver) api.Resource

NewOpsResource creates the operational resource.

func NewRouteResource

func NewRouteResource() api.Resource

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

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 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

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

type OpsResource struct {
	api.Resource
	// contains filtered or unexported fields
}

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

func (*OpsResource) DiagnoseRoutes(ctx fiber.Ctx, db orm.DB) error

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

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

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.

type SystemSearch

type SystemSearch struct {
	crud.Sortable

	Code      string `json:"code" search:"contains"`
	Name      string `json:"name" search:"contains"`
	IsEnabled *bool  `json:"isEnabled" search:"eq,column=is_enabled"`
}

SystemSearch contains the search parameters for systems.

type TestConnectionParams

type TestConnectionParams struct {
	api.P

	SystemCode string `json:"systemCode" validate:"required"`
	Method     string `json:"method"`
	Path       string `json:"path"`
}

TestConnectionParams contains the parameters of a connection probe against a saved system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL