本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/net.NewCloudControllerGateway函数的典型用法代码示例。如果您正苦于以下问题:Golang NewCloudControllerGateway函数的具体用法?Golang NewCloudControllerGateway怎么用?Golang NewCloudControllerGateway使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewCloudControllerGateway函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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
}
开发者ID:tools-alexuser01,项目名称:cli,代码行数:25,代码来源:context.go
示例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
}
开发者ID:matanzit,项目名称:cli,代码行数:33,代码来源:main.go
示例3: 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
}
开发者ID:tools-alexuser01,项目名称:cli,代码行数:35,代码来源:dependency.go
示例4: createUserProvidedServiceInstanceRepo
func createUserProvidedServiceInstanceRepo(req testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo UserProvidedServiceInstanceRepository) {
ts, handler = testnet.NewServer([]testnet.TestRequest{req})
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetApiEndpoint(ts.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now)
repo = NewCCUserProvidedServiceInstanceRepository(configRepo, gateway)
return
}
开发者ID:GABONIA,项目名称:cli,代码行数:8,代码来源:user_provided_service_instances_test.go
示例5: createServiceSummaryRepo
func createServiceSummaryRepo(req testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo ServiceSummaryRepository) {
ts, handler = testnet.NewServer([]testnet.TestRequest{req})
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetAPIEndpoint(ts.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now, new(terminalfakes.FakeUI), new(tracefakes.FakePrinter), "")
repo = NewCloudControllerServiceSummaryRepository(configRepo, gateway)
return
}
开发者ID:Reejoshi,项目名称:cli,代码行数:8,代码来源:service_summary_test.go
示例6: createAppRepo
func createAppRepo(requests []testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo ApplicationRepository) {
ts, handler = testnet.NewServer(requests)
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetApiEndpoint(ts.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now, &testterm.FakeUI{})
repo = NewCloudControllerApplicationRepository(configRepo, gateway)
return
}
开发者ID:vframbach,项目名称:cli,代码行数:8,代码来源:applications_test.go
示例7: createServiceBrokerRepo
func createServiceBrokerRepo(requests ...testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo ServiceBrokerRepository) {
ts, handler = testnet.NewServer(requests)
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetApiEndpoint(ts.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now)
repo = NewCloudControllerServiceBrokerRepository(configRepo, gateway)
return
}
开发者ID:herchu,项目名称:cli,代码行数:8,代码来源:service_brokers_test.go
示例8: createUserProvidedServiceInstanceRepo
func createUserProvidedServiceInstanceRepo(req []testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo UserProvidedServiceInstanceRepository) {
ts, handler = testnet.NewServer(req)
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetAPIEndpoint(ts.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now, new(terminalfakes.FakeUI), new(tracefakes.FakePrinter))
repo = NewCCUserProvidedServiceInstanceRepository(configRepo, gateway)
return
}
开发者ID:jsloyer,项目名称:cli,代码行数:8,代码来源:user_provided_service_instances_test.go
示例9: createPasswordRepo
func createPasswordRepo(req testnet.TestRequest) (passwordServer *httptest.Server, handler *testnet.TestHandler, repo Repository) {
passwordServer, handler = testnet.NewServer([]testnet.TestRequest{req})
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetUaaEndpoint(passwordServer.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now, new(terminalfakes.FakeUI), new(tracefakes.FakePrinter), "")
repo = NewCloudControllerRepository(configRepo, gateway)
return
}
开发者ID:Reejoshi,项目名称:cli,代码行数:9,代码来源:password_test.go
示例10: createOrganizationRepo
func createOrganizationRepo(reqs ...testnet.TestRequest) (testserver *httptest.Server, handler *testnet.TestHandler, repo OrganizationRepository) {
testserver, handler = testnet.NewServer(reqs)
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetApiEndpoint(testserver.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now)
repo = NewCloudControllerOrganizationRepository(configRepo, gateway)
return
}
开发者ID:matanzit,项目名称:cli,代码行数:9,代码来源:organizations_test.go
示例11: createAppInstancesRepo
func createAppInstancesRepo(requests []testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo Repository) {
ts, handler = testnet.NewServer(requests)
space := models.SpaceFields{}
space.GUID = "my-space-guid"
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetAPIEndpoint(ts.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now, new(terminalfakes.FakeUI), new(tracefakes.FakePrinter), "")
repo = NewCloudControllerAppInstancesRepository(configRepo, gateway)
return
}
开发者ID:Reejoshi,项目名称:cli,代码行数:10,代码来源:app_instances_test.go
示例12: createAppInstancesRepo
func createAppInstancesRepo(requests []testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo AppInstancesRepository) {
ts, handler = testnet.NewServer(requests)
space := models.SpaceFields{}
space.Guid = "my-space-guid"
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetApiEndpoint(ts.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now)
repo = NewCloudControllerAppInstancesRepository(configRepo, gateway)
return
}
开发者ID:BlueSpice,项目名称:cli,代码行数:10,代码来源:app_instances_test.go
示例13: 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)
}
开发者ID:GABONIA,项目名称:cli,代码行数:12,代码来源:help_test.go
示例14: 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)
}
开发者ID:raghulsid,项目名称:cli,代码行数:15,代码来源:help_test.go
示例15: 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
}
开发者ID:jrbudnack,项目名称:cf-sql-broker,代码行数:47,代码来源:cfservices.go
示例16: 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
}
开发者ID:raghulsid,项目名称:cli,代码行数:38,代码来源:main.go
示例17:
var (
testServer *httptest.Server
testHandler *testnet.TestHandler
configRepo configuration.ReadWriter
repo CloudControllerServiceBindingRepository
)
setupTestServer := func(reqs ...testnet.TestRequest) {
testServer, testHandler = testnet.NewServer(reqs)
configRepo.SetApiEndpoint(testServer.URL)
}
BeforeEach(func() {
configRepo = testconfig.NewRepositoryWithDefaults()
gateway := net.NewCloudControllerGateway((configRepo), time.Now)
repo = NewCloudControllerServiceBindingRepository(configRepo, gateway)
})
AfterEach(func() {
testServer.Close()
})
Describe("Create", func() {
Context("when the service binding can be created", func() {
BeforeEach(func() {
setupTestServer(testapi.NewCloudControllerTestRequest(testnet.TestRequest{
Method: "POST",
Path: "/v2/service_bindings",
Matcher: testnet.RequestBodyMatcher(`{"app_guid":"my-app-guid","service_instance_guid":"my-service-instance-guid","async":true}`),
Response: testnet.TestResponse{Status: http.StatusCreated},
开发者ID:palakmathur,项目名称:cli,代码行数:31,代码来源:service_bindings_test.go
示例18:
})
Context("error when getting SSH info from /v2/info", func() {
BeforeEach(func() {
getRequest := apifakes.NewCloudControllerTestRequest(testnet.TestRequest{
Method: "GET",
Path: "/v2/info",
Response: testnet.TestResponse{
Status: http.StatusNotFound,
Body: `{}`,
},
})
testServer, handler = testnet.NewServer([]testnet.TestRequest{getRequest})
configRepo.SetAPIEndpoint(testServer.URL)
ccGateway = net.NewCloudControllerGateway(configRepo, time.Now, &testterm.FakeUI{}, new(tracefakes.FakePrinter), "")
deps.Gateways["cloud-controller"] = ccGateway
})
It("notifies users", func() {
runCommand("my-app")
Expect(handler).To(HaveAllRequestsCalled())
Expect(ui.Outputs()).To(ContainSubstrings(
[]string{"Error getting SSH info", "404"},
))
})
})
Context("error when getting oauth token", func() {
开发者ID:Reejoshi,项目名称:cli,代码行数:31,代码来源:ssh_test.go
示例19:
var _ = Describe("App", func() {
var (
app *cli.App
cmdRunner *FakeRunner
)
JustBeforeEach(func() {
ui := &testterm.FakeUI{}
config := testconfig.NewRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
manifestRepo := &testmanifest.FakeManifestRepository{}
repoLocator := api.NewRepositoryLocator(config, map[string]net.Gateway{
"auth": net.NewUAAGateway(config, ui),
"cloud-controller": net.NewCloudControllerGateway(config, time.Now, &testterm.FakeUI{}),
"uaa": net.NewUAAGateway(config, ui),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil, api.RepositoryLocator{}, nil)
cmdFactory := command_factory.NewFactory(ui, config, manifestRepo, repoLocator, pluginConfig, rpcService)
cmdRunner = &FakeRunner{cmdFactory: cmdFactory}
app = NewApp(cmdRunner, cmdFactory.CommandMetadatas()...)
})
Describe("trace file integration", func() {
var (
output *bytes.Buffer
)
BeforeEach(func() {
开发者ID:tools-alexuser01,项目名称:cli,代码行数:30,代码来源:app_test.go
示例20:
"github.com/cloudfoundry/cli/cf/trace/tracefakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("StagingSecurityGroupsRepo", func() {
var (
testServer *httptest.Server
testHandler *testnet.TestHandler
configRepo coreconfig.ReadWriter
repo SecurityGroupsRepo
)
BeforeEach(func() {
configRepo = testconfig.NewRepositoryWithDefaults()
gateway := net.NewCloudControllerGateway(configRepo, time.Now, new(terminalfakes.FakeUI), new(tracefakes.FakePrinter), "")
repo = NewSecurityGroupsRepo(configRepo, gateway)
})
AfterEach(func() {
testServer.Close()
})
setupTestServer := func(reqs ...testnet.TestRequest) {
testServer, testHandler = testnet.NewServer(reqs)
configRepo.SetAPIEndpoint(testServer.URL)
}
Describe("BindToStagingSet", func() {
It("makes a correct request", func() {
setupTestServer(
开发者ID:Reejoshi,项目名称:cli,代码行数:31,代码来源:staging_test.go
注:本文中的github.com/cloudfoundry/cli/cf/net.NewCloudControllerGateway函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论