Documentation ¶
Index ¶
- Constants
- Variables
- func GetElasticSearchPluginsParams(accountList []string, client *elastic.Client, index string) *elastic.SearchService
- func IngestPluginResult(ctx context.Context, aa aws.AwsAccount, pluginRes PluginResultES) error
- type AccountPlugin
- type PluginFunc
- type PluginParams
- type PluginResult
- type PluginResultES
Constants ¶
const IndexPrefixAccountPlugin = "account-plugins"
const TemplateAccountPlugin = `` /* 977-byte string literal not displayed */
const TemplateNameAccountPlugin = "account-plugins"
const TypeAccountPlugins = "account-plugin"
Variables ¶
var RegisteredAccountPlugins = make([]AccountPlugin, 0, 0x40)
RegisteredAccountPlugins is the list of registered plugins
Functions ¶
func GetElasticSearchPluginsParams ¶
func GetElasticSearchPluginsParams(accountList []string, client *elastic.Client, index string) *elastic.SearchService
GetElasticSearchPluginsParams is used to construct an ElasticSearch *elastic.SearchService used to perform a request on ES It takes as paramters :
- accountList []string : A slice of strings representing aws account ids
- client *elastic.Client : an instance of *elastic.Client that represent an Elastic Search client. It needs to be fully configured and ready to execute a client.Search()
- index string : The Elastic Search index on wich to execute the query.
This function excepts arguments passed to it to be sanitize. If they are not, the following cases will make it crash :
- If the client is nil or malconfigured, it will crash
- If the index is not an index present in the ES, it will crash
func IngestPluginResult ¶
func IngestPluginResult(ctx context.Context, aa aws.AwsAccount, pluginRes PluginResultES) error
IngestPluginResult saves a PluginResultES into elasticsearch
Types ¶
type AccountPlugin ¶
type AccountPlugin struct { Name string Description string Category string Label string Func PluginFunc BillingDataOnly bool }
AccountPlugin is the struct that defines the variables and functions a plugin needs to use
func (AccountPlugin) Register ¶
func (ap AccountPlugin) Register() AccountPlugin
Register allows plugins to register themselves on server startup
type PluginFunc ¶
type PluginFunc func(PluginParams) PluginResult
PluginFunc is the type that should be implemented by the plugin's function
type PluginParams ¶
type PluginParams struct { Context context.Context User users.User AwsAccount aws.AwsAccount AccountId string AccountCredentials *credentials.Credentials ESClient *elastic.Client }
PluginParams is the struct that is passed as a parameter for each plugin
type PluginResult ¶
type PluginResult struct { Result string Status string Details []string Error string Checked int Passed int }
PluginResult is the struct that each plugin should return
type PluginResultES ¶
type PluginResultES struct { AccountPluginIdx string `json:"accountPluginIdx"` Account string `json:"account"` ReportDate time.Time `json:"reportDate"` PluginName string `json:"pluginName"` Category string `json:"category"` Label string `json:"label"` Result string `json:"result"` Status string `json:"status"` Details []string `json:"details"` Error string `json:"error"` Checked int `json:"checked"` Passed int `json:"passed"` }
PluginResultES is the struct used to save a plugin result into elaticsearch