示例#1
0
func (cmd *Application) show(appName string) {
	application, err := application.Application(cmd.network, appName)
	if nil != err {
		error_handler.ErrorExit(err)
	}
	entity, err := entities.GetEntity(cmd.network, appName, appName)
	if nil != err {
		error_handler.ErrorExit(err)
	}
	state, err := entity_sensors.CurrentState(cmd.network, appName, appName)
	if nil != err {
		error_handler.ErrorExit(err)
	}
	location, err := locations.GetLocation(cmd.network, application.Spec.Locations[0])
	if nil != err {
		error_handler.ErrorExit(err)
	}
	table := terminal.NewTable([]string{"Id:", application.Id})
	table.Add("Name:", application.Spec.Name)
	table.Add("Status:", string(application.Status))
	if serviceUp, ok := state[serviceIsUpStr]; ok {
		table.Add("ServiceUp:", fmt.Sprintf("%v", serviceUp))
	}
	table.Add("Type:", application.Spec.Type)
	table.Add("CatalogItemId:", entity.CatalogItemId)
	table.Add("LocationId:", strings.Join(application.Spec.Locations, ", "))
	table.Add("LocationName:", location.Name)
	table.Add("LocationSpec:", location.Spec)
	table.Add("LocationType:", location.Type)
	table.Print()
}
示例#2
0
func (cmd *Entity) show(application, entity string) {
	summary, err := entities.GetEntity(cmd.network, application, entity)
	if nil != err {
		fmt.Fprintf(os.Stderr, "Error: %s\n", err)
		os.Exit(1)
	}
	table := terminal.NewTable([]string{"Id:", summary.Id})
	table.Add("Name:", summary.Name)
	configState, err := entity_sensors.CurrentState(cmd.network, application, entity)
	if nil != err {
		error_handler.ErrorExit(err)
	}
	if serviceState, ok := configState[serviceStateSensor]; ok {
		table.Add("Status:", fmt.Sprintf("%v", serviceState))
	}
	if serviceIsUp, ok := configState[serviceIsUp]; ok {
		table.Add("ServiceUp:", fmt.Sprintf("%v", serviceIsUp))
	}
	table.Add("Type:", summary.Type)
	table.Add("CatalogItemId:", summary.CatalogItemId)
	table.Print()
}