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

Golang xmlrpc.NewClient函数代码示例

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

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



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

示例1: getClient

func (d *Driver) getClient() *xmlrpc.Client {
	rpc, err := xmlrpc.NewClient(d.Url, nil)
	if err != nil {
		return nil
	}
	return rpc
}
开发者ID:jmbarbier,项目名称:docker-machine-gandi,代码行数:7,代码来源:gandi.go


示例2: NewClient

func NewClient() *Client {
	client, _ := xmlrpc.NewClient(OpenSubtitlesAPI, nil)

	return &Client{
		NewUnauthenticatedClientState(*client),
	}
}
开发者ID:CentaurWarchief,项目名称:subbs,代码行数:7,代码来源:client.go


示例3: Call

func (self *Client) Call(serviceMethod string, args []interface{}, reply interface{}) error {
	rpc, err := xmlrpc.NewClient(self.Url, nil)
	if err != nil {
		return err
	}
	return rpc.Call(serviceMethod, args, reply)
}
开发者ID:raphink,项目名称:external-dns,代码行数:7,代码来源:client.go


示例4: SetClient

func SetClient(args ...string) error {
	var auth_token string
	var one_auth_path string

	if len(args) == 1 {
		auth_token = args[0]
	} else {
		one_auth_path = os.Getenv("ONE_AUTH")
		if one_auth_path == "" {
			one_auth_path = os.Getenv("HOME") + "/.one/one_auth"
		}

		token, err := ioutil.ReadFile(one_auth_path)
		if err == nil {
			auth_token = strings.TrimSpace(string(token))
		} else {
			auth_token = ""
		}
	}

	one_xmlrpc := os.Getenv("ONE_XMLRPC")
	if one_xmlrpc == "" {
		one_xmlrpc = "http://localhost:2633/RPC2"
	}

	xmlrpcClient, xmlrpcClientError := xmlrpc.NewClient(one_xmlrpc, nil)

	client = &oneClient{
		token:             auth_token,
		xmlrpcClient:      xmlrpcClient,
		xmlrpcClientError: xmlrpcClientError,
	}

	return nil
}
开发者ID:pkdevbox,项目名称:machine,代码行数:35,代码来源:goca.go


示例5: run

func (si *supervisorInstance) run() {
	client, err := xmlrpc.NewClient(fmt.Sprintf("http://%s/RPC2", si.host), nil)
	if err != nil {
		si.err = err
		log.Printf("%s: client error: %v", si.host, err)
		return
	}
	waitTime := sleepTime
	if *signal {
		err = client.Call("supervisor.signalProcess", []interface{}{*program, *signalName}, nil)
		log.Printf("%s: signalProcess. err=%v", si.host, err)
		waitTime = shortSleepTime
	}
	if *stop {
		err = client.Call("supervisor.stopProcess", []interface{}{*program, true}, nil)
		log.Printf("%s: stopProcess. err=%v", si.host, err)
		waitTime = shortSleepTime
	}

	for {
		si.err = client.Call("supervisor.getProcessInfo", *program, &si.info)
		if si.err != nil {
			log.Printf("%s: call error: %v", si.host, err)
			break
		}
		log.Printf("%s: %s", si.host, si.info.StateName)

		if si.info.State != 20 { /* 20=RUNNING */
			break
		}

		time.Sleep(waitTime)
	}
}
开发者ID:BramGruneir,项目名称:cockroach-prod,代码行数:34,代码来源:main.go


示例6: NewClient

// Get a new client suitable for communicating with a supervisord.
// url must contain a real url to a supervisord RPC-service.
//
// Url for local supervisord should be http://127.0.0.1:9001/RPC2 by default.
func NewClient(url string) (*Client, error) {
	rpc, err := xmlrpc.NewClient(url, nil)
	if err != nil {
		return nil, err
	}

	return &Client{rpc}, nil
}
开发者ID:abrander,项目名称:go-supervisord,代码行数:12,代码来源:client.go


示例7: NewClient

// NewClient authenticates with Pulse server for a user session, creating
// a RPC client.
func NewClient(url, user, pass string) (Client, error) {
	c, err := &client{d: 15 * time.Second}, (error)(nil)
	if c.rpc, err = xmlrpc.NewClient(url, nil); err != nil {
		return nil, err
	}
	if err = c.rpc.Call("RemoteApi.login", []interface{}{user, pass}, &c.tok); err != nil {
		return nil, err
	}
	return c, nil
}
开发者ID:rjeczalik,项目名称:pulsekit,代码行数:12,代码来源:client.go


示例8: New

// New creates a Client, provided with a "host:port" string
func New(hostPort string) *Client {
	rpcClient, err := xmlrpc.NewClient(fmt.Sprintf("http://%s/RPC2", hostPort), nil)
	if err != nil {
		log.Fatalln("Couldn't create XML-RPC client:", err)
	}

	return &Client{
		rpcClient: rpcClient,
	}
}
开发者ID:abourget,项目名称:ldtp,代码行数:11,代码来源:client.go


示例9: SetClient

func SetClient(conf OneConfig) error {

	xmlrpcClient, xmlrpcClientError := xmlrpc.NewClient(conf.XmlrpcUrl, nil)

	client = &oneClient{
		token:             conf.Token,
		xmlrpcClient:      xmlrpcClient,
		xmlrpcClientError: xmlrpcClientError,
	}

	return nil
}
开发者ID:OpenNebula,项目名称:goca,代码行数:12,代码来源:goca.go


示例10: NewClient

func NewClient() (*Client, error) {
	rpc, err := xmlrpc.NewClient(DefaultOSDBServer, nil)
	if err != nil {
		return nil, err
	}

	c := &Client{
		UserAgent: DefaultUserAgent,
		Client:    rpc, // xmlrpc.Client
	}

	return c, nil
}
开发者ID:xfanity,项目名称:pulsar,代码行数:13,代码来源:client.go


示例11: NewClient

// NewClient stand up a new XapiClient. Version should probably be "1.2" unless you know what you are doing.
func NewClient(uri, username, password, version string) (client Client) {
	client.URI = uri
	client.Username = username
	client.Password = password
	client.Version = version
	client.rpc, _ = xmlrpc.NewClient(
		client.URI,
		&http.Transport{
			Dial: TimeoutDialer(),
		})

	return
}
开发者ID:softlayer,项目名称:xapi-go,代码行数:14,代码来源:xapi.go


示例12: NewRPCClient

/**
 *
 * Creates an RPCClient with endpoint and returns it
 *
 **/
func NewRPCClient(endpoint string, username string, password string) (*Rpc, error) {
	log.Debugf(cmd.Colorfy("  > [one-go] connecting", "blue", "", "bold"))

	RPCclient, err := xmlrpc.NewClient(endpoint, nil)

	if err != nil {
		//TO-DO: trap and send connRefused error.
		return nil, err
	}
	log.Debugf(cmd.Colorfy("  > [one-go] connected", "blue", "", "bold")+" %s", endpoint)

	return &Rpc{
		RPCClient: *RPCclient,
		Key:       username + ":" + password}, nil
}
开发者ID:morpheyesh,项目名称:goca,代码行数:20,代码来源:api.go


示例13: NewClient

// NewClient creates a new supervisor RPC client.
func NewClient(url string) (client Client, err error) {
	var rpc *xmlrpc.Client
	if rpc, err = xmlrpc.NewClient(url, nil); err != nil {
		return
	}

	version := ""
	if err = rpc.Call("supervisor.getAPIVersion", nil, &version); err != nil {
		return
	}
	if version != apiVersion {
		err = errors.New(fmt.Sprintf("want Supervisor API version %s, got %s instead", apiVersion, version))
		return
	}
	client = Client{rpc, version}
	return
}
开发者ID:janqii,项目名称:go-supervisor,代码行数:18,代码来源:rpc.go


示例14: NewClient

func NewClient(config map[string]string) (*Rpc, error) {
	log.Debugf(cmd.Colorfy("  > [one-go] connecting", "blue", "", "bold"))

	if !satisfied(config) {
		return nil, ErrArgsNotSatisfied
	}

	client, err := xmlrpc.NewClient(config[ENDPOINT], nil)
	if err != nil {
		return nil, err
	}
	//log.Debugf(cmd.Colorfy("  > [one-go] connection response", "blue", "", "bold")+"%#v",client)
	log.Debugf(cmd.Colorfy("  > [one-go] connected", "blue", "", "bold")+" %s", config[ENDPOINT])

	return &Rpc{
		Client: *client,
		Key:    config[USERID] + ":" + config[PASSWORD]}, nil
}
开发者ID:megamsys,项目名称:opennebula-go,代码行数:18,代码来源:api.go


示例15: newBugzillaClient

func newBugzillaClient(url string, username string, password string) (*BugzillaClient, error) {
	transport := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}
	client, err := xmlrpc.NewClient(url, transport)
	if err != nil {
		return nil, err
	}

	// Get authentication token
	var resp struct {
		ID    int    `xmlrpc:"id"`
		Token string `xmlrpc:"token"`
	}
	if err = client.Call("User.login", params{"login": username, "password": password}, &resp); err != nil {
		return nil, err
	}

	return &BugzillaClient{
		client: client,
		token:  resp.Token,
	}, nil
}
开发者ID:kolo,项目名称:telegram_bot,代码行数:21,代码来源:bugzilla.go


示例16: NewSupervisordCollector

func NewSupervisordCollector() (Collector, error) {
	client, err := xmlrpc.NewClient(*supervisordURL, nil)
	if err != nil {
		return nil, err
	}

	var (
		subsystem  = "supervisord"
		labelNames = []string{"name", "group"}
	)
	return &supervisordCollector{
		client: client,
		upDesc: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "up"),
			"Process Up",
			labelNames,
			nil,
		),
		stateDesc: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "state"),
			"Process State",
			labelNames,
			nil,
		),
		exitStatusDesc: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "exit_status"),
			"Process Exit Status",
			labelNames,
			nil,
		),
		uptimeDesc: prometheus.NewDesc(
			prometheus.BuildFQName(Namespace, subsystem, "uptime"),
			"Process Uptime",
			labelNames,
			nil,
		),
	}, nil
}
开发者ID:EdgecaseInc,项目名称:node_exporter,代码行数:38,代码来源:supervisord.go


示例17: NewClient

func NewClient() (*Client, error) {
	xmlClient, err := xmlrpc.NewClient("https://pypi.python.org/pypi", nil)
	return &Client{client: xmlClient}, err
}
开发者ID:saulshanabrook,项目名称:pypi-dockerhub,代码行数:4,代码来源:client.go


示例18: rpcClient

func rpcClient() (*xmlrpc.Client, error) {
	return xmlrpc.NewClient("http://d.hatena.ne.jp/xmlrpc", nil)
}
开发者ID:pocke,项目名称:hatena-keyword-go,代码行数:3,代码来源:main.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang otm.Object类代码示例发布时间:2022-05-23
下一篇:
Golang data.Item类代码示例发布时间: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