本文整理汇总了Golang中github.com/cloudfoundry-incubator/ltc/config.Config.Username方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.Username方法的具体用法?Golang Config.Username怎么用?Golang Config.Username使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/ltc/config.Config
的用法示例。
在下文中一共展示了Config.Username方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Dial
func (*AppDialer) Dial(appName string, instanceIndex int, config *config_package.Config) (Client, error) {
diegoSSHUser := fmt.Sprintf("diego:%s/%d", appName, instanceIndex)
address := fmt.Sprintf("%s:2222", config.Target())
client, err := sshapi.New(diegoSSHUser, config.Username(), config.Password(), address)
if err != nil {
return nil, err
}
return client, nil
}
示例2:
testConfig = config.New(testPersister)
})
Describe("Target", func() {
It("sets the target", func() {
testConfig.SetTarget("mynewapi.com")
Expect(testConfig.Target()).To(Equal("mynewapi.com"))
})
})
Describe("Username", func() {
It("sets the target", func() {
testConfig.SetLogin("ausername", "apassword")
Expect(testConfig.Username()).To(Equal("ausername"))
})
})
Describe("Receptor", func() {
It("returns the Receptor with a username and password", func() {
testConfig.SetTarget("mynewapi.com")
testConfig.SetLogin("testusername", "testpassword")
Expect(testConfig.Receptor()).To(Equal("http://testusername:[email protected]"))
})
It("returns a Receptor without a username and password", func() {
testConfig.SetTarget("mynewapi.com")
testConfig.SetLogin("", "")