dongpo8250 2017-12-04 20:48
浏览 60
已采纳

如何使用golang添加对象掩码以调用GetNetworkVlans

func getPrivateVlan(env string) (string, error) {
// 1. Create a session
sess := session.New(user, pass)
// 2. Get a service
accountService := services.GetAccountService(sess)
// 3. Invoke a method:
vlans, err := accountService.GetNetworkVlans()
vlan := vlans[0]
log.Println(*vlan.Name)           //works
log.Println(*vlan.PrimaryRouter)  //Doesn't work
}

The object returned is an array of vlans of type SoftLayer_Network_Vlan, https://sldn.softlayer.com/reference/datatypes/softlayer_network_vlan. I am able to access the properties in column "Local Properties" (ie Name) but am unable to access the properties in column "Relational & Count Properties" (ie PrimaryRouter). How can I add an object mask to my call in order to see these properties?

  • 写回答

2条回答 默认 最新

  • dsjxgu4759 2018-05-09 15:23
    关注

    source: Unable to get itemCategory info from call GetConfiguration when called from golang

    F.Ojeda: The default endpoint is REST but in your environment you are using xmlrpc, which is probably due to the existence of the ~ / .softlayer file and in this it is configured as an XMLRPC enpoint.

    For more information you can see the following documentation: https://github.com/softlayer/softlayer-go

    This issue happens for the XMLRPC enpoint and you can report it in the go GitHub. https://github.com/softlayer/softlayer-go/issues/

    Try in your code with the REST endpoint, like this example:

    endpoint := "https://api.softlayer.com/rest/v3"
    
    // Create a session
    sess := session.New(username, apikey, endpoint)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥100 已有python代码,要求做成可执行程序,程序设计内容不多
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答