Documentation
¶
Overview ¶
Copyright (c) 2025 Nexlayer. All rights reserved.n// Use of this source code is governed by an MIT-stylen// license that can be found in the LICENSE file.nn
Copyright (c) 2025 Nexlayer. All rights reserved.n// Use of this source code is governed by an MIT-stylen// license that can be found in the LICENSE file.nn
Index ¶
- type Manager
- func (m *Manager) GetCommands() []*cobra.Command
- func (m *Manager) GetPlugin(name string) (Plugin, bool)
- func (m *Manager) ListPlugins() map[string]string
- func (m *Manager) LoadPlugin(path string) error
- func (m *Manager) LoadPluginsFromDir(dir string) error
- func (m *Manager) RunPlugin(name string, opts map[string]interface{}) error
- type Plugin
- type PluginDependencies
- type SmartDeploymentsPlugin
- func (p *SmartDeploymentsPlugin) Commands() []*cobra.Command
- func (p *SmartDeploymentsPlugin) Description() string
- func (p *SmartDeploymentsPlugin) Init(deps *PluginDependencies) error
- func (p *SmartDeploymentsPlugin) Name() string
- func (p *SmartDeploymentsPlugin) Run(opts map[string]interface{}) error
- func (p *SmartDeploymentsPlugin) Version() string
- type TemplateSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is responsible for loading, initializing, and managing plugins.
func NewManager ¶
func NewManager(deps *PluginDependencies, pluginsDir string) *Manager
NewManager creates and returns a new Manager instance.
func (*Manager) GetCommands ¶
GetCommands aggregates and returns all CLI commands provided by loaded plugins.
func (*Manager) ListPlugins ¶
ListPlugins returns a map of plugin names and their versions.
func (*Manager) LoadPlugin ¶
LoadPlugin loads and initializes a plugin from the specified path. It ensures the plugin is not loaded more than once.
func (*Manager) LoadPluginsFromDir ¶
LoadPluginsFromDir loads all plugins (files ending in .so) from the specified directory. If no directory is provided, the default plugins directory is used.
type Plugin ¶
type Plugin interface {
// Name returns the plugin's name.
Name() string
// Description returns a description of what the plugin does.
Description() string
// Version returns the plugin version.
Version() string
// Commands returns any additional CLI commands provided by the plugin.
Commands() []*cobra.Command
// Init initializes the plugin with dependencies.
Init(deps *PluginDependencies) error
// Run executes the plugin with the given options.
Run(opts map[string]interface{}) error
}
Plugin is the interface that all Nexlayer plugins must implement. This interface provides methods for name, description, version, additional commands, initialization with dependencies, and execution.
type PluginDependencies ¶
type PluginDependencies struct {
APIClient api.APIClient
Logger *observability.Logger
UIManager *ui.Manager
}
PluginDependencies contains the dependencies available to plugins.
type SmartDeploymentsPlugin ¶
type SmartDeploymentsPlugin struct {
// contains filtered or unexported fields
}
SmartDeploymentsPlugin implements the Plugin interface to provide AI-powered recommendations that align with Nexlayer Cloud's templating YAML system and deployment behavior.
var SmartDeploymentsPluginInstance SmartDeploymentsPlugin
Export the plugin instance.
func (*SmartDeploymentsPlugin) Commands ¶
func (p *SmartDeploymentsPlugin) Commands() []*cobra.Command
Commands returns the list of CLI commands provided by the plugin.
func (*SmartDeploymentsPlugin) Description ¶
func (p *SmartDeploymentsPlugin) Description() string
Description returns a short description of what the plugin does.
func (*SmartDeploymentsPlugin) Init ¶
func (p *SmartDeploymentsPlugin) Init(deps *PluginDependencies) error
Init initializes the plugin with its dependencies.
func (*SmartDeploymentsPlugin) Name ¶
func (p *SmartDeploymentsPlugin) Name() string
Name returns the plugin's name.
func (*SmartDeploymentsPlugin) Run ¶
func (p *SmartDeploymentsPlugin) Run(opts map[string]interface{}) error
Run executes the plugin in non-interactive mode (if needed).
func (*SmartDeploymentsPlugin) Version ¶
func (p *SmartDeploymentsPlugin) Version() string
Version returns the plugin version.
type TemplateSpec ¶
type TemplateSpec struct {
Version string `yaml:"version"`
Schema map[string]interface{} `yaml:"schema"`
Components map[string]interface{} `yaml:"componentTypes"`
Examples map[string]interface{} `yaml:"examples"`
BestPractices map[string]interface{} `yaml:"bestPractices"`
Validation map[string]interface{} `yaml:"validation"`
}
TemplateSpec represents the Nexlayer template specification
func LoadTemplateSpec ¶
func LoadTemplateSpec() (*TemplateSpec, error)
LoadTemplateSpec loads the template specification from the YAML file
func (*TemplateSpec) GetComponentDefaults ¶
func (s *TemplateSpec) GetComponentDefaults(componentType, subType string) (map[string]interface{}, error)
GetComponentDefaults returns the default configuration for a given component type
func (*TemplateSpec) ValidateTemplate ¶
func (s *TemplateSpec) ValidateTemplate(template map[string]interface{}) []string
ValidateTemplate validates a template against the specification