本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/actors.NewServiceHandler函数的典型用法代码示例。如果您正苦于以下问题:Golang NewServiceHandler函数的具体用法?Golang NewServiceHandler怎么用?Golang NewServiceHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewServiceHandler函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewFactory
//.........这里部分代码省略.........
displayApp := application.NewShowApp(ui, config, repoLocator.GetAppSummaryRepository(), repoLocator.GetAppInstancesRepository())
start := application.NewStart(ui, config, displayApp, repoLocator.GetApplicationRepository(), repoLocator.GetAppInstancesRepository(), repoLocator.GetLogsRepository())
stop := application.NewStop(ui, config, repoLocator.GetApplicationRepository())
restart := application.NewRestart(ui, start, stop)
restage := application.NewRestage(ui, config, repoLocator.GetApplicationRepository(), start)
bind := service.NewBindService(ui, config, repoLocator.GetServiceBindingRepository())
factory.cmdsByName["app"] = displayApp
factory.cmdsByName["bind-service"] = bind
factory.cmdsByName["start"] = start
factory.cmdsByName["stop"] = stop
factory.cmdsByName["restart"] = restart
factory.cmdsByName["restage"] = restage
factory.cmdsByName["push"] = application.NewPush(
ui, config, manifestRepo, start, stop, bind,
repoLocator.GetApplicationRepository(),
repoLocator.GetDomainRepository(),
repoLocator.GetRouteRepository(),
repoLocator.GetStackRepository(),
repoLocator.GetServiceRepository(),
repoLocator.GetAuthenticationRepository(),
words.NewWordGenerator(),
actors.NewPushActor(repoLocator.GetApplicationBitsRepository(), app_files.ApplicationZipper{}, app_files.ApplicationFiles{}),
app_files.ApplicationZipper{},
app_files.ApplicationFiles{})
factory.cmdsByName["scale"] = application.NewScale(ui, config, restart, repoLocator.GetApplicationRepository())
spaceRoleSetter := user.NewSetSpaceRole(ui, config, repoLocator.GetSpaceRepository(), repoLocator.GetUserRepository())
factory.cmdsByName["set-space-role"] = spaceRoleSetter
factory.cmdsByName["create-space"] = space.NewCreateSpace(ui, config, spaceRoleSetter, repoLocator.GetSpaceRepository(), repoLocator.GetOrganizationRepository(), repoLocator.GetUserRepository())
planBuilder := plan_builder.NewBuilder(
repoLocator.GetServicePlanRepository(),
repoLocator.GetServicePlanVisibilityRepository(),
repoLocator.GetOrganizationRepository(),
)
serviceBuilder := service_builder.NewBuilder(
repoLocator.GetServiceRepository(),
planBuilder,
)
brokerBuilder := broker_builder.NewBuilder(
repoLocator.GetServiceBrokerRepository(),
serviceBuilder,
)
factory.cmdsByName["service-access"] = serviceaccess.NewServiceAccess(
ui, config,
actors.NewServiceHandler(
repoLocator.GetOrganizationRepository(),
brokerBuilder,
serviceBuilder,
),
repoLocator.GetAuthenticationRepository(),
)
factory.cmdsByName["enable-service-access"] = serviceaccess.NewEnableServiceAccess(
ui, config,
actors.NewServicePlanHandler(
repoLocator.GetServicePlanRepository(),
repoLocator.GetServicePlanVisibilityRepository(),
repoLocator.GetOrganizationRepository(),
planBuilder,
serviceBuilder,
),
repoLocator.GetAuthenticationRepository(),
)
factory.cmdsByName["disable-service-access"] = serviceaccess.NewDisableServiceAccess(
ui, config,
actors.NewServicePlanHandler(
repoLocator.GetServicePlanRepository(),
repoLocator.GetServicePlanVisibilityRepository(),
repoLocator.GetOrganizationRepository(),
planBuilder,
serviceBuilder,
),
repoLocator.GetAuthenticationRepository(),
)
factory.cmdsByName["create-space-quota"] = spacequota.NewCreateSpaceQuota(ui, config, repoLocator.GetSpaceQuotaRepository(), repoLocator.GetOrganizationRepository())
factory.cmdsByName["delete-space-quota"] = spacequota.NewDeleteSpaceQuota(ui, config, repoLocator.GetSpaceQuotaRepository())
factory.cmdsByName["space-quotas"] = spacequota.NewListSpaceQuotas(ui, config, repoLocator.GetSpaceQuotaRepository())
factory.cmdsByName["space-quota"] = spacequota.NewSpaceQuota(ui, config, repoLocator.GetSpaceQuotaRepository())
factory.cmdsByName["update-space-quota"] = spacequota.NewUpdateSpaceQuota(ui, config, repoLocator.GetSpaceQuotaRepository())
factory.cmdsByName["set-space-quota"] = spacequota.NewSetSpaceQuota(ui, config, repoLocator.GetSpaceRepository(), repoLocator.GetSpaceQuotaRepository())
factory.cmdsByName["unset-space-quota"] = spacequota.NewUnsetSpaceQuota(ui, config, repoLocator.GetSpaceQuotaRepository(), repoLocator.GetSpaceRepository())
factory.cmdsByName["feature-flags"] = featureflag.NewListFeatureFlags(ui, config, repoLocator.GetFeatureFlagRepository())
factory.cmdsByName["feature-flag"] = featureflag.NewShowFeatureFlag(ui, config, repoLocator.GetFeatureFlagRepository())
factory.cmdsByName["enable-feature-flag"] = featureflag.NewEnableFeatureFlag(ui, config, repoLocator.GetFeatureFlagRepository())
factory.cmdsByName["disable-feature-flag"] = featureflag.NewDisableFeatureFlag(ui, config, repoLocator.GetFeatureFlagRepository())
factory.cmdsByName["running-environment-variable-group"] = environmentvariablegroup.NewRunningEnvironmentVariableGroup(ui, config, repoLocator.GetEnvironmentVariableGroupsRepository())
factory.cmdsByName["staging-environment-variable-group"] = environmentvariablegroup.NewStagingEnvironmentVariableGroup(ui, config, repoLocator.GetEnvironmentVariableGroupsRepository())
factory.cmdsByName["set-staging-environment-variable-group"] = environmentvariablegroup.NewSetStagingEnvironmentVariableGroup(ui, config, repoLocator.GetEnvironmentVariableGroupsRepository())
factory.cmdsByName["set-running-environment-variable-group"] = environmentvariablegroup.NewSetRunningEnvironmentVariableGroup(ui, config, repoLocator.GetEnvironmentVariableGroupsRepository())
return
}
开发者ID:matanzit,项目名称:cli,代码行数:101,代码来源:factory.go
示例2:
var _ = Describe("Services", func() {
var (
actor actors.ServiceActor
brokerBuilder *brokerbuilderfakes.FakeBrokerBuilder
serviceBuilder *servicebuilderfakes.FakeServiceBuilder
orgRepo *organizationsfakes.FakeOrganizationRepository
serviceBroker1 models.ServiceBroker
service1 models.ServiceOffering
)
BeforeEach(func() {
orgRepo = new(organizationsfakes.FakeOrganizationRepository)
brokerBuilder = new(brokerbuilderfakes.FakeBrokerBuilder)
serviceBuilder = new(servicebuilderfakes.FakeServiceBuilder)
actor = actors.NewServiceHandler(orgRepo, brokerBuilder, serviceBuilder)
serviceBroker1 = models.ServiceBroker{GUID: "my-service-broker-guid1", Name: "my-service-broker1"}
service1 = models.ServiceOffering{ServiceOfferingFields: models.ServiceOfferingFields{
Label: "my-service1",
GUID: "service-guid1",
BrokerGUID: "my-service-broker-guid1"},
}
org1 := models.Organization{}
org1.Name = "org1"
org1.GUID = "org-guid"
org2 := models.Organization{}
org2.Name = "org2"
开发者ID:Reejoshi,项目名称:cli,代码行数:31,代码来源:services_test.go
示例3: 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
}
开发者ID:cloudfoundry-incubator,项目名称:Diego-Enabler,代码行数:73,代码来源:dependency.go
示例4:
actor actors.ServiceActor
brokerRepo *fakes.FakeServiceBrokerRepo
serviceRepo *fakes.FakeServiceRepo
servicePlanRepo *fakes.FakeServicePlanRepo
servicePlanVisibilityRepo *fakes.FakeServicePlanVisibilityRepository
orgRepo *fakes.FakeOrgRepository
)
BeforeEach(func() {
brokerRepo = &fakes.FakeServiceBrokerRepo{}
serviceRepo = &fakes.FakeServiceRepo{}
servicePlanRepo = &fakes.FakeServicePlanRepo{}
servicePlanVisibilityRepo = &fakes.FakeServicePlanVisibilityRepository{}
orgRepo = &fakes.FakeOrgRepository{}
actor = actors.NewServiceHandler(brokerRepo, serviceRepo, servicePlanRepo, servicePlanVisibilityRepo, orgRepo)
serviceBroker1 := models.ServiceBroker{Guid: "my-service-broker-guid", Name: "my-service-broker"}
serviceBroker2 := models.ServiceBroker{Guid: "my-service-broker-guid2", Name: "my-service-broker2"}
brokerRepo.FindByNameServiceBroker = serviceBroker2
brokerRepo.ServiceBrokers = []models.ServiceBroker{
serviceBroker1,
serviceBroker2,
}
serviceRepo.ListServicesFromBrokerReturns = map[string][]models.ServiceOffering{
"my-service-broker-guid": {},
"my-service-broker-guid2": {
{ServiceOfferingFields: models.ServiceOfferingFields{Guid: "service-guid", Label: "my-service"}},
开发者ID:EthanWu,项目名称:cli,代码行数:31,代码来源:services_test.go
示例5: NewFactory
//.........这里部分代码省略.........
createRoute := route.NewCreateRoute(ui, config, repoLocator.GetRouteRepository())
factory.cmdsByName["create-route"] = createRoute
factory.cmdsByName["map-route"] = route.NewMapRoute(ui, config, repoLocator.GetRouteRepository(), createRoute)
displayApp := application.NewShowApp(ui, config, repoLocator.GetAppSummaryRepository(), repoLocator.GetAppInstancesRepository(), repoLocator.GetLogsNoaaRepository())
start := application.NewStart(ui, config, displayApp, repoLocator.GetApplicationRepository(), repoLocator.GetAppInstancesRepository(), repoLocator.GetLogsNoaaRepository(), repoLocator.GetOldLogsRepository())
stop := application.NewStop(ui, config, repoLocator.GetApplicationRepository())
restart := application.NewRestart(ui, config, start, stop)
restage := application.NewRestage(ui, config, repoLocator.GetApplicationRepository(), start)
bind := service.NewBindService(ui, config, repoLocator.GetServiceBindingRepository())
factory.cmdsByName["bind-service"] = bind
factory.cmdsByName["start"] = start
factory.cmdsByName["stop"] = stop
factory.cmdsByName["restart"] = restart
factory.cmdsByName["restart-app-instance"] = application.NewRestartAppInstance(ui, config, repoLocator.GetAppInstancesRepository())
factory.cmdsByName["restage"] = restage
factory.cmdsByName["push"] = application.NewPush(
ui, config, manifestRepo, start, stop, bind,
repoLocator.GetApplicationRepository(),
repoLocator.GetDomainRepository(),
repoLocator.GetRouteRepository(),
repoLocator.GetStackRepository(),
repoLocator.GetServiceRepository(),
repoLocator.GetAuthenticationRepository(),
generator.NewWordGenerator(),
actors.NewPushActor(repoLocator.GetApplicationBitsRepository(), app_files.ApplicationZipper{}, app_files.ApplicationFiles{}),
app_files.ApplicationZipper{},
app_files.ApplicationFiles{})
factory.cmdsByName["scale"] = application.NewScale(ui, config, restart, repoLocator.GetApplicationRepository())
spaceRoleSetter := user.NewSetSpaceRole(ui, config, repoLocator.GetSpaceRepository(), repoLocator.GetUserRepository())
factory.cmdsByName["set-space-role"] = spaceRoleSetter
factory.cmdsByName["create-space"] = space.NewCreateSpace(ui, config, spaceRoleSetter, repoLocator.GetSpaceRepository(), repoLocator.GetOrganizationRepository(), repoLocator.GetUserRepository(), repoLocator.GetSpaceQuotaRepository())
factory.cmdsByName["service-access"] = serviceaccess.NewServiceAccess(
ui, config,
actors.NewServiceHandler(
repoLocator.GetOrganizationRepository(),
brokerBuilder,
serviceBuilder,
),
repoLocator.GetAuthenticationRepository(),
)
factory.cmdsByName["enable-service-access"] = serviceaccess.NewEnableServiceAccess(
ui, config,
actors.NewServicePlanHandler(
repoLocator.GetServicePlanRepository(),
repoLocator.GetServicePlanVisibilityRepository(),
repoLocator.GetOrganizationRepository(),
planBuilder,
serviceBuilder,
),
repoLocator.GetAuthenticationRepository(),
)
factory.cmdsByName["disable-service-access"] = serviceaccess.NewDisableServiceAccess(
ui, config,
actors.NewServicePlanHandler(
repoLocator.GetServicePlanRepository(),
repoLocator.GetServicePlanVisibilityRepository(),
repoLocator.GetOrganizationRepository(),
planBuilder,
serviceBuilder,
),
repoLocator.GetAuthenticationRepository(),
)
factory.cmdsByName["feature-flags"] = featureflag.NewListFeatureFlags(ui, config, repoLocator.GetFeatureFlagRepository())
factory.cmdsByName["feature-flag"] = featureflag.NewShowFeatureFlag(ui, config, repoLocator.GetFeatureFlagRepository())
factory.cmdsByName["enable-feature-flag"] = featureflag.NewEnableFeatureFlag(ui, config, repoLocator.GetFeatureFlagRepository())
factory.cmdsByName["disable-feature-flag"] = featureflag.NewDisableFeatureFlag(ui, config, repoLocator.GetFeatureFlagRepository())
factory.cmdsByName["running-environment-variable-group"] = environmentvariablegroup.NewRunningEnvironmentVariableGroup(ui, config, repoLocator.GetEnvironmentVariableGroupsRepository())
factory.cmdsByName["staging-environment-variable-group"] = environmentvariablegroup.NewStagingEnvironmentVariableGroup(ui, config, repoLocator.GetEnvironmentVariableGroupsRepository())
factory.cmdsByName["set-staging-environment-variable-group"] = environmentvariablegroup.NewSetStagingEnvironmentVariableGroup(ui, config, repoLocator.GetEnvironmentVariableGroupsRepository())
factory.cmdsByName["set-running-environment-variable-group"] = environmentvariablegroup.NewSetRunningEnvironmentVariableGroup(ui, config, repoLocator.GetEnvironmentVariableGroupsRepository())
factory.cmdsByName["uninstall-plugin"] = plugin.NewPluginUninstall(ui, pluginConfig, rpcService)
factory.cmdsByName["install-plugin"] = plugin.NewPluginInstall(ui, config, pluginConfig, factory.cmdsByName, actor_plugin_repo.NewPluginRepo(), utils.NewSha1Checksum(""), rpcService)
factory.cmdsByName["plugins"] = plugin.NewPlugins(ui, pluginConfig)
factory.cmdsByName["add-plugin-repo"] = plugin_repo.NewAddPluginRepo(ui, config)
factory.cmdsByName["list-plugin-repos"] = plugin_repo.NewListPluginRepos(ui, config)
factory.cmdsByName["remove-plugin-repo"] = plugin_repo.NewRemovePluginRepo(ui, config)
factory.cmdsByName["repo-plugins"] = plugin_repo.NewRepoPlugins(ui, config, actor_plugin_repo.NewPluginRepo())
factory.cmdsByName["copy-source"] = application.NewCopySource(
ui,
config,
repoLocator.GetAuthenticationRepository(),
repoLocator.GetApplicationRepository(),
repoLocator.GetOrganizationRepository(),
repoLocator.GetSpaceRepository(),
repoLocator.GetCopyApplicationSourceRepository(),
restart, //note this is built up above.
)
return
}
开发者ID:devraj1234,项目名称:cli,代码行数:101,代码来源:factory.go
示例6: 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
}
开发者ID:jsloyer,项目名称:cli,代码行数:84,代码来源:dependency.go
注:本文中的github.com/cloudfoundry/cli/cf/actors.NewServiceHandler函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论