//Show an Application.
554513
func Show(cmd *cli.Cmd) {
	uuid := cmd.String(cli.StringArg{
		Name:      "UUID",
		Desc:      "Application UUID",
		HideValue: true,
	})

	cmd.Action = func() {
		app := application.Application{
			UUID: *uuid,
		}

		application, resp, errs := app.Show()

		if errs != nil {
			log.Fatalf("Could not retrieve application: %s", errs)
		}

		if resp.StatusCode != 200 {
			log.Fatalf("Could not retrieve application: %s", resp.Status)
		}

		printAppDetail(application)
	}
}
1302186
func (s *DirectMessageService) Show(id int64) (*DirectMessage, *http.Response, error) {
	params := &directMessageShowParams{ID: id}
	dm := new(DirectMessage)
	apiError := new(APIError)
	resp, err := s.sling.New().Get("show.json").QueryStruct(params).Receive(dm, apiError)
	return dm, resp, relevantError(err, *apiError)
}
785780
func NewShowApplicationCommand() cmd.Command {
	s := &showApplicationCommand{}
	s.newAPIFunc = func() (ApplicationsInfoAPI, error) {
		return s.newApplicationAPI()
	}
	return modelcmd.Wrap(s)
}
1109146
func (c *CodebaseController) Show(ctx *app.ShowCodebaseContext) error {
	var cdb *codebase.Codebase
	err := application.Transactional(c.db, func(appl application.Application) error {
		var err error
		cdb, err = appl.Codebases().Load(ctx, ctx.CodebaseID)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	return ctx.OK(&app.CodebaseSingle{
		Data: ConvertCodebase(ctx.Request, *cdb),
	})

}
315284
func (mr *MockModelCacheUnitMockRecorder) Application() *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Application", reflect.TypeOf((*MockModelCacheUnit)(nil).Application))
}
1079519
func (o *L2Domain) Applications(info *bambou.FetchingInfo) (ApplicationsList, *bambou.Error) {

	var list ApplicationsList
	err := bambou.CurrentSession().FetchChildren(o, ApplicationIdentity, &list, info)
	return list, err
}
697938
func (b *BottleController) Show(ctx *app.ShowBottleContext) error {
	account, ok := b.db.GetAccount(ctx.AccountID)
	if !ok {
		return ctx.NotFound()
	}
	bottle, ok := b.db.GetBottle(account.ID, ctx.BottleID)
	if !ok {
		return ctx.NotFound()
	}
	return ctx.OK(ToBottleMedia(&account, &bottle))
}
374462
func Show(cmd *cli.Cmd) {
	email := cmd.String(cli.StringArg{
		Name:      "EMAIL",
		Desc:      "email address",
		HideValue: true,
	})

	cmd.Action = func() {
		a := authorization.Account{
			Email: *email,
		}

		account, resp, errs := a.Show()

		if len(errs) > 0 {
			log.Fatalf("Could not retrieve account: %s", errs[0])
		}

		if resp.StatusCode != 200 {
			log.Fatalf("Could not retrieve account: %s", resp.Status)
		}

		printAccountDetail(account)
	}
}
1247955
func (_m *Marathon) Application(name string) (*marathon.Application, error) {
	ret := _m.Called(name)

	var r0 *marathon.Application
	if rf, ok := ret.Get(0).(func(string) *marathon.Application); ok {
		r0 = rf(name)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*marathon.Application)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(name)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
203832
func (s *ListsService) Show(params *ListsShowParams) (*List, *http.Response, error) {
	list := new(List)
	apiError := new(APIError)
	resp, err := s.sling.New().Get("show.json").QueryStruct(params).Receive(list, apiError)
	return list, resp, relevantError(err, *apiError)
}
915444
func (s *applicationLister) Applications(namespace string) ApplicationNamespaceLister {
	return applicationNamespaceLister{indexer: s.indexer, namespace: namespace}
}
58762
func (c *UserController) Show(ctx *app.ShowUserContext) error {
	// retrieve the user's identity ID from the token
	identityID, err := c.tokenManager.Locate(ctx)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err,
		}, "Bad Token")
		return jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError("bad or missing token"))
	}
	user, identity, err := c.app.UserService().UserInfo(ctx, identityID)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	if user.Banned {
		ctx.ResponseData.Header().Add("Access-Control-Expose-Headers", "WWW-Authenticate")
		ctx.ResponseData.Header().Set("WWW-Authenticate", "DEPROVISIONED description=\"Account has been banned\"")
		return jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError("Account has been banned"))
	}

	return ctx.ConditionalRequest(*user, c.config.GetCacheControlUser, func() error {
		// Init tenant (if access to tenant service is configured/enabled)
		if c.tenantService != nil {
			go func(ctx context.Context) {
				c.tenantService.Init(ctx)
			}(ctx)
		}
		return ctx.OK(ConvertToAppUser(ctx.RequestData, user, identity, true))
	})
}
1355890
func (c *showApplicationCommand) Init(args []string) error {
	if len(args) < 1 {
		return errors.Errorf("an application name must be supplied")
	}
	c.apps = args
	var invalid []string
	for _, one := range c.apps {
		if !names.IsValidApplication(one) {
			invalid = append(invalid, one)
		}
	}
	if len(invalid) == 0 {
		return nil
	}
	plural := "s"
	if len(invalid) == 1 {
		plural = ""
	}
	return errors.NotValidf(`application name%v %v`, plural, strings.Join(invalid, `, `))
}
1133507
func (c *StatusController) Show(ctx *app.ShowStatusContext) error {
	res := &app.Status{
		Commit:    Commit,
		BuildTime: BuildTime,
		StartTime: StartTime,
	}

	devMode := c.config.IsPostgresDeveloperModeEnabled()
	if devMode {
		res.DevMode = &devMode
	}

	dbErr := c.dbChecker.Ping()
	if dbErr != nil {
		log.Error(ctx, map[string]interface{}{
			"db_error": dbErr.Error(),
		}, "database configuration error")
		res.DatabaseStatus = fmt.Sprintf("Error: %s", dbErr.Error())
	} else {
		res.DatabaseStatus = "OK"
	}

	configErr := c.config.DefaultConfigurationError()
	if configErr != nil {
		log.Error(ctx, map[string]interface{}{
			"config_error": configErr.Error(),
		}, "configuration error")
		res.ConfigurationStatus = fmt.Sprintf("Error: %s", configErr.Error())
	} else {
		res.ConfigurationStatus = "OK"
	}

	if dbErr != nil || (configErr != nil && !devMode) {
		return ctx.ServiceUnavailable(res)
	}
	return ctx.OK(res)
}
1084192
func (c *LabelController) Show(ctx *app.ShowLabelContext) error {
	var lbl *label.Label
	err := application.Transactional(c.db, func(appl application.Application) error {
		var err error
		lbl, err = appl.Labels().Load(ctx, ctx.LabelID)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	return ctx.OK(&app.LabelSingle{
		Data: ConvertLabel(ctx.Request, *lbl),
	})
}
165137
func getApp(p *pkgPod.Pod) (*schema.RuntimeApp, error) {
	_, manifest, err := p.PodManifest()
	if err != nil {
		return nil, errwrap.Wrap(errors.New("problem getting the pod's manifest"), err)
	}

	apps := manifest.Apps

	if flagExportAppName != "" {
		exportAppName, err := types.NewACName(flagExportAppName)
		if err != nil {
			return nil, err
		}
		for _, ra := range apps {
			if *exportAppName == ra.Name {
				return &ra, nil
			}
		}
		return nil, fmt.Errorf("app %s is not present in pod", flagExportAppName)
	}

	switch len(apps) {
	case 0:
		return nil, fmt.Errorf("pod contains zero apps")
	case 1:
		return &apps[0], nil
	default:
	}

	stderr.Print("pod contains multiple apps:")
	for _, ra := range apps {
		stderr.Printf("\t%v", ra.Name)
	}

	return nil, fmt.Errorf("specify app using \"rkt export --app= ...\"")
}
303976
func (c *SearchController) Show(ctx *app.ShowSearchContext) error {
	offset, limit := computePagingLimits(ctx.PageOffset, ctx.PageLimit)
	// TODO: Keep URL registeration central somehow.
	hostString := ctx.Request.Host
	if hostString == "" {
		hostString = c.configuration.GetHTTPAddress()
	}
	urlRegexString := fmt.Sprintf("(?P<domain>%s)(?P<path>/work-item/list/detail/)(?P<id>\\d*)", hostString)
	search.RegisterAsKnownURL(search.HostRegistrationKeyForListWI, urlRegexString)
	urlRegexString = fmt.Sprintf("(?P<domain>%s)(?P<path>/work-item/board/detail/)(?P<id>\\d*)", hostString)
	search.RegisterAsKnownURL(search.HostRegistrationKeyForBoardWI, urlRegexString)

	if ctx.FilterExpression != nil {
		var result []workitem.WorkItem
		var count int
		var ancestors link.AncestorList
		var childLinks link.WorkItemLinkList
		err := application.Transactional(c.db, func(appl application.Application) error {
			var err error
			result, count, ancestors, childLinks, err = appl.SearchItems().Filter(ctx.Context, *ctx.FilterExpression, ctx.FilterParentexists, &offset, &limit)
			if err != nil {
				cause := errs.Cause(err)
				switch cause.(type) {
				case errors.BadParameterError:
					return goa.ErrBadRequest(fmt.Sprintf("error listing work items for expression '%s': %s", *ctx.FilterExpression, err))
				default:
					log.Error(ctx, map[string]interface{}{
						"err":               err,
						"filter_expression": *ctx.FilterExpression,
					}, "unable to list the work items")
					return goa.ErrInternal(fmt.Sprintf("unable to list the work items: %s", err))
				}
			}
			return nil

		})
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		matchingWorkItemIDs := make(id.Slice, len(result))
		for i, wi := range result {
			matchingWorkItemIDs[i] = wi.ID
		}
		hasChildren := workItemIncludeHasChildren(ctx, c.db, childLinks)
		includeParent := includeParentWorkItem(ctx, ancestors, childLinks)
		// Load all work item types
		wits, err := loadWorkItemTypesFromArr(ctx.Context, c.db, result)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "failed to load work item types"))
		}

		wis, err := ConvertWorkItems(ctx.Request, wits, result, hasChildren, includeParent)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		response := app.SearchWorkItemList{
			Links: &app.PagingLinks{},
			Meta: &app.WorkItemListResponseMeta{
				TotalCount: count,
			},
			Data: wis,
		}
		err = c.enrichWorkItemList(ctx, ancestors, matchingWorkItemIDs, childLinks, &response, hasChildren) // append parentWI and ancestors (if not empty) in response
		if err != nil {
			return errs.Wrap(err, "failed to enrich work item list")
		}
		setPagingLinks(response.Links, buildAbsoluteURL(ctx.Request), len(result), offset, limit, count, "filter[expression]="+*ctx.FilterExpression)

		// Sort "data" by name or ID if no title given
		var data WorkItemPtrSlice = response.Data
		sort.Sort(data)
		response.Data = data

		// Sort work items in the "included" array by ID or title
		var included WorkItemInterfaceSlice = response.Included
		sort.Sort(included)
		response.Included = included

		// build up list of sorted ancestor IDs from already sorted work items
		ancestorIDs := ancestors.GetDistinctAncestorIDs().ToMap()
		sortedAncestorIDs := make(id.Slice, len(ancestorIDs))
		i := 0
		for _, wi := range response.Data {
			if len(ancestorIDs) <= 0 {
				break
			}
			_, ok := ancestorIDs[*wi.ID]
			if ok {
				sortedAncestorIDs[i] = *wi.ID
				i++
				delete(ancestorIDs, *wi.ID)
			}
		}
		for _, ifObj := range response.Included {
			if len(ancestorIDs) <= 0 {
				break
			}
			var wi *app.WorkItem
			switch v := ifObj.(type) {
			case app.WorkItem:
				wi = &v
			case *app.WorkItem:
				wi = v
			default:
				continue
			}
			_, ok := ancestorIDs[*wi.ID]
			if ok {
				sortedAncestorIDs[i] = *wi.ID
				i++
				delete(ancestorIDs, *wi.ID)
			}
		}
		response.Meta.AncestorIDs = sortedAncestorIDs
		return ctx.OK(&response)
	}
	var result []workitem.WorkItem
	var count int
	err := application.Transactional(c.db, func(appl application.Application) error {
		if ctx.Q == nil || *ctx.Q == "" {
			return goa.ErrBadRequest("empty search query not allowed")
		}
		var err error
		result, count, err = appl.SearchItems().SearchFullText(ctx.Context, *ctx.Q, &offset, &limit, ctx.SpaceID)
		if err != nil {
			log.Error(ctx, map[string]interface{}{
				"err":        err,
				"expression": *ctx.Q,
			}, "unable to list the work items")
			return errs.Wrapf(err, "unable to list the work items for expression: %s", *ctx.Q)
		}
		return nil
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	wits, err := loadWorkItemTypesFromArr(ctx.Context, c.db, result)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	wis, err := ConvertWorkItems(ctx.Request, wits, result)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	response := app.SearchWorkItemList{
		Links: &app.PagingLinks{},
		Meta:  &app.WorkItemListResponseMeta{TotalCount: count},
		Data:  wis,
	}
	setPagingLinks(response.Links, buildAbsoluteURL(ctx.Request), len(result), offset, limit, count, "q="+*ctx.Q)
	return ctx.OK(&response)
}