// GetConfigPolicy returns a config policy
func (LibvirtCollector) GetConfigPolicy() (plugin.ConfigPolicy, error) {
	policy := plugin.NewConfigPolicy()

	policy.AddNewStringRule([]string{"intel", "libvirt"}, "uri", false, plugin.SetDefaultString(defaultURI))
	policy.AddNewBoolRule([]string{"intel", "libvirt"}, "nova", false, plugin.SetDefaultBool(false))

	return *policy, nil
}
func (f *GraphitePublisher) GetConfigPolicy() (plugin.ConfigPolicy, error) {
	policy := plugin.NewConfigPolicy()

	policy.AddNewStringRule([]string{""}, "server", true)
	policy.AddNewIntRule([]string{""}, "port", false, plugin.SetDefaultInt(2003))
	policy.AddNewStringRule([]string{""}, "prefix_tags", false, plugin.SetDefaultString("plugin_running_on"))
	policy.AddNewStringRule([]string{""}, "prefix", false)
	policy.AddNewStringRule([]string{""}, "log-level", false)

	return *policy, nil
}
예제 #3
0
파일: mock.go 프로젝트: katarzyna-z/snap
// GetConfigPolicy returns a ConfigPolicy for testing
func (f *Mock) GetConfigPolicy() (plugin.ConfigPolicy, error) {
	p := plugin.NewConfigPolicy()

	err := p.AddNewStringRule([]string{"intel", "mock", "foo"}, "name", false, plugin.SetDefaultString("bob"))
	if err != nil {
		return *p, err
	}

	err = p.AddNewStringRule([]string{"intel", "mock", "foo"}, "password", true)

	return *p, err
}