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


Golang net.NewUAAGateway函數代碼示例

本文整理匯總了Golang中cf/net.NewUAAGateway函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewUAAGateway函數的具體用法?Golang NewUAAGateway怎麽用?Golang NewUAAGateway使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewUAAGateway函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: setupDependencies

func setupDependencies() (deps *cliDependencies) {
	if os.Getenv("CF_COLOR") == "" {
		os.Setenv("CF_COLOR", "true")
	}

	deps = new(cliDependencies)

	deps.termUI = terminal.NewUI(os.Stdin)

	deps.manifestRepo = manifest.NewManifestDiskRepository()

	deps.configRepo = configuration.NewRepositoryFromFilepath(configuration.DefaultFilePath(), func(err error) {
		if err != nil {
			deps.termUI.Failed(fmt.Sprintf("Config error: %s", err))
		}
	})

	deps.apiRepoLocator = api.NewRepositoryLocator(deps.configRepo, map[string]net.Gateway{
		"auth":             net.NewUAAGateway(deps.configRepo),
		"cloud-controller": net.NewCloudControllerGateway(deps.configRepo),
		"uaa":              net.NewUAAGateway(deps.configRepo),
	})

	return
}
開發者ID:juggernaut,項目名稱:cli,代碼行數:25,代碼來源:cf.go

示例2: main

func main() {
	fileutils.SetTmpPathPrefix("cf")

	if os.Getenv("CF_COLOR") == "" {
		os.Setenv("CF_COLOR", "true")
	}

	termUI := terminal.NewUI()
	assignTemplates()
	configRepo := configuration.NewConfigurationDiskRepository()
	config := loadConfig(termUI, configRepo)

	repoLocator := api.NewRepositoryLocator(config, configRepo, map[string]net.Gateway{
		"auth":             net.NewUAAGateway(),
		"cloud-controller": net.NewCloudControllerGateway(),
		"uaa":              net.NewUAAGateway(),
	})

	cmdFactory := commands.NewFactory(termUI, config, configRepo, repoLocator)
	reqFactory := requirements.NewFactory(termUI, config, repoLocator)
	cmdRunner := commands.NewRunner(cmdFactory, reqFactory)

	app, err := app.NewApp(cmdRunner)
	if err != nil {
		return
	}
	app.Run(os.Args)
}
開發者ID:jalateras,項目名稱:cli,代碼行數:28,代碼來源:cf.go

示例3: main

func main() {
	defer func() {
		maybeSomething := recover()

		if maybeSomething != nil {
			displayCrashDialog()
		}
	}()

	fileutils.SetTmpPathPrefix("cf")

	if os.Getenv("CF_COLOR") == "" {
		os.Setenv("CF_COLOR", "true")
	}

	termUI := terminal.NewUI()
	configRepo := configuration.NewConfigurationDiskRepository()
	config := loadConfig(termUI, configRepo)
	manifestRepo := manifest.NewManifestDiskRepository()
	repoLocator := api.NewRepositoryLocator(config, configRepo, map[string]net.Gateway{
		"auth":             net.NewUAAGateway(),
		"cloud-controller": net.NewCloudControllerGateway(),
		"uaa":              net.NewUAAGateway(),
	})

	cmdFactory := commands.NewFactory(termUI, config, configRepo, manifestRepo, repoLocator)
	reqFactory := requirements.NewFactory(termUI, config, repoLocator)
	cmdRunner := commands.NewRunner(cmdFactory, reqFactory)

	app, err := app.NewApp(cmdRunner)
	if err != nil {
		return
	}
	app.Run(os.Args)
}
開發者ID:nsnt,項目名稱:cli,代碼行數:35,代碼來源:cf.go

示例4: createCommandFactory

func createCommandFactory() command_factory.Factory {
	fakeUI := &testterm.FakeUI{}
	configRepo := testconfig.NewRepository()
	manifestRepo := manifest.NewManifestDiskRepository()
	apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
		"auth":             net.NewUAAGateway(configRepo),
		"cloud-controller": net.NewCloudControllerGateway(configRepo),
		"uaa":              net.NewUAAGateway(configRepo),
	})

	return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator)
}
開發者ID:nota-ja,項目名稱:cli,代碼行數:12,代碼來源:help_test.go

示例5: createUsersRepo

func createUsersRepo(t *testing.T, ccReqs []testnet.TestRequest, uaaReqs []testnet.TestRequest) (cc *httptest.Server,
	ccHandler *testnet.TestHandler, uaa *httptest.Server, uaaHandler *testnet.TestHandler, repo UserRepository) {

	ccTarget := ""
	uaaTarget := ""

	if len(ccReqs) > 0 {
		cc, ccHandler = testnet.NewTLSServer(t, ccReqs)
		ccTarget = cc.URL
	}
	if len(uaaReqs) > 0 {
		uaa, uaaHandler = testnet.NewTLSServer(t, uaaReqs)
		uaaTarget = uaa.URL
	}
	org := cf.OrganizationFields{}
	org.Guid = "some-org-guid"
	config := &configuration.Configuration{
		AccessToken:        "BEARER my_access_token",
		Target:             ccTarget,
		OrganizationFields: org,
	}
	ccGateway := net.NewCloudControllerGateway()
	uaaGateway := net.NewUAAGateway()
	endpointRepo := &testapi.FakeEndpointRepo{}
	endpointRepo.UAAEndpointReturns.Endpoint = uaaTarget
	repo = NewCloudControllerUserRepository(config, uaaGateway, ccGateway, endpointRepo)
	return
}
開發者ID:nsnt,項目名稱:cli,代碼行數:28,代碼來源:users_test.go

示例6: createUsersRepo

func createUsersRepo(t *testing.T, ccReqs []testnet.TestRequest, uaaReqs []testnet.TestRequest) (cc *httptest.Server,
	ccHandler *testnet.TestHandler, uaa *httptest.Server, uaaHandler *testnet.TestHandler, repo UserRepository) {

	ccTarget := ""
	uaaTarget := ""

	if len(ccReqs) > 0 {
		cc, ccHandler = testnet.NewTLSServer(t, ccReqs)
		ccTarget = cc.URL
	}
	if len(uaaReqs) > 0 {
		uaa, uaaHandler = testnet.NewTLSServer(t, uaaReqs)
		uaaTarget = uaa.URL
	}

	config := &configuration.Configuration{
		AccessToken:  "BEARER my_access_token",
		Target:       ccTarget,
		Organization: cf.Organization{Guid: "some-org-guid"},
	}
	ccGateway := net.NewCloudControllerGateway()
	uaaGateway := net.NewUAAGateway()
	endpointRepo := &testapi.FakeEndpointRepo{GetEndpointEndpoints: map[cf.EndpointType]string{
		cf.UaaEndpointKey: uaaTarget,
	}}
	repo = NewCloudControllerUserRepository(config, uaaGateway, ccGateway, endpointRepo)
	return
}
開發者ID:jalateras,項目名稱:cli,代碼行數:28,代碼來源:users_test.go

示例7: setupAuthDependencies

func setupAuthDependencies(request testnet.TestRequest) (deps authDependencies) {
	deps.ts, deps.handler = testnet.NewTLSServer([]testnet.TestRequest{request})

	deps.config = testconfig.NewRepository()
	deps.config.SetAuthorizationEndpoint(deps.ts.URL)

	deps.gateway = net.NewUAAGateway()
	return
}
開發者ID:normalnorman,項目名稱:cli,代碼行數:9,代碼來源:authentication_test.go

示例8: TestCommands

func TestCommands(t *testing.T) {
	for _, cmdName := range availableCmdNames() {
		ui := &testterm.FakeUI{}
		config := &configuration.Configuration{}
		configRepo := testconfig.FakeConfigRepository{}

		repoLocator := api.NewRepositoryLocator(config, configRepo, map[string]net.Gateway{
			"auth":             net.NewUAAGateway(),
			"cloud-controller": net.NewCloudControllerGateway(),
			"uaa":              net.NewUAAGateway(),
		})

		cmdFactory := commands.NewFactory(ui, config, configRepo, repoLocator)
		cmdRunner := &FakeRunner{cmdFactory: cmdFactory, t: t}
		app, _ := NewApp(cmdRunner)
		app.Run([]string{"", cmdName})

		assert.Equal(t, cmdRunner.cmdName, cmdName)
	}
}
開發者ID:jalateras,項目名稱:cli,代碼行數:20,代碼來源:app_test.go

示例9: findCommand

func findCommand(cmdName string) (cmd cli.Command) {
	fakeUI := &testterm.FakeUI{}
	configRepo := testconfig.NewRepository()
	manifestRepo := manifest.NewManifestDiskRepository()
	apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
		"auth":             net.NewUAAGateway(configRepo),
		"cloud-controller": net.NewCloudControllerGateway(configRepo),
		"uaa":              net.NewUAAGateway(configRepo),
	})

	cmdFactory := command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator)
	requirementsFactory := &testreq.FakeReqFactory{}
	cmdRunner := command_runner.NewRunner(cmdFactory, requirementsFactory)
	myApp := app.NewApp(cmdRunner, cmdFactory.CommandMetadatas()...)

	for _, cmd := range myApp.Commands {
		if cmd.Name == cmdName {
			return cmd
		}
	}
	panic(fmt.Sprintf("command %s does not exist", cmdName))
	return
}
開發者ID:nota-ja,項目名稱:cli,代碼行數:23,代碼來源:context.go

示例10: setupAuthWithEndpoint

func setupAuthWithEndpoint(t *testing.T, request testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, auth UAAAuthenticationRepository) {
	ts, handler = testnet.NewTLSServer(t, []testnet.TestRequest{request})

	configRepo := testconfig.FakeConfigRepository{}
	configRepo.Delete()
	config, err := configRepo.Get()
	assert.NoError(t, err)
	config.AuthorizationEndpoint = ts.URL
	config.AccessToken = ""

	gateway := net.NewUAAGateway()

	auth = NewUAAAuthenticationRepository(gateway, configRepo)
	return
}
開發者ID:nsnt,項目名稱:cli,代碼行數:15,代碼來源:authentication_test.go

示例11: createUsersRepo

func createUsersRepo(ccReqs []testnet.TestRequest, uaaReqs []testnet.TestRequest) (cc *httptest.Server,
	ccHandler *testnet.TestHandler, uaa *httptest.Server, uaaHandler *testnet.TestHandler, repo UserRepository) {

	ccTarget := ""
	uaaTarget := ""

	if len(ccReqs) > 0 {
		cc, ccHandler = testnet.NewServer(ccReqs)
		ccTarget = cc.URL
	}
	if len(uaaReqs) > 0 {
		uaa, uaaHandler = testnet.NewServer(uaaReqs)
		uaaTarget = uaa.URL
	}

	configRepo := testconfig.NewRepositoryWithDefaults()
	configRepo.SetApiEndpoint(ccTarget)
	ccGateway := net.NewCloudControllerGateway(configRepo)
	uaaGateway := net.NewUAAGateway(configRepo)
	configRepo.SetUaaEndpoint(uaaTarget)
	repo = NewCloudControllerUserRepository(configRepo, uaaGateway, ccGateway)
	return
}
開發者ID:knolleary,項目名稱:cli,代碼行數:23,代碼來源:users_test.go

示例12: NewRepositoryLocator

func NewRepositoryLocator(config *configuration.Configuration) (loc RepositoryLocator) {
	loc.config = config
	loc.configurationRepo = configuration.NewConfigurationDiskRepository()

	authGateway := net.NewUAAAuthGateway()
	loc.authenticator = NewUAAAuthenticator(authGateway, loc.configurationRepo)

	loc.cloudControllerGateway = net.NewCloudControllerGateway(loc.authenticator)
	loc.uaaGateway = net.NewUAAGateway(loc.authenticator)

	loc.organizationRepo = NewCloudControllerOrganizationRepository(config, loc.cloudControllerGateway)
	loc.spaceRepo = NewCloudControllerSpaceRepository(config, loc.cloudControllerGateway)
	loc.appRepo = NewCloudControllerApplicationRepository(config, loc.cloudControllerGateway)
	loc.appSummaryRepo = NewCloudControllerAppSummaryRepository(config, loc.cloudControllerGateway, loc.appRepo)
	loc.appFilesRepo = NewCloudControllerAppFilesRepository(config, loc.cloudControllerGateway)
	loc.domainRepo = NewCloudControllerDomainRepository(config, loc.cloudControllerGateway)
	loc.routeRepo = NewCloudControllerRouteRepository(config, loc.cloudControllerGateway)
	loc.stackRepo = NewCloudControllerStackRepository(config, loc.cloudControllerGateway)
	loc.serviceRepo = NewCloudControllerServiceRepository(config, loc.cloudControllerGateway)
	loc.passwordRepo = NewCloudControllerPasswordRepository(config, loc.uaaGateway)
	loc.logsRepo = NewLoggregatorLogsRepository(config, loc.cloudControllerGateway, LoggregatorHost)

	return
}
開發者ID:jbayer,項目名稱:cli,代碼行數:24,代碼來源:repository_locator.go

示例13:

	"org-users", "orgs", "passwd", "purge-service-offering", "push", "quotas", "rename", "rename-org",
	"rename-service", "rename-service-broker", "rename-space", "restart", "routes", "scale",
	"service", "service-auth-tokens", "service-brokers", "services", "set-env", "set-org-role", "set-quota",
	"set-space-role", "create-shared-domain", "space", "space-users", "spaces", "stacks", "start", "stop",
	"target", "unbind-service", "unmap-route", "unset-env", "unset-org-role", "unset-space-role",
	"update-buildpack", "update-service-broker", "update-service-auth-token", "update-user-provided-service",
}

var _ = Describe("App", func() {
	It("#NewApp", func() {
		ui := &testterm.FakeUI{}
		config := testconfig.NewRepository()
		manifestRepo := &testmanifest.FakeManifestRepository{}

		repoLocator := api.NewRepositoryLocator(config, map[string]net.Gateway{
			"auth":             net.NewUAAGateway(),
			"cloud-controller": net.NewCloudControllerGateway(),
			"uaa":              net.NewUAAGateway(),
		})

		cmdFactory := commands.NewFactory(ui, config, manifestRepo, repoLocator)
		cmdRunner := &FakeRunner{cmdFactory: cmdFactory}

		for _, cmdName := range expectedCommandNames {
			output := bytes.NewBuffer(make([]byte, 1024))
			trace.SetStdout(output)
			trace.EnableTrace()

			app, err := NewApp(cmdRunner)
			Expect(err).NotTo(HaveOccurred())
開發者ID:normalnorman,項目名稱:cli,代碼行數:30,代碼來源:app_test.go

示例14:

	"net/http"
	"net/http/httptest"
	testconfig "testhelpers/configuration"
	testnet "testhelpers/net"
)

var _ = Describe("AuthenticationRepository", func() {
	var (
		gateway net.Gateway
		ts      *httptest.Server
		handler *testnet.TestHandler
		config  configuration.ReadWriter
	)

	BeforeEach(func() {
		gateway = net.NewUAAGateway()
	})

	AfterEach(func() {
		ts.Close()
	})

	It("logs in", func() {
		ts, handler, config = setupAuthDependencies(successfulLoginRequest)

		auth := NewUAAAuthenticationRepository(gateway, config)
		apiResponse := auth.Authenticate(map[string]string{
			"username": "[email protected]",
			"password": "bar",
		})
開發者ID:nimbus-cloud,項目名稱:cli,代碼行數:30,代碼來源:authentication_test.go

示例15:

	"net/http/httptest"
	testconfig "testhelpers/configuration"
	testnet "testhelpers/net"
)

var _ = Describe("AuthenticationRepository", func() {
	var (
		gateway    net.Gateway
		testServer *httptest.Server
		handler    *testnet.TestHandler
		config     configuration.ReadWriter
	)

	BeforeEach(func() {
		config = testconfig.NewRepositoryWithDefaults()
		gateway = net.NewUAAGateway(config)
	})

	AfterEach(func() {
		testServer.Close()
	})

	It("logs in", func() {
		testServer, handler, config = setupAuthDependencies(successfulLoginRequest)

		auth := NewUAAAuthenticationRepository(gateway, config)
		apiErr := auth.Authenticate(map[string]string{
			"username": "[email protected]",
			"password": "bar",
		})
開發者ID:knolleary,項目名稱:cli,代碼行數:30,代碼來源:authentication_test.go


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