Documentation ¶
Index ¶
- Constants
- Variables
- func HasLicenseConfig(config PlusConfig) bool
- func IsOAuthPermittedUserList(config PlusConfig) bool
- func IsPlusEnabled(config PlusConfig) bool
- func IsPlusOAuthEnabled(config PlusConfig) bool
- type Capability
- type Manager
- type ManagerProvider
- func (pm *ManagerProvider) GetAlertingCapabilityEx() (capEx alertingcap.CapabilityEx)
- func (pm *ManagerProvider) GetConfigValidator(capName string) (v validator.Validator)
- func (pm *ManagerProvider) GetExtendedPermissionCapabilityEx() (capEx extendedpermission.CapabilityEx)
- func (pm *ManagerProvider) GetLicenseCapabilityEx() (capEx licensecap.CapabilityEx)
- func (pm *ManagerProvider) GetOAuthCapabilityEx() (capEx oauth.CapabilityEx)
- func (pm *ManagerProvider) GetStatusCapabilityEx() (capEx status.CapabilityEx)
- func (pm *ManagerProvider) InitPlusManager(cfg *PlusConfig, pluginLoader loader.Loader, logger *logger.Logger)
- func (pm *ManagerProvider) IsEnabledCapability(capName string) (isEnabled bool)
- func (pm *ManagerProvider) RegisterCapability(capName string, newCap Capability) (cap Capability, err error)
- type PluginConfig
- type PlusConfig
Constants ¶
const ( PlusOAuthCapability = "plus-oauth" PlusStatusCapability = "plus-status" PlusLicenseCapability = "plus-license" PlusExtendedPermissionCapability = "plus-extendedpermission" PlusAlertingCapability = "plus-alerting" )
Variables ¶
Functions ¶
func HasLicenseConfig ¶
func HasLicenseConfig(config PlusConfig) bool
func IsOAuthPermittedUserList ¶
func IsOAuthPermittedUserList(config PlusConfig) bool
func IsPlusEnabled ¶
func IsPlusEnabled(config PlusConfig) bool
func IsPlusOAuthEnabled ¶
func IsPlusOAuthEnabled(config PlusConfig) bool
Types ¶
type Capability ¶
type Capability interface { GetInitFuncName() (name string) InitProvider(sym plugin.Symbol) GetConfigValidator() (v validator.Validator) }
Capability is used to track loaded info about a plugin capability. See the corresponding individual plugin Capability structs.
type Manager ¶
type Manager interface { InitPlusManager(cfg *PlusConfig, pluginLoader loader.Loader, logger *logger.Logger) // General registry type funcs RegisterCapability(capName string, newCap Capability) (cap Capability, err error) IsEnabledCapability(capName string) (isEnabled bool) // Access specific capabilities GetOAuthCapabilityEx() (capEx oauth.CapabilityEx) GetStatusCapabilityEx() (capEx status.CapabilityEx) GetExtendedPermissionCapabilityEx() (capEx extendedpermission.CapabilityEx) GetLicenseCapabilityEx() (capEx licensecap.CapabilityEx) GetAlertingCapabilityEx() (capEx alertingcap.CapabilityEx) // Access config validation GetConfigValidator(capName string) (v validator.Validator) }
Manager defines the plus manager behavior
type ManagerProvider ¶
type ManagerProvider struct { Config *PlusConfig // contains filtered or unexported fields }
ManagerProvider contains a map of all available capabilities and the overall plugin config. The manager is thread safe for reads but not initialization.
func NewPlusManager ¶
func NewPlusManager(ctx context.Context, cfg *PlusConfig, pluginLoader loader.Loader, l *logger.Logger, filesAPI files.FileAPI) (pm *ManagerProvider, err error)
NewPlusManager checks the plugin exists at the specified path, allocates a new plus manager and initializes it
func (*ManagerProvider) GetAlertingCapabilityEx ¶
func (pm *ManagerProvider) GetAlertingCapabilityEx() (capEx alertingcap.CapabilityEx)
GetAlertingCapabilityEx returns a cast version of the Plus Alerting capability
func (*ManagerProvider) GetConfigValidator ¶
func (pm *ManagerProvider) GetConfigValidator(capName string) (v validator.Validator)
GetConfigValidator gets a validator interface that can be invoked to validate the capability config
func (*ManagerProvider) GetExtendedPermissionCapabilityEx ¶
func (pm *ManagerProvider) GetExtendedPermissionCapabilityEx() (capEx extendedpermission.CapabilityEx)
GetExtendedPermissionCapabilityEx returns a cast version of the Plus Extended Permission capability
func (*ManagerProvider) GetLicenseCapabilityEx ¶
func (pm *ManagerProvider) GetLicenseCapabilityEx() (capEx licensecap.CapabilityEx)
GetLicenseCapabilityEx returns a cast version of the Plus License capability
func (*ManagerProvider) GetOAuthCapabilityEx ¶
func (pm *ManagerProvider) GetOAuthCapabilityEx() (capEx oauth.CapabilityEx)
GetOAuthCapability returns a cast version of the OAuth capability
func (*ManagerProvider) GetStatusCapabilityEx ¶
func (pm *ManagerProvider) GetStatusCapabilityEx() (capEx status.CapabilityEx)
GetStatusCapabilityEx returns a cast version of the Plus Status capability
func (*ManagerProvider) InitPlusManager ¶
func (pm *ManagerProvider) InitPlusManager(cfg *PlusConfig, pluginLoader loader.Loader, logger *logger.Logger)
InitPlusManager initializes a plus manager
func (*ManagerProvider) IsEnabledCapability ¶
func (pm *ManagerProvider) IsEnabledCapability(capName string) (isEnabled bool)
IsEnabledCapability returns whether the specified capability is enabled
func (*ManagerProvider) RegisterCapability ¶
func (pm *ManagerProvider) RegisterCapability(capName string, newCap Capability) (cap Capability, err error)
RegisterCapability adds a new plugin capability component, including loading the relevant init func for the capability from the plugin and initializing the capability (via InitProvider)
type PluginConfig ¶
type PluginConfig struct {
PluginPath string `mapstructure:"plugin_path"`
}
PluginConfig contains the config related to the plugin itself
type PlusConfig ¶
type PlusConfig struct { PluginConfig *PluginConfig `mapstructure:"plus-plugin"` OAuthConfig *oauth.Config `mapstructure:"plus-oauth"` LicenseConfig *license.Config `mapstructure:"plus-license"` }
PlusConfig contains the overall config for the rport-plus plugin. note that each capability should have it's own config section in the config file.