• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang cpolicy.NewStringRule函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/intelsdi-x/snap/control/plugin/cpolicy.NewStringRule函数的典型用法代码示例。如果您正苦于以下问题:Golang NewStringRule函数的具体用法?Golang NewStringRule怎么用?Golang NewStringRule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewStringRule函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: GetConfigPolicy

func (rmq *rmqPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	config := cpolicy.NewPolicyNode()

	r1, err := cpolicy.NewStringRule("address", true)
	handleErr(err)
	r1.Description = "RabbitMQ Address (host:port)"
	config.Add(r1)

	r2, err := cpolicy.NewStringRule("exchange_name", true)
	handleErr(err)
	r2.Description = "RabbitMQ Exchange Name"
	config.Add(r2)

	r3, err := cpolicy.NewStringRule("exchange_type", true)
	handleErr(err)
	r3.Description = "RabbitMQ Exchange Type"
	config.Add(r3)

	r4, err := cpolicy.NewStringRule("routing_key", true)
	handleErr(err)
	r4.Description = "RabbitMQ Routing Key"
	config.Add(r4)

	cp.Add([]string{""}, config)
	return cp, nil
}
开发者ID:geauxvirtual,项目名称:snap-plugin-publisher-rabbitmq,代码行数:27,代码来源:rmq.go


示例2: GetConfigPolicy

func (m *mockSessionStatePluginProxy) GetConfigPolicy(args []byte, reply *[]byte) error {
	cp := cpolicy.New()
	n1 := cpolicy.NewPolicyNode()
	if m.c {
		r1, _ := cpolicy.NewStringRule("name", false, "bob")
		n1.Add(r1)
		r2, _ := cpolicy.NewIntegerRule("someInt", true, 100)
		n1.Add(r2)
		r3, _ := cpolicy.NewStringRule("password", true)
		n1.Add(r3)
		r4, _ := cpolicy.NewFloatRule("somefloat", false, 3.14)
		n1.Add(r4)
		cp.Add([]string{"foo", "bar"}, n1)
	} else {
		r1, _ := cpolicy.NewIntegerRule("SomeRequiredInt", true, 1)
		r2, _ := cpolicy.NewStringRule("password", true)
		r3, _ := cpolicy.NewFloatRule("somefloat", false, 3.14)
		n1.Add(r1, r2, r3)
		cp.Add([]string{""}, n1)
	}
	cpr := plugin.GetConfigPolicyReply{Policy: cp}
	var err error
	*reply, err = m.e.Encode(cpr)
	return err
}
开发者ID:jeffweiss,项目名称:snap,代码行数:25,代码来源:httpjsonrpc_test.go


示例3: GetConfigPolicy

// GetConfigPolicy returns a config policy
func (s *PostgreSQLPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	config := cpolicy.NewPolicyNode()

	username, err := cpolicy.NewStringRule("username", true)
	handleErr(err)
	username.Description = "Username to login to the PostgreSQL server"

	password, err := cpolicy.NewStringRule("password", true)
	handleErr(err)
	password.Description = "Password to login to the PostgreSQL server"

	database, err := cpolicy.NewStringRule("database", true)
	handleErr(err)
	database.Description = "The postgresql database that data will be pushed to"

	tableName, err := cpolicy.NewStringRule("table_name", true)
	handleErr(err)
	tableName.Description = "The postgresql table within the database where information will be stored"

	hostName, err := cpolicy.NewStringRule("hostname", true, "localhost")
	handleErr(err)
	tableName.Description = "The postgresql server ip or domain name"

	port, err := cpolicy.NewIntegerRule("port", true, 5432)
	handleErr(err)
	port.Description = "The postgresql server port number"

	config.Add(username, password, database, tableName, hostName, port)

	cp.Add([]string{""}, config)
	return cp, nil

}
开发者ID:intelsdi-x,项目名称:snap-plugin-publisher-postgresql,代码行数:35,代码来源:postgresql.go


示例4: GetConfigPolicy

func (rmq *rmqPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	config := cpolicy.NewPolicyNode()

	r1, err := cpolicy.NewStringRule("uri", true)
	handleErr(err)
	r1.Description = "RabbitMQ URI (user:[email protected]:port/vhost)"
	config.Add(r1)

	r2, err := cpolicy.NewStringRule("exchange_name", true)
	handleErr(err)
	r2.Description = "RabbitMQ Exchange Name"
	config.Add(r2)

	r3, err := cpolicy.NewStringRule("exchange_type", true)
	handleErr(err)
	r3.Description = "RabbitMQ Exchange Type"
	config.Add(r3)

	r4, err := cpolicy.NewStringRule("routing_key", true)
	handleErr(err)
	r4.Description = "RabbitMQ Routing Key"
	config.Add(r4)

	r5, err := cpolicy.NewBoolRule("durable", false, true)
	handleErr(err)
	r5.Description = "RabbitMQ Durable"
	config.Add(r5)

	cp.Add([]string{""}, config)
	return cp, nil
}
开发者ID:intelsdi-x,项目名称:snap-plugin-publisher-rabbitmq,代码行数:32,代码来源:rmq.go


示例5: GetConfigPolicy

func (f *influxPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	config := cpolicy.NewPolicyNode()

	r1, err := cpolicy.NewStringRule("host", true)
	handleErr(err)
	r1.Description = "Influxdb host"
	config.Add(r1)

	r2, err := cpolicy.NewIntegerRule("port", true)
	handleErr(err)
	r2.Description = "Influxdb port"
	config.Add(r2)

	r3, err := cpolicy.NewStringRule("database", true)
	handleErr(err)
	r3.Description = "Influxdb db name"
	config.Add(r3)

	r4, err := cpolicy.NewStringRule("user", true)
	handleErr(err)
	r4.Description = "Influxdb user"
	config.Add(r4)

	r5, err := cpolicy.NewStringRule("password", true)
	handleErr(err)
	r5.Description = "Influxdb password"
	config.Add(r4)

	cp.Add([]string{""}, config)
	return cp, nil
}
开发者ID:geauxvirtual,项目名称:snap-plugin-publisher-influxdb,代码行数:32,代码来源:influx.go


示例6: GetConfigPolicy

func (f *mysqlPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	config := cpolicy.NewPolicyNode()

	username, err := cpolicy.NewStringRule("username", true, "root")
	handleErr(err)
	username.Description = "Username to login to the MySQL server"

	password, err := cpolicy.NewStringRule("password", true, "root")
	handleErr(err)
	password.Description = "Password to login to the MySQL server"

	database, err := cpolicy.NewStringRule("database", true, "SNAP_TEST")
	handleErr(err)
	database.Description = "The MySQL database that data will be pushed to"

	tableName, err := cpolicy.NewStringRule("tablename", true, "info")
	handleErr(err)
	tableName.Description = "The MySQL table within the database where information will be stored"

	config.Add(username, password, database, tableName)

	cp.Add([]string{""}, config)
	return cp, nil
}
开发者ID:geauxvirtual,项目名称:snap-plugin-publisher-mysql,代码行数:25,代码来源:mysql.go


示例7: GetConfigPolicy

//GetConfigPolicy returns a ConfigPolicy
func (p *SmartCollector) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	rule, _ := cpolicy.NewStringRule("proc_path", false, "/proc")
	node := cpolicy.NewPolicyNode()
	node.Add(rule)
	cp.Add([]string{nsVendor, nsClass, nsType}, node)
	rule, _ = cpolicy.NewStringRule("dev_path", false, "/dev")
	node.Add(rule)
	return cp, nil
}
开发者ID:intelsdi-x,项目名称:snap-plugin-collector-smart,代码行数:11,代码来源:plugin.go


示例8: GetConfigPolicy

//GetConfigPolicy returns a ConfigPolicyTree for testing
func (f *Mock) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	c := cpolicy.New()
	rule, _ := cpolicy.NewStringRule("name", false, "bob")
	rule2, _ := cpolicy.NewStringRule("password", true)
	p := cpolicy.NewPolicyNode()
	p.Add(rule)
	p.Add(rule2)
	c.Add([]string{"intel", "mock", "foo"}, p)
	return c, nil
}
开发者ID:lynxbat,项目名称:snap,代码行数:11,代码来源:mock.go


示例9: GetConfigPolicy

func (p *mockPlugin) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	cpn := cpolicy.NewPolicyNode()
	r1, _ := cpolicy.NewStringRule("username", false, "root")
	r2, _ := cpolicy.NewStringRule("password", true)
	cpn.Add(r1, r2)
	ns := []string{"one", "two", "potato"}
	cp.Add(ns, cpn)
	cp.Freeze()

	return cp, nil
}
开发者ID:jeffweiss,项目名称:snap,代码行数:12,代码来源:collector_proxy_test.go


示例10: GetConfigPolicy

//GetConfigPolicy returns a ConfigPolicyTree for testing
func (f *Gitstats) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	c := cpolicy.New()
	rule, _ := cpolicy.NewStringRule("access_token", true)
	rule1, _ := cpolicy.NewStringRule("user", false, "")
	rule2, _ := cpolicy.NewStringRule("repo", false, "")

	p := cpolicy.NewPolicyNode()
	p.Add(rule)
	p.Add(rule1)
	p.Add(rule2)
	c.Add([]string{"raintank", "apps", "gitstats"}, p)
	return c, nil
}
开发者ID:ChihChaoChang,项目名称:raintank-apps,代码行数:14,代码来源:gitstats.go


示例11: GetConfigPolicy

//GetConfigPolicy returns a ConfigPolicyTree for testing
func (p *Ping) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	c := cpolicy.New()
	rule0, _ := cpolicy.NewStringRule("checkId", true)
	rule1, _ := cpolicy.NewStringRule("endpoint", true)
	rule2, _ := cpolicy.NewStringRule("raintank_agent_name", true)
	rule3, _ := cpolicy.NewStringRule("hostname", true)
	cp := cpolicy.NewPolicyNode()
	cp.Add(rule0)
	cp.Add(rule1)
	cp.Add(rule2)
	cp.Add(rule3)
	c.Add([]string{"worldping"}, cp)
	return c, nil
}
开发者ID:ChihChaoChang,项目名称:raintank-apps,代码行数:15,代码来源:ping.go


示例12: GetConfigPolicy

// GetConfigPolicy returns a ConfigPolicy
func (ceph *Ceph) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	c := cpolicy.New()
	socketPath, _ := cpolicy.NewStringRule("socket_path", false, socketPathDefault)
	socketPrefix, _ := cpolicy.NewStringRule("socket_prefix", false, socketPrefixDefault)
	socketExt, _ := cpolicy.NewStringRule("socket_ext", false, socketExtDefault)
	path, _ := cpolicy.NewStringRule("path", false, cephBinPathDefault)
	p := cpolicy.NewPolicyNode()
	p.Add(socketPath)
	p.Add(socketPrefix)
	p.Add(socketExt)
	p.Add(path)
	c.Add([]string{"intel", "storage", "ceph"}, p)
	return c, nil
}
开发者ID:IzabellaRaulin,项目名称:snap-plugin-collector-ceph,代码行数:15,代码来源:ceph.go


示例13: GetConfigPolicy

func (f *HostedtsdbPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	c := cpolicy.New()
	rule, _ := cpolicy.NewStringRule("raintank_tsdb_url", true)
	rule2, _ := cpolicy.NewStringRule("raintank_api_key", true)
	rule3, _ := cpolicy.NewIntegerRule("interval", true)
	rule4, _ := cpolicy.NewIntegerRule("orgId", false, 0)

	p := cpolicy.NewPolicyNode()
	p.Add(rule)
	p.Add(rule2)
	p.Add(rule3)
	p.Add(rule4)
	c.Add([]string{""}, p)
	return c, nil
}
开发者ID:ChihChaoChang,项目名称:raintank-apps,代码行数:15,代码来源:hostedtsdb.go


示例14: GetConfigPolicy

//GetConfigPolicy returns a ConfigPolicyTree for testing
func (n *Ns1) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	c := cpolicy.New()
	rule, _ := cpolicy.NewStringRule("ns1_key", true)
	rule2, _ := cpolicy.NewStringRule("zone", false, "")
	rule3, _ := cpolicy.NewStringRule("jobId", false, "")
	rule4, _ := cpolicy.NewStringRule("jobName", false, "")
	p := cpolicy.NewPolicyNode()
	p.Add(rule)
	p.Add(rule2)
	p.Add(rule3)
	p.Add(rule4)

	c.Add([]string{"raintank", "apps", "ns1"}, p)
	return c, nil
}
开发者ID:ChihChaoChang,项目名称:raintank-apps,代码行数:16,代码来源:ns1.go


示例15: GetConfigPolicy

func (k *kafkaPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	config := cpolicy.NewPolicyNode()

	r1, err := cpolicy.NewStringRule("topic", true)
	handleErr(err)
	r1.Description = "Kafka topic for publishing"

	r2, _ := cpolicy.NewStringRule("brokers", true)
	handleErr(err)
	r2.Description = "List of brokers in the format: broker-ip:port;broker-ip:port (ex: 192.168.1.1:9092;172.16.9.99:9092"

	config.Add(r1, r2)
	cp.Add([]string{""}, config)
	return cp, nil
}
开发者ID:geauxvirtual,项目名称:snap-plugin-publisher-kafka,代码行数:16,代码来源:kafka.go


示例16: GetConfigPolicy

func (k *kafkaPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	config := cpolicy.NewPolicyNode()

	r1, err := cpolicy.NewStringRule("topic", false, "snap")
	handleErr(err)
	r1.Description = "Kafka topic for publishing"

	r2, _ := cpolicy.NewStringRule("brokers", false, "localhost:9092")
	handleErr(err)
	r2.Description = "List of brokers separated by semicolon in the format: <broker-ip:port;broker-ip:port> (ex: \"192.168.1.1:9092;172.16.9.99:9092\")"

	config.Add(r1, r2)
	cp.Add([]string{""}, config)
	return cp, nil
}
开发者ID:intelsdi-x,项目名称:snap-plugin-publisher-kafka,代码行数:16,代码来源:kafka.go


示例17: GetConfigPolicy

func (f *influxPublisher) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	config := cpolicy.NewPolicyNode()

	r1, err := cpolicy.NewStringRule("host", true)
	handleErr(err)
	r1.Description = "Influxdb host"
	config.Add(r1)

	r2, err := cpolicy.NewIntegerRule("port", true)
	handleErr(err)
	r2.Description = "Influxdb port"
	config.Add(r2)

	r3, err := cpolicy.NewStringRule("database", true)
	handleErr(err)
	r3.Description = "Influxdb db name"
	config.Add(r3)

	r4, err := cpolicy.NewStringRule("user", true)
	handleErr(err)
	r4.Description = "Influxdb user"
	config.Add(r4)

	r5, err := cpolicy.NewStringRule("password", true)
	handleErr(err)
	r5.Description = "Influxdb password"
	config.Add(r5)

	r6, err := cpolicy.NewStringRule("retention", false, "autogen")
	handleErr(err)
	r6.Description = "Influxdb retention policy"
	config.Add(r6)

	r7, err := cpolicy.NewBoolRule("https", false, false)
	handleErr(err)
	r7.Description = "Influxdb HTTPS connection"
	config.Add(r7)

	r8, err := cpolicy.NewBoolRule("skip-verify", false, false)
	handleErr(err)
	r8.Description = "Influxdb HTTPS Skip certificate verification"
	config.Add(r8)

	cp.Add([]string{""}, config)
	return cp, nil
}
开发者ID:katarzyna-z,项目名称:snap-plugin-publisher-influxdb,代码行数:47,代码来源:influxdb.go


示例18: GetConfigPolicy

// GetConfigPolicy returns config policy
// It returns error in case retrieval was not successful
func (p *Plugin) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	cp := cpolicy.New()
	rule, _ := cpolicy.NewStringRule("proc_path", false, "/proc")
	node := cpolicy.NewPolicyNode()
	node.Add(rule)
	cp.Add([]string{vendor, fs, pluginName}, node)
	return cp, nil
}
开发者ID:intelsdi-x,项目名称:snap-plugin-collector-cpu,代码行数:10,代码来源:cpu.go


示例19: GetConfigPolicy

func (e *Etcd) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	c := cpolicy.New()
	rule, _ := cpolicy.NewStringRule("etcd_host", true)
	p := cpolicy.NewPolicyNode()
	p.Add(rule)
	c.Add([]string{"intel", "etcd"}, p)
	return c, nil
}
开发者ID:intelsdi-x,项目名称:snap-plugin-collector-etcd,代码行数:8,代码来源:etcd.go


示例20: GetConfigPolicy

//GetConfigPolicy returns a ConfigPolicy for testing
func (f *nfsCollector) GetConfigPolicy() (*cpolicy.ConfigPolicy, error) {
	c := cpolicy.New()
	rule, _ := cpolicy.NewStringRule("command", true)
	p := cpolicy.NewPolicyNode()
	p.Add(rule)
	c.Add([]string{"intel", "dummy", "exec"}, p)
	return c, nil
}
开发者ID:thomastaylor312,项目名称:snap-plugin-collector-nfsclient,代码行数:9,代码来源:nfsclient.go



注:本文中的github.com/intelsdi-x/snap/control/plugin/cpolicy.NewStringRule函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang encrypter.New函数代码示例发布时间:2022-05-23
下一篇:
Golang cpolicy.NewPolicyNode函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap