コード例 #1
0
func (command DiegoAppsCommand) Execute([]string) error {
	cliConnection := DiegoEnabler.CLIConnection
	runtime := ui.Diego

	err := errorhelpers.ErrorIfOrgAndSpacesSet(command.Organization, command.Space)
	if err != nil {
		return err
	}

	appsGetter, err := diegohelpers.NewAppsGetterFunc(cliConnection, command.Organization, command.Space, runtime)
	if err != nil {
		return err
	}

	listAppsCommand, err := listhelpers.NewListAppsCommand(cliConnection, command.Organization, command.Space, runtime)
	if err != nil {
		return err
	}

	err = listhelpers.ListApps(cliConnection, appsGetter, &listAppsCommand)
	if err != nil {
		return err
	}
	return nil
}
コード例 #2
0
func (command MigrateAppsCommand) Execute([]string) error {
	cliConnection := DiegoEnabler.CLIConnection

	runtime, err := ui.ParseRuntime(command.RequiredOptions.Runtime)
	if err != nil {
		return err
	}

	err = errorhelpers.ErrorIfOrgAndSpacesSet(command.Organization, command.Space)
	if err != nil {
		return err
	}

	appsGetter, err := diegohelpers.NewAppsGetterFunc(cliConnection, command.Organization, command.Space, runtime.Flip())
	if err != nil {
		return err
	}

	migrateAppsCommand, err := migratehelpers.NewMigrateAppsCommand(cliConnection, command.Organization, command.Space, runtime)
	if err != nil {
		return err
	}

	cmd := migratehelpers.MigrateApps{
		MaxInFlight:        command.MaxInFlight.Value,
		Runtime:            runtime,
		AppsGetterFunc:     appsGetter,
		MigrateAppsCommand: &migrateAppsCommand,
	}

	return cmd.Execute(cliConnection)
}