本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/net.NewUAAGateway函数的典型用法代码示例。如果您正苦于以下问题:Golang NewUAAGateway函数的具体用法?Golang NewUAAGateway怎么用?Golang NewUAAGateway使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewUAAGateway函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewDependency
func NewDependency() Dependency {
deps := Dependency{}
deps.TeePrinter = terminal.NewTeePrinter()
deps.Ui = terminal.NewUI(os.Stdin, deps.TeePrinter)
deps.ManifestRepo = manifest.NewManifestDiskRepository()
errorHandler := func(err error) {
if err != nil {
deps.Ui.Failed(fmt.Sprintf("Config error: %s", err))
}
}
deps.Config = core_config.NewRepositoryFromFilepath(config_helpers.DefaultFilePath(), errorHandler)
deps.PluginConfig = plugin_config.NewPluginConfig(errorHandler)
deps.Detector = &detection.JibberJabberDetector{}
terminal.UserAskedForColors = deps.Config.ColorEnabled()
terminal.InitColorSupport()
if os.Getenv("CF_TRACE") != "" {
trace.Logger = trace.NewLogger(os.Getenv("CF_TRACE"))
} else {
trace.Logger = trace.NewLogger(deps.Config.Trace())
}
deps.Gateways = map[string]net.Gateway{
"auth": net.NewUAAGateway(deps.Config, deps.Ui),
"cloud-controller": net.NewCloudControllerGateway(deps.Config, time.Now, deps.Ui),
"uaa": net.NewUAAGateway(deps.Config, deps.Ui),
}
deps.RepoLocator = api.NewRepositoryLocator(deps.Config, deps.Gateways)
deps.PluginModels = &pluginModels{Application: nil}
return deps
}
示例2: setupDependencies
func setupDependencies() (deps *cliDependencies) {
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))
}
})
i18n.T = i18n.Init(deps.configRepo)
terminal.UserAskedForColors = deps.configRepo.ColorEnabled()
terminal.InitColorSupport()
if os.Getenv("CF_TRACE") != "" {
trace.Logger = trace.NewLogger(os.Getenv("CF_TRACE"))
} else {
trace.Logger = trace.NewLogger(deps.configRepo.Trace())
}
deps.gateways = map[string]net.Gateway{
"auth": net.NewUAAGateway(deps.configRepo),
"cloud-controller": net.NewCloudControllerGateway(deps.configRepo, time.Now),
"uaa": net.NewUAAGateway(deps.configRepo),
}
deps.apiRepoLocator = api.NewRepositoryLocator(deps.configRepo, deps.gateways)
return
}
示例3: findCommand
func findCommand(cmdName string) (cmd cli.Command) {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo, fakeUI),
"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now, fakeUI),
"uaa": net.NewUAAGateway(configRepo, fakeUI),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil, api.RepositoryLocator{}, nil)
cmdFactory := command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig, rpcService)
requirementsFactory := &testreq.FakeReqFactory{}
cmdRunner := command_runner.NewRunner(cmdFactory, requirementsFactory, fakeUI)
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
}
示例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, time.Now),
"uaa": net.NewUAAGateway(configRepo),
})
return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator)
}
示例5: createCommandFactory
func createCommandFactory() command_factory.Factory {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo, fakeUI),
"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now, fakeUI),
"uaa": net.NewUAAGateway(configRepo, fakeUI),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil)
return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig, rpcService)
}
示例6: New
func New(ccTarget string, uaaTarget string, username string, password string) (*CFServices, error) {
cfs := CFServices{
CCTarget: ccTarget,
UAATarget: uaaTarget,
Username: username,
Password: password,
SessionID: uuid.New(),
}
cfs.gateways = make(map[string]net.Gateway)
cfs.configFilePath = strings.Replace(config_helpers.DefaultFilePath(), ".json", "."+cfs.SessionID+".json", -1)
cfs.config = core_config.NewRepositoryFromFilepath(cfs.configFilePath,
func(err error) {
if err != nil {
fmt.Printf("Config error: %s", err)
}
})
cfs.config.SetApiEndpoint(ccTarget)
cfs.config.SetAuthenticationEndpoint(uaaTarget)
cfs.config.SetUaaEndpoint(uaaTarget)
cfs.config.SetSSLDisabled(true)
cfs.teePrinter = terminal.NewTeePrinter()
cfs.termUI = terminal.NewUI(os.Stdin, cfs.teePrinter)
cfs.detector = &detection.JibberJabberDetector{}
T = Init(cfs.config, cfs.detector)
terminal.UserAskedForColors = cfs.config.ColorEnabled()
terminal.InitColorSupport()
cfs.gateways["cloud-controller"] = net.NewCloudControllerGateway(cfs.config, time.Now, cfs.termUI)
cfs.gateways["auth"] = net.NewUAAGateway(cfs.config, cfs.termUI)
cfs.gateways["uaa"] = net.NewUAAGateway(cfs.config, cfs.termUI)
cfs.authRepo = authentication.NewUAAAuthenticationRepository(cfs.gateways["uaa"], cfs.config)
cfs.Organizations = organizations.NewCloudControllerOrganizationRepository(cfs.config, cfs.gateways["cloud-controller"])
cfs.Spaces = spaces.NewCloudControllerSpaceRepository(cfs.config, cfs.gateways["cloud-controller"])
cfs.Services = api.NewCloudControllerServiceRepository(cfs.config, cfs.gateways["cloud-controller"])
cfs.Plans = api.NewCloudControllerServicePlanRepository(cfs.config, cfs.gateways["cloud-controller"])
err := cfs.authRepo.Authenticate(map[string]string{
"username": username,
"password": password,
})
return &cfs, err
}
示例7: setupDependencies
func setupDependencies() (deps *cliDependencies) {
deps = new(cliDependencies)
deps.teePrinter = terminal.NewTeePrinter()
deps.termUI = terminal.NewUI(os.Stdin, deps.teePrinter)
deps.manifestRepo = manifest.NewManifestDiskRepository()
errorHandler := func(err error) {
if err != nil {
deps.termUI.Failed(fmt.Sprintf("Config error: %s", err))
}
}
deps.configRepo = core_config.NewRepositoryFromFilepath(config_helpers.DefaultFilePath(), errorHandler)
deps.pluginConfig = plugin_config.NewPluginConfig(errorHandler)
deps.detector = &detection.JibberJabberDetector{}
T = Init(deps.configRepo, deps.detector)
terminal.UserAskedForColors = deps.configRepo.ColorEnabled()
terminal.InitColorSupport()
if os.Getenv("CF_TRACE") != "" {
trace.Logger = trace.NewLogger(os.Getenv("CF_TRACE"))
} else {
trace.Logger = trace.NewLogger(deps.configRepo.Trace())
}
deps.gateways = map[string]net.Gateway{
"auth": net.NewUAAGateway(deps.configRepo, deps.termUI),
"cloud-controller": net.NewCloudControllerGateway(deps.configRepo, time.Now, deps.termUI),
"uaa": net.NewUAAGateway(deps.configRepo, deps.termUI),
}
deps.apiRepoLocator = api.NewRepositoryLocator(deps.configRepo, deps.gateways)
return
}
示例8: NewDependency
func NewDependency(logger trace.Printer) Dependency {
deps := Dependency{}
deps.TeePrinter = terminal.NewTeePrinter()
deps.Ui = terminal.NewUI(os.Stdin, deps.TeePrinter, logger)
errorHandler := func(err error) {
if err != nil {
deps.Ui.Failed(fmt.Sprintf("Config error: %s", err))
}
}
deps.Config = core_config.NewRepositoryFromFilepath(config_helpers.DefaultFilePath(), errorHandler)
deps.ManifestRepo = manifest.NewManifestDiskRepository()
deps.AppManifest = manifest.NewGenerator()
deps.PluginConfig = plugin_config.NewPluginConfig(errorHandler)
terminal.UserAskedForColors = deps.Config.ColorEnabled()
terminal.InitColorSupport()
deps.Gateways = map[string]net.Gateway{
"cloud-controller": net.NewCloudControllerGateway(deps.Config, time.Now, deps.Ui, logger),
"uaa": net.NewUAAGateway(deps.Config, deps.Ui, logger),
"routing-api": net.NewRoutingApiGateway(deps.Config, time.Now, deps.Ui, logger),
}
deps.RepoLocator = api.NewRepositoryLocator(deps.Config, deps.Gateways, logger)
deps.PluginModels = &PluginModels{Application: nil}
deps.PlanBuilder = plan_builder.NewBuilder(
deps.RepoLocator.GetServicePlanRepository(),
deps.RepoLocator.GetServicePlanVisibilityRepository(),
deps.RepoLocator.GetOrganizationRepository(),
)
deps.ServiceBuilder = service_builder.NewBuilder(
deps.RepoLocator.GetServiceRepository(),
deps.PlanBuilder,
)
deps.BrokerBuilder = broker_builder.NewBuilder(
deps.RepoLocator.GetServiceBrokerRepository(),
deps.ServiceBuilder,
)
deps.PluginRepo = plugin_repo.NewPluginRepo()
deps.ServiceHandler = actors.NewServiceHandler(
deps.RepoLocator.GetOrganizationRepository(),
deps.BrokerBuilder,
deps.ServiceBuilder,
)
deps.ServicePlanHandler = actors.NewServicePlanHandler(
deps.RepoLocator.GetServicePlanRepository(),
deps.RepoLocator.GetServicePlanVisibilityRepository(),
deps.RepoLocator.GetOrganizationRepository(),
deps.PlanBuilder,
deps.ServiceBuilder,
)
deps.WordGenerator = generator.NewWordGenerator()
deps.AppZipper = app_files.ApplicationZipper{}
deps.AppFiles = app_files.ApplicationFiles{}
deps.PushActor = actors.NewPushActor(deps.RepoLocator.GetApplicationBitsRepository(), deps.AppZipper, deps.AppFiles)
deps.ChecksumUtil = utils.NewSha1Checksum("")
deps.Logger = logger
return deps
}
示例9:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("factory", func() {
var (
factory Factory
)
BeforeEach(func() {
fakeUI := &testterm.FakeUI{}
config := testconfig.NewRepository()
manifestRepo := manifest.NewManifestDiskRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
repoLocator := api.NewRepositoryLocator(config, map[string]net.Gateway{
"auth": net.NewUAAGateway(config, fakeUI),
"cloud-controller": net.NewCloudControllerGateway(config, time.Now, fakeUI),
"uaa": net.NewUAAGateway(config, fakeUI),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil, api.RepositoryLocator{}, nil)
factory = NewFactory(fakeUI, config, manifestRepo, repoLocator, pluginConfig, rpcService)
})
// skipping test during the process of converting commands into non-codegangsta structure
XIt("provides the metadata for its commands", func() {
commands := factory.CommandMetadatas()
suffixesToIgnore := []string{
"i18n_init.go", // ignore all i18n initializers
"_test.go", // ignore test files
示例10: NewDependency
func NewDependency(writer io.Writer, logger trace.Printer) Dependency {
deps := Dependency{}
deps.TeePrinter = terminal.NewTeePrinter(writer)
deps.UI = terminal.NewUI(os.Stdin, writer, deps.TeePrinter, logger)
errorHandler := func(err error) {
if err != nil {
deps.UI.Failed(fmt.Sprintf("Config error: %s", err))
}
}
configPath, err := confighelpers.DefaultFilePath()
if err != nil {
errorHandler(err)
}
deps.Config = coreconfig.NewRepositoryFromFilepath(configPath, errorHandler)
deps.ManifestRepo = manifest.NewDiskRepository()
deps.AppManifest = manifest.NewGenerator()
pluginPath := filepath.Join(confighelpers.PluginRepoDir(), ".cf", "plugins")
deps.PluginConfig = pluginconfig.NewPluginConfig(
errorHandler,
configuration.NewDiskPersistor(filepath.Join(pluginPath, "config.json")),
pluginPath,
)
terminal.UserAskedForColors = deps.Config.ColorEnabled()
terminal.InitColorSupport()
deps.Gateways = map[string]net.Gateway{
"cloud-controller": net.NewCloudControllerGateway(deps.Config, time.Now, deps.UI, logger),
"uaa": net.NewUAAGateway(deps.Config, deps.UI, logger),
"routing-api": net.NewRoutingAPIGateway(deps.Config, time.Now, deps.UI, logger),
}
deps.RepoLocator = api.NewRepositoryLocator(deps.Config, deps.Gateways, logger)
deps.PluginModels = &PluginModels{Application: nil}
deps.PlanBuilder = planbuilder.NewBuilder(
deps.RepoLocator.GetServicePlanRepository(),
deps.RepoLocator.GetServicePlanVisibilityRepository(),
deps.RepoLocator.GetOrganizationRepository(),
)
deps.ServiceBuilder = servicebuilder.NewBuilder(
deps.RepoLocator.GetServiceRepository(),
deps.PlanBuilder,
)
deps.BrokerBuilder = brokerbuilder.NewBuilder(
deps.RepoLocator.GetServiceBrokerRepository(),
deps.ServiceBuilder,
)
deps.PluginRepo = pluginrepo.NewPluginRepo()
deps.ServiceHandler = actors.NewServiceHandler(
deps.RepoLocator.GetOrganizationRepository(),
deps.BrokerBuilder,
deps.ServiceBuilder,
)
deps.ServicePlanHandler = actors.NewServicePlanHandler(
deps.RepoLocator.GetServicePlanRepository(),
deps.RepoLocator.GetServicePlanVisibilityRepository(),
deps.RepoLocator.GetOrganizationRepository(),
deps.PlanBuilder,
deps.ServiceBuilder,
)
deps.WordGenerator = generator.NewWordGenerator()
deps.AppZipper = appfiles.ApplicationZipper{}
deps.AppFiles = appfiles.ApplicationFiles{}
deps.PushActor = actors.NewPushActor(deps.RepoLocator.GetApplicationBitsRepository(), deps.AppZipper, deps.AppFiles)
deps.ChecksumUtil = utils.NewSha1Checksum("")
deps.Logger = logger
return deps
}
示例11:
var _ = Describe("AuthenticationRepository", func() {
Describe("legacy tests", func() {
var (
gateway net.Gateway
testServer *httptest.Server
handler *testnet.TestHandler
config coreconfig.ReadWriter
auth Repository
dumper net.RequestDumper
fakePrinter *tracefakes.FakePrinter
)
BeforeEach(func() {
config = testconfig.NewRepository()
fakePrinter = new(tracefakes.FakePrinter)
gateway = net.NewUAAGateway(config, new(terminalfakes.FakeUI), fakePrinter)
dumper = net.NewRequestDumper(fakePrinter)
auth = NewUAARepository(gateway, config, dumper)
})
AfterEach(func() {
testServer.Close()
})
var setupTestServer = func(request testnet.TestRequest) {
testServer, handler = testnet.NewServer([]testnet.TestRequest{request})
config.SetAuthenticationEndpoint(testServer.URL)
}
Describe("authenticating", func() {
var err error
示例12:
)
var _ = Describe("User Repository", func() {
var (
ccServer *httptest.Server
ccHandler *testnet.TestHandler
uaaServer *httptest.Server
uaaHandler *testnet.TestHandler
repo UserRepository
config core_config.ReadWriter
)
BeforeEach(func() {
config = testconfig.NewRepositoryWithDefaults()
ccGateway := net.NewCloudControllerGateway((config), time.Now, &testterm.FakeUI{})
uaaGateway := net.NewUAAGateway(config, &testterm.FakeUI{})
repo = NewCloudControllerUserRepository(config, uaaGateway, ccGateway)
})
AfterEach(func() {
if uaaServer != nil {
uaaServer.Close()
}
if ccServer != nil {
ccServer.Close()
}
})
setupCCServer := func(requests ...testnet.TestRequest) {
ccServer, ccHandler = testnet.NewServer(requests)
config.SetApiEndpoint(ccServer.URL)
示例13:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("AuthenticationRepository", func() {
var (
gateway net.Gateway
testServer *httptest.Server
handler *testnet.TestHandler
config configuration.ReadWriter
auth AuthenticationRepository
)
BeforeEach(func() {
config = testconfig.NewRepository()
gateway = net.NewUAAGateway(config)
auth = NewUAAAuthenticationRepository(gateway, config)
})
AfterEach(func() {
testServer.Close()
})
var setupTestServer = func(request testnet.TestRequest) {
testServer, handler = testnet.NewServer([]testnet.TestRequest{request})
config.SetAuthenticationEndpoint(testServer.URL)
}
Describe("authenticating", func() {
var err error
示例14:
var _ = Describe("AuthenticationRepository", func() {
Describe("legacy tests", func() {
var (
gateway net.Gateway
testServer *httptest.Server
handler *testnet.TestHandler
config coreconfig.ReadWriter
auth AuthenticationRepository
dumper net.RequestDumper
fakePrinter *tracefakes.FakePrinter
)
BeforeEach(func() {
config = testconfig.NewRepository()
fakePrinter = new(tracefakes.FakePrinter)
gateway = net.NewUAAGateway(config, &testterm.FakeUI{}, fakePrinter)
dumper = net.NewRequestDumper(fakePrinter)
auth = NewUAAAuthenticationRepository(gateway, config, dumper)
})
AfterEach(func() {
testServer.Close()
})
var setupTestServer = func(request testnet.TestRequest) {
testServer, handler = testnet.NewServer([]testnet.TestRequest{request})
config.SetAuthenticationEndpoint(testServer.URL)
}
Describe("authenticating", func() {
var err error
示例15:
"github.com/onsi/gomega/ghttp"
)
var _ = Describe("AuthenticationRepository", func() {
Describe("legacy tests", func() {
var (
gateway net.Gateway
testServer *httptest.Server
handler *testnet.TestHandler
config core_config.ReadWriter
auth AuthenticationRepository
)
BeforeEach(func() {
config = testconfig.NewRepository()
gateway = net.NewUAAGateway(config, &testterm.FakeUI{})
auth = NewUAAAuthenticationRepository(gateway, config)
})
AfterEach(func() {
testServer.Close()
})
var setupTestServer = func(request testnet.TestRequest) {
testServer, handler = testnet.NewServer([]testnet.TestRequest{request})
config.SetAuthenticationEndpoint(testServer.URL)
}
Describe("authenticating", func() {
var err error