本文介绍了Softlayer API是否可以关闭Golang中的会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用softlayer go客户端 https://github.com/softlayer/softlayer-go

I am using the softlayer go client https://github.com/softlayer/softlayer-go

我无法关闭softlayer会话.我该怎么办?

I am not able to close the softlayer session. How do I do that?

我已经使用Session.New() API创建了软层会话.参考:- https://github.com/softlayer/softlayer -go/blob/master/session/session.go

I have created the softlayer session using the Session.New() API. Reference:- https://github.com/softlayer/softlayer-go/blob/master/session/session.go

推荐答案

https://github.com/softlayer/softlayer-go/blob/master/session/session.go 基本上是通过将用户名,apiKey,端点,超时等存储在变量中来配置go-client的,这些变量在每次向API发出请求时都会使用.

The https://github.com/softlayer/softlayer-go/blob/master/session/session.go basically configures the go-client by storing the username, apiKey, endpoint, timeout, etc., in variables, which are used every time do a request to the API.

如果您查看 SoftLayer API ,则没有任何方法可以创建/关闭会话,因此,如果您想模拟类似的内容,那么我认为您可以尝试通过将空白值发送到Session.New()并删除存储在~/.softlayer文件中的任何值

If you review the SoftLayer API, it doesn't have any method that will create/close a session, so if you want to simulate something similar then I think you can try by sending blank values to Session.New() and removing any value stored in ~/.softlayer file

这篇关于Softlayer API是否可以关闭Golang中的会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 05:40