Re: Java: How to find out user, org, application


David Farrell
 

Hi,

To find *Org name* you could use something like

*cf curl /v2/apps/`cf app spring-music --guid`/summary | jq -r
".space_guid" | xargs -I '<guid>' cf curl '/v2/spaces/<guid>' | jq -r
".entity.organization_url" | xargs -I '<org_url>' cf curl '<org_url>' | jq
-r '.entity.name <http://entity.name>' | xargs -I '<org_name>' echo Org
Name : '<org_name>' *

To find *Space name* you could use something like

*cf curl /v2/apps/`cf app spring-music --guid`/summary | jq -r
".space_guid" | xargs -I '<guid>' cf curl '/v2/spaces/<guid>' | jq -r
".entity.name <http://entity.name>" | xargs -I '<space_name>' echo Space
name : '<space_name>' *

Replace *spring-music *with your app name

Note. You might have to install jq [0] or else replace with something like
sed, awk and grep


[0] - https://stedolan.github.io/jq/

On 11 April 2017 at 11:46, CF_genn <CF_subscription(a)streber24.de> wrote:

Hi CF-DEV,
I have a Java app deployed and running. Is it possible to find out from the
application
- in what org / space it is running?
- can it find out its own name? (as shown in "cf apps")

Thank you!





--
View this message in context: http://cf-dev.70369.x6.nabble.
com/Java-How-to-find-out-user-org-application-tp6729.html
Sent from the CF Dev mailing list archive at Nabble.com.
--
Kind Regards,

David Farrell

Pivotal Global Support Services (GSS)

Email: dafarrell(a)pivotal.io
Office #: +353 21 4238482
Office Hours: Mon-Fri 8:30 AM to 5PM <GMT+1>
Out of Office Hours Contact +1 877-477-2269

Pivotal GSS Contact & Escalations:
https://discuss.zendesk.com/hc/en-us/articles/203809556



pivotal.io

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.