Documentation
¶
Overview ¶
Package adapters provides infrastructure adapters that implement application ports. These adapters wrap existing infrastructure components to satisfy port interfaces.
Index ¶
- type EngineAdapter
- type EngineFactoryAdapter
- type PluginAdapter
- type PluginDirectoryAdapter
- type PluginRuntimeAdapter
- type PluginRuntimeFactoryAdapter
- type ProfileLoaderAdapter
- func (a *ProfileLoaderAdapter) LoadProfile(path string) (*entities.Profile, error)
- func (a *ProfileLoaderAdapter) LoadProfileWithCLIVars(path string, cliVars map[string]interface{}) (*entities.Profile, error)
- func (a *ProfileLoaderAdapter) LoadProfileWithOptions(path string, cliVars map[string]interface{}, ...) (*entities.Profile, error)
- type ProfileLoaderOption
- type ProfileValidatorAdapter
- type RemoteFetchOptions
- type RemoteProfileFetcher
- type SystemConfigAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EngineAdapter ¶
type EngineAdapter struct {
// contains filtered or unexported fields
}
EngineAdapter wraps infrastructure engine to implement port interface.
func (*EngineAdapter) Close ¶
func (a *EngineAdapter) Close(ctx context.Context) error
Close closes the wrapped engine.
func (*EngineAdapter) Execute ¶
func (a *EngineAdapter) Execute(ctx context.Context, profile entities.ProfileReader) (*execution.ExecutionResult, error)
Execute executes the profile using the wrapped engine.
type EngineFactoryAdapter ¶
type EngineFactoryAdapter struct {
// contains filtered or unexported fields
}
EngineFactoryAdapter creates execution engines.
func NewEngineFactoryAdapter ¶
func NewEngineFactoryAdapter(redactor *sensitivedata.Redactor, runtime *infraconfig.RuntimeConfig) *EngineFactoryAdapter
NewEngineFactoryAdapter creates a new engine factory adapter.
func (*EngineFactoryAdapter) CreateEngine ¶
func (a *EngineFactoryAdapter) CreateEngine( ctx context.Context, profile entities.ProfileReader, grantedCaps map[string]*sdkEntities.GrantSet, pluginDir string, filters dto.FilterOptions, exec dto.ExecutionOptions, _ bool, ) (ports.ExecutionEngine, error)
CreateEngine creates an execution engine with capabilities.
type PluginAdapter ¶
type PluginAdapter struct {
// contains filtered or unexported fields
}
PluginAdapter wraps wasm.Plugin to implement ports.Plugin.
func (*PluginAdapter) Describe ¶
func (p *PluginAdapter) Describe(ctx context.Context) (*ports.PluginInfo, error)
Describe returns plugin metadata.
type PluginDirectoryAdapter ¶
type PluginDirectoryAdapter struct{}
PluginDirectoryAdapter resolves plugin directory paths.
func NewPluginDirectoryAdapter ¶
func NewPluginDirectoryAdapter() *PluginDirectoryAdapter
NewPluginDirectoryAdapter creates a new plugin directory adapter.
func (*PluginDirectoryAdapter) ResolvePluginDir ¶
func (a *PluginDirectoryAdapter) ResolvePluginDir(_ context.Context) (string, error)
ResolvePluginDir determines the plugin directory.
type PluginRuntimeAdapter ¶
type PluginRuntimeAdapter struct {
// contains filtered or unexported fields
}
PluginRuntimeAdapter wraps wasm.Runtime to implement ports.PluginRuntime.
func (*PluginRuntimeAdapter) Close ¶
func (r *PluginRuntimeAdapter) Close(ctx context.Context) error
Close releases runtime resources.
func (*PluginRuntimeAdapter) LoadPlugin ¶
func (r *PluginRuntimeAdapter) LoadPlugin(ctx context.Context, name string, wasmBytes []byte) (ports.Plugin, error)
LoadPlugin loads a plugin from WASM bytes.
func (*PluginRuntimeAdapter) UnwrapRuntime ¶
func (r *PluginRuntimeAdapter) UnwrapRuntime() *wasm.Runtime
UnwrapRuntime returns the underlying wasm.Runtime for infrastructure-layer use. This should only be used by infrastructure code that needs the concrete type.
type PluginRuntimeFactoryAdapter ¶
type PluginRuntimeFactoryAdapter struct {
// contains filtered or unexported fields
}
PluginRuntimeFactoryAdapter creates PluginRuntime instances. This adapter decouples the application layer from the concrete wasm.Runtime.
func NewPluginRuntimeFactoryAdapter ¶
func NewPluginRuntimeFactoryAdapter(redactor *sensitivedata.Redactor) *PluginRuntimeFactoryAdapter
NewPluginRuntimeFactoryAdapter creates a new runtime factory adapter.
func (*PluginRuntimeFactoryAdapter) NewRuntime ¶
func (f *PluginRuntimeFactoryAdapter) NewRuntime(ctx context.Context, opts ...ports.RuntimeOption) (ports.PluginRuntime, error)
NewRuntime creates a new plugin runtime with optional configuration. Accepts functional options from wasm package (automatically adds redactor from factory).
type ProfileLoaderAdapter ¶
type ProfileLoaderAdapter struct {
// contains filtered or unexported fields
}
ProfileLoaderAdapter adapts infrastructure profile loader to port interface.
func NewProfileLoaderAdapter ¶
func NewProfileLoaderAdapter(resolver ports.SecretResolver, opts ...ProfileLoaderOption) *ProfileLoaderAdapter
NewProfileLoaderAdapter creates a new profile loader adapter.
func (*ProfileLoaderAdapter) LoadProfile ¶
func (a *ProfileLoaderAdapter) LoadProfile(path string) (*entities.Profile, error)
LoadProfile loads and substitutes variables in a profile.
func (*ProfileLoaderAdapter) LoadProfileWithCLIVars ¶
func (a *ProfileLoaderAdapter) LoadProfileWithCLIVars(path string, cliVars map[string]interface{}) (*entities.Profile, error)
LoadProfileWithCLIVars loads a profile and merges CLI variables before substitution. CLI variables override profile variables at the same path. Supports both local file paths and remote URLs (https://, oci://).
func (*ProfileLoaderAdapter) LoadProfileWithOptions ¶
func (a *ProfileLoaderAdapter) LoadProfileWithOptions(path string, cliVars map[string]interface{}, remoteOpts ports.RemoteLoadOptions) (*entities.Profile, error)
LoadProfileWithOptions loads a profile with CLI variables and remote fetch options. remoteOpts configures behavior for remote profile fetching (refresh, timeout, etc.).
type ProfileLoaderOption ¶
type ProfileLoaderOption func(*ProfileLoaderAdapter)
ProfileLoaderOption configures a ProfileLoaderAdapter.
func WithRemoteFetcher ¶
func WithRemoteFetcher(fetcher RemoteProfileFetcher) ProfileLoaderOption
WithRemoteFetcher sets the remote profile fetcher.
type ProfileValidatorAdapter ¶
type ProfileValidatorAdapter struct {
// contains filtered or unexported fields
}
ProfileValidatorAdapter adapts infrastructure validator to port interface.
func NewProfileValidatorAdapter ¶
func NewProfileValidatorAdapter() *ProfileValidatorAdapter
NewProfileValidatorAdapter creates a new profile validator adapter.
func (*ProfileValidatorAdapter) Validate ¶
func (a *ProfileValidatorAdapter) Validate(profile *entities.Profile) error
Validate validates profile structure.
func (*ProfileValidatorAdapter) ValidateWithSchemas ¶
func (a *ProfileValidatorAdapter) ValidateWithSchemas(ctx context.Context, profile *entities.Profile, runtime ports.PluginRuntime) error
ValidateWithSchemas validates observation configs against plugin schemas.
type RemoteFetchOptions ¶
type RemoteFetchOptions struct {
Headers map[string]string
Timeout time.Duration
Refresh bool
AllowPrivateNetwork bool
Insecure bool
}
RemoteFetchOptions configures remote profile fetching.
type RemoteProfileFetcher ¶
type RemoteProfileFetcher interface {
FetchAsReader(ctx context.Context, url string, opts RemoteFetchOptions) (io.Reader, error)
}
RemoteProfileFetcher is the interface for fetching remote profiles. This allows the adapter to fetch profiles from URLs without depending on the concrete implementation from application/services.
type SystemConfigAdapter ¶
type SystemConfigAdapter struct {
// contains filtered or unexported fields
}
SystemConfigAdapter adapts system config loader to port interface.
func NewSystemConfigAdapter ¶
func NewSystemConfigAdapter() *SystemConfigAdapter
NewSystemConfigAdapter creates a new system config adapter.
func (*SystemConfigAdapter) LoadConfig ¶
LoadConfig loads system configuration from path.