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: "******", }) assert.NoError(t, err) config.Organization = cf.Organization{Name: "my-org"} config.AccessToken = token cmd := NewShowSpace(ui, config) testcmd.RunCommand(cmd, ctxt, reqFactory) return }
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 }
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 }
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 }
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)) } }
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)) } }
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)) } }