当前位置: 首页>>代码示例>>Golang>>正文


Golang actors.NewRouteActor函数代码示例

本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/actors.NewRouteActor函数的典型用法代码示例。如果您正苦于以下问题:Golang NewRouteActor函数的具体用法?Golang NewRouteActor怎么用?Golang NewRouteActor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewRouteActor函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Run

func (cmd *Push) Run(c *cli.Context) {
	appSet := cmd.findAndValidateAppsToPush(c)
	_, apiErr := cmd.authRepo.RefreshAuthToken()
	if apiErr != nil {
		cmd.ui.Failed(fmt.Sprintf("Error refreshing auth token.\n%s", apiErr.Error()))
		return
	}

	routeActor := actors.NewRouteActor(cmd.ui, cmd.routeRepo)
	noHostname := c.Bool("no-hostname")

	for _, appParams := range appSet {
		cmd.fetchStackGuid(&appParams)
		app := cmd.createOrUpdateApp(appParams)

		cmd.updateRoutes(routeActor, app, appParams, noHostname)

		cmd.ui.Say(T("Uploading {{.AppName}}...",
			map[string]interface{}{"AppName": terminal.EntityNameColor(app.Name)}))

		apiErr := cmd.appBitsRepo.UploadApp(app.Guid, *appParams.Path, cmd.describeUploadOperation)
		if apiErr != nil {
			cmd.ui.Failed(fmt.Sprintf(T("Error uploading application.\n{{.ApiErr}}",
				map[string]interface{}{"ApiErr": apiErr.Error()})))
			return
		}
		cmd.ui.Ok()

		if appParams.ServicesToBind != nil {
			cmd.bindAppToServices(*appParams.ServicesToBind, app)
		}

		cmd.restart(app, appParams, c)
	}
}
开发者ID:ramirito,项目名称:cli,代码行数:35,代码来源:push.go

示例2: Execute

func (cmd *Push) Execute(c flags.FlagContext) {
	appSet := cmd.findAndValidateAppsToPush(c)
	_, apiErr := cmd.authRepo.RefreshAuthToken()
	if apiErr != nil {
		cmd.ui.Failed(apiErr.Error())
		return
	}

	routeActor := actors.NewRouteActor(cmd.ui, cmd.routeRepo)

	for _, appParams := range appSet {
		cmd.fetchStackGuid(&appParams)
		app := cmd.createOrUpdateApp(appParams)

		cmd.updateRoutes(routeActor, app, appParams)

		cmd.ui.Say(T("Uploading {{.AppName}}...",
			map[string]interface{}{"AppName": terminal.EntityNameColor(app.Name)}))

		apiErr := cmd.uploadApp(app.Guid, *appParams.Path)
		if apiErr != nil {
			cmd.ui.Failed(fmt.Sprintf(T("Error uploading application.\n{{.ApiErr}}",
				map[string]interface{}{"ApiErr": apiErr.Error()})))
			return
		}
		cmd.ui.Ok()

		if appParams.ServicesToBind != nil {
			cmd.bindAppToServices(*appParams.ServicesToBind, app)
		}

		cmd.restart(app, appParams, c)
	}
}
开发者ID:ralfcam,项目名称:cli,代码行数:34,代码来源:push.go

示例3: Execute

func (cmd *Push) Execute(c flags.FlagContext) {
	appSet := cmd.findAndValidateAppsToPush(c)
	_, apiErr := cmd.authRepo.RefreshAuthToken()
	if apiErr != nil {
		cmd.ui.Failed(apiErr.Error())
		return
	}

	routeActor := actors.NewRouteActor(cmd.ui, cmd.routeRepo)

	for _, appParams := range appSet {
		cmd.fetchStackGuid(&appParams)

		if c.IsSet("docker-image") {
			diego := true
			appParams.Diego = &diego
		}

		app := cmd.createOrUpdateApp(appParams)

		cmd.updateRoutes(routeActor, app, appParams)

		if c.String("docker-image") == "" {
			err := cmd.actor.ProcessPath(*appParams.Path, cmd.processPathCallback(*appParams.Path, app))
			if err != nil {
				cmd.ui.Failed(
					T("Error processing app files: {{.Error}}",
						map[string]interface{}{
							"Error": err.Error(),
						}),
				)
				return
			}
		}

		if appParams.ServicesToBind != nil {
			cmd.bindAppToServices(*appParams.ServicesToBind, app)
		}

		cmd.restart(app, appParams, c)
	}
}
开发者ID:plamenai,项目名称:cli,代码行数:42,代码来源:push.go

示例4: Execute

func (cmd *Push) Execute(c flags.FlagContext) {
	appSet := cmd.findAndValidateAppsToPush(c)
	_, apiErr := cmd.authRepo.RefreshAuthToken()
	if apiErr != nil {
		cmd.ui.Failed(apiErr.Error())
		return
	}

	routeActor := actors.NewRouteActor(cmd.ui, cmd.routeRepo)

	for _, appParams := range appSet {
		cmd.fetchStackGuid(&appParams)

		if c.IsSet("docker-image") {
			diego := true
			appParams.Diego = &diego
		}

		app := cmd.createOrUpdateApp(appParams)

		cmd.updateRoutes(routeActor, app, appParams)

		if c.String("docker-image") == "" {
			cmd.actor.ProcessPath(*appParams.Path, func(appDir string) {
				localFiles, err := cmd.appfiles.AppFilesInDir(appDir)
				if err != nil {
					cmd.ui.Failed(
						T("Error processing app files in '{{.Path}}': {{.Error}}",
							map[string]interface{}{
								"Path":  *appParams.Path,
								"Error": err.Error(),
							}),
					)
				}

				if len(localFiles) == 0 {
					cmd.ui.Failed(
						T("No app files found in '{{.Path}}'",
							map[string]interface{}{
								"Path": *appParams.Path,
							}),
					)
				}

				cmd.ui.Say(T("Uploading {{.AppName}}...",
					map[string]interface{}{"AppName": terminal.EntityNameColor(app.Name)}))

				apiErr := cmd.uploadApp(app.Guid, appDir, *appParams.Path, localFiles)
				if apiErr != nil {
					cmd.ui.Failed(fmt.Sprintf(T("Error uploading application.\n{{.ApiErr}}",
						map[string]interface{}{"ApiErr": apiErr.Error()})))
					return
				}
				cmd.ui.Ok()
			})
		}

		if appParams.ServicesToBind != nil {
			cmd.bindAppToServices(*appParams.ServicesToBind, app)
		}

		cmd.restart(app, appParams, c)
	}
}
开发者ID:vframbach,项目名称:cli,代码行数:64,代码来源:push.go

示例5: Execute

func (cmd *Push) Execute(c flags.FlagContext) {
	appsFromManifest := cmd.getAppParamsFromManifest(c)
	appFromContext := cmd.getAppParamsFromContext(c)
	appSet := cmd.createAppSetFromContextAndManifest(appFromContext, appsFromManifest)

	_, err := cmd.authRepo.RefreshAuthToken()
	if err != nil {
		cmd.ui.Failed(err.Error())
		return
	}

	routeActor := actors.NewRouteActor(cmd.ui, cmd.routeRepo)

	for _, appParams := range appSet {
		if appParams.Name == nil {
			cmd.ui.Failed(T("Error: No name found for app"))
		}

		cmd.fetchStackGuid(&appParams)

		if c.IsSet("docker-image") {
			diego := true
			appParams.Diego = &diego
		}

		var app models.Application
		existingApp, err := cmd.appRepo.Read(*appParams.Name)
		switch err.(type) {
		case nil:
			cmd.ui.Say(T("Updating app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...",
				map[string]interface{}{
					"AppName":   terminal.EntityNameColor(existingApp.Name),
					"OrgName":   terminal.EntityNameColor(cmd.config.OrganizationFields().Name),
					"SpaceName": terminal.EntityNameColor(cmd.config.SpaceFields().Name),
					"Username":  terminal.EntityNameColor(cmd.config.Username())}))

			if appParams.EnvironmentVars != nil {
				for key, val := range existingApp.EnvironmentVars {
					if _, ok := (*appParams.EnvironmentVars)[key]; !ok {
						(*appParams.EnvironmentVars)[key] = val
					}
				}
			}

			app, err = cmd.appRepo.Update(existingApp.Guid, appParams)
			if err != nil {
				cmd.ui.Failed(err.Error())
			}
		case *errors.ModelNotFoundError:
			spaceGuid := cmd.config.SpaceFields().Guid
			appParams.SpaceGuid = &spaceGuid

			cmd.ui.Say(T("Creating app {{.AppName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...",
				map[string]interface{}{
					"AppName":   terminal.EntityNameColor(*appParams.Name),
					"OrgName":   terminal.EntityNameColor(cmd.config.OrganizationFields().Name),
					"SpaceName": terminal.EntityNameColor(cmd.config.SpaceFields().Name),
					"Username":  terminal.EntityNameColor(cmd.config.Username())}))

			app, err = cmd.appRepo.Create(appParams)
			if err != nil {
				cmd.ui.Failed(err.Error())
			}
		default:
			cmd.ui.Failed(err.Error())
		}

		cmd.ui.Ok()
		cmd.ui.Say("")

		cmd.updateRoutes(routeActor, app, appParams)

		if c.String("docker-image") == "" {
			err := cmd.actor.ProcessPath(*appParams.Path, cmd.processPathCallback(*appParams.Path, app))
			if err != nil {
				cmd.ui.Failed(
					T("Error processing app files: {{.Error}}",
						map[string]interface{}{
							"Error": err.Error(),
						}),
				)
				return
			}
		}

		if appParams.ServicesToBind != nil {
			cmd.bindAppToServices(*appParams.ServicesToBind, app)
		}

		cmd.restart(app, appParams, c)
	}
}
开发者ID:cloudfoundry-incubator,项目名称:Diego-Enabler,代码行数:92,代码来源:push.go

示例6: NewDependency

func NewDependency(writer io.Writer, logger trace.Printer, envDialTimeout string) 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, envDialTimeout),
		"uaa":              net.NewUAAGateway(deps.Config, deps.UI, logger, envDialTimeout),
		"routing-api":      net.NewRoutingAPIGateway(deps.Config, time.Now, deps.UI, logger, envDialTimeout),
	}
	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.RouteActor = actors.NewRouteActor(deps.UI, deps.RepoLocator.GetRouteRepository())

	deps.ChecksumUtil = utils.NewSha1Checksum("")

	deps.Logger = logger

	return deps
}
开发者ID:Reejoshi,项目名称:cli,代码行数:85,代码来源:dependency.go


注:本文中的github.com/cloudfoundry/cli/cf/actors.NewRouteActor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。