本文整理匯總了Golang中github.com/nttlabs/cli/cf/net.NewCloudControllerGateway函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewCloudControllerGateway函數的具體用法?Golang NewCloudControllerGateway怎麽用?Golang NewCloudControllerGateway使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewCloudControllerGateway函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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, &testterm.FakeUI{})
repo = NewCloudControllerServiceBrokerRepository(configRepo, gateway)
return
}
示例2: 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, &testterm.FakeUI{})
repo = NewCCUserProvidedServiceInstanceRepository(configRepo, gateway)
return
}
示例3: createPasswordRepo
func createPasswordRepo(req testnet.TestRequest) (passwordServer *httptest.Server, handler *testnet.TestHandler, repo PasswordRepository) {
passwordServer, handler = testnet.NewServer([]testnet.TestRequest{req})
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetUaaEndpoint(passwordServer.URL)
gateway := net.NewCloudControllerGateway(configRepo, time.Now, &testterm.FakeUI{})
repo = NewCloudControllerPasswordRepository(configRepo, gateway)
return
}
示例4: 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, &testterm.FakeUI{})
repo = NewCloudControllerOrganizationRepository(configRepo, gateway)
return
}
示例5: 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, &testterm.FakeUI{})
repo = NewCloudControllerAppInstancesRepository(configRepo, gateway)
return
}
示例6: 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),
})
return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig)
}
示例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)
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, 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: 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),
})
cmdFactory := command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig)
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
}
示例9:
. "github.com/nttlabs/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("RunningSecurityGroupsRepo", func() {
var (
testServer *httptest.Server
testHandler *testnet.TestHandler
configRepo core_config.ReadWriter
repo RunningSecurityGroupsRepo
)
BeforeEach(func() {
configRepo = testconfig.NewRepositoryWithDefaults()
gateway := net.NewCloudControllerGateway(configRepo, time.Now, &testterm.FakeUI{})
repo = NewRunningSecurityGroupsRepo(configRepo, gateway)
})
AfterEach(func() {
testServer.Close()
})
setupTestServer := func(reqs ...testnet.TestRequest) {
testServer, testHandler = testnet.NewServer(reqs)
configRepo.SetApiEndpoint(testServer.URL)
}
Describe(".BindToRunningSet", func() {
It("makes a correct request", func() {
setupTestServer(
示例10:
. "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),
})
factory = NewFactory(fakeUI, config, manifestRepo, repoLocator, pluginConfig)
})
It("provides the metadata for its commands", func() {
commands := factory.CommandMetadatas()
suffixesToIgnore := []string{
"i18n_init.go", // ignore all i18n initializers
"_test.go", // ignore test files
".test", // ignore generated .test (temporary files)
"#", // emacs autosave files
}
示例11:
var _ = Describe("Endpoints Repository", func() {
var (
config core_config.ReadWriter
gateway net.Gateway
testServer *httptest.Server
repo EndpointRepository
testServerFn func(w http.ResponseWriter, r *http.Request)
)
BeforeEach(func() {
config = testconfig.NewRepository()
testServer = httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
testServerFn(w, r)
}))
gateway = net.NewCloudControllerGateway((config), time.Now, &testterm.FakeUI{})
gateway.SetTrustedCerts(testServer.TLS.Certificates)
repo = NewEndpointRepository(config, gateway)
})
AfterEach(func() {
testServer.Close()
})
Describe("updating the endpoints", func() {
Context("when the API request is successful", func() {
var (
org models.OrganizationFields
space models.SpaceFields
)
BeforeEach(func() {
示例12: newCurlDependencies
func newCurlDependencies() (deps curlDependencies) {
deps.config = testconfig.NewRepository()
deps.config.SetAccessToken("BEARER my_access_token")
deps.gateway = net.NewCloudControllerGateway(deps.config, time.Now, &testterm.FakeUI{})
return
}
示例13:
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),
})
cmdFactory := command_factory.NewFactory(ui, config, manifestRepo, repoLocator, pluginConfig)
cmdRunner = &FakeRunner{cmdFactory: cmdFactory}
app = NewApp(cmdRunner, cmdFactory.CommandMetadatas()...)
})
Describe("trace file integration", func() {
var (
output *bytes.Buffer
)
BeforeEach(func() {
output = bytes.NewBuffer(make([]byte, 1024))