本文整理匯總了Golang中cf/configuration.Configuration類的典型用法代碼示例。如果您正苦於以下問題:Golang Configuration類的具體用法?Golang Configuration怎麽用?Golang Configuration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Configuration類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: callShowSpace
func callShowSpace(t *testing.T, args []string, reqFactory *testreq.FakeReqFactory, config *configuration.Configuration) (ui *testterm.FakeUI) {
ui = new(testterm.FakeUI)
ctxt := testcmd.NewContext("space", args)
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
config.Organization = cf.Organization{Name: "my-org"}
config.AccessToken = token
cmd := NewShowSpace(ui, config)
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例2: createServiceRepoWithConfig
func createServiceRepoWithConfig(t *testing.T, reqs []testnet.TestRequest, config *configuration.Configuration) (ts *httptest.Server, handler *testnet.TestHandler, repo ServiceRepository) {
if len(reqs) > 0 {
ts, handler = testnet.NewTLSServer(t, reqs)
config.Target = ts.URL
}
gateway := net.NewCloudControllerGateway()
repo = NewCloudControllerServiceRepository(config, gateway)
return
}
示例3: saveSpace
func (l Login) saveSpace(config *configuration.Configuration, space cf.Space) (err error) {
config.Space = space
err = l.configRepo.Save()
if err != nil {
l.ui.Failed("Error saving organization: %s", err)
return
}
return
}
示例4: saveOrg
func (l Login) saveOrg(config *configuration.Configuration, org cf.Organization) (err error) {
config.Organization = org
err = l.configRepo.Save()
if err != nil {
l.ui.Failed("Error saving organization: %s", err)
return
}
return
}
示例5: ShowConfiguration
func (ui TerminalUI) ShowConfiguration(config *configuration.Configuration) {
ui.Say("API endpoint: %s (API version: %s)",
Yellow(config.Target),
Yellow(config.ApiVersion))
if !config.IsLoggedIn() {
ui.Say("Logged out. Use '%s' to login.", Yellow("cf login USERNAME"))
} else {
ui.Say("user: %s", Yellow(config.UserEmail()))
}
if config.HasOrganization() {
ui.Say("org: %s", Yellow(config.Organization.Name))
}
if config.HasSpace() {
ui.Say("app space: %s", Yellow(config.Space.Name))
}
}
示例6: ShowConfiguration
func (ui terminalUI) ShowConfiguration(config *configuration.Configuration) {
ui.Say("API endpoint: %s (API version: %s)",
EntityNameColor(config.Target),
EntityNameColor(config.ApiVersion))
if !config.IsLoggedIn() {
ui.Say(NotLoggedInText())
} else {
ui.Say("User: %s", EntityNameColor(config.UserEmail()))
}
if config.HasOrganization() {
ui.Say("Org: %s", EntityNameColor(config.OrganizationFields.Name))
}
if config.HasSpace() {
ui.Say("Space: %s", EntityNameColor(config.SpaceFields.Name))
}
}
示例7: ShowConfiguration
func (ui terminalUI) ShowConfiguration(config *configuration.Configuration) {
ui.Say("API endpoint: %s (API version: %s)",
EntityNameColor(config.Target),
EntityNameColor(config.ApiVersion))
if !config.IsLoggedIn() {
ui.Say("Logged out, use '%s' to login", CommandColor(cf.Name()+" login USERNAME"))
} else {
ui.Say("User: %s", EntityNameColor(config.UserEmail()))
}
if config.HasOrganization() {
ui.Say("Org: %s", EntityNameColor(config.Organization.Name))
}
if config.HasSpace() {
ui.Say("Space: %s", EntityNameColor(config.Space.Name))
}
}