當前位置: 首頁>>代碼示例>>Golang>>正文


Golang configuration.Configuration類代碼示例

本文整理匯總了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
}
開發者ID:jalateras,項目名稱:cli,代碼行數:16,代碼來源:show_space_test.go

示例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
}
開發者ID:nsnt,項目名稱:cli,代碼行數:10,代碼來源:services_test.go

示例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
}
開發者ID:KaiYoung,項目名稱:cli,代碼行數:11,代碼來源:login.go

示例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
}
開發者ID:KaiYoung,項目名稱:cli,代碼行數:11,代碼來源:login.go

示例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))
	}
}
開發者ID:KaiYoung,項目名稱:cli,代碼行數:19,代碼來源:ui.go

示例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))
	}
}
開發者ID:pmuellr,項目名稱:cli,代碼行數:19,代碼來源:ui.go

示例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))
	}
}
開發者ID:jalateras,項目名稱:cli,代碼行數:19,代碼來源:ui.go


注:本文中的cf/configuration.Configuration類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。