Binding an Application to the Enterprise Connect Instance
About this task
You must bind your application to your Enterprise Connect instance to provision its connection details in the VCAP_SERVICES environment variable. Cloud Foundry runtime uses VCAP_SERVICES environment variable to communicate with a deployed application about its environment.
You can retrieve the following Enterprise Connect instance details from the VCAP_SERVICES environment variable:
-
An
enterprise_connect_instance_uri
for your instance. -
HTTP header information to access your Enterprise Connect instance. It includes:
http-header-name
asPredix-Zone-Id
http-header-value
-
An
oauth-scope
for your instance. The scope is required in the end-user token to access a specific Enterprise Connect instance.
Procedure
- Bind your application to the new Enterprise Connect instance.
cf bind-service <your_app_name> <enterprise_connect_instance_name>
The<enterprise_connect_instance_name>
instance is bound to your application, and the following message is returned:Binding service <enterprise_connect_instance_name> to app <your_app_name> in org predix-platform / space predix as [email protected]... OK TIP: Use 'cf restage' to ensure your env variable changes take effect
- Verify the binding:
cf env <your_app_name>
Messages that are similar to the following messages are returned:"VCAP_SERVICES": { "enterprise-connect": [ { "credentials": { "admin-token": " YWRtaW46ZUVEMTkxdFBPOTgzMjZjMYMtNXIwOS00OGIzLTg2YzMtNDL1YTk5M2U0BzJj" "ec-info": { "ids": { "<random_string>”, "<random_string>" ], "trustedIssuerIds": [ "https://UAA-Instance-URL.predix-uaa.run.aws-usw02-pr.ice.predix.io/oauth/token" ] }, "service-uri": "https://<Predix-Zone-Id>.run.asv-pr.ice.predix.io" "usage-doc": "https://github.com/Enterprise-connect/ec-sdk/wiki", "zone": { "http-header-name": "Predix-Zone-Id", "http-header-value": "<Predix-Zone-Id>", "oauth-scope": "enterprise-connect.zones.<Predix-Zone-Id>.user" } }, "label": "enterprise-connect", "name": "hello-world-app-1", "plan": "<plan>", "provider": null, "syslog_drain_url": null, "tags": [], "volume_mounts": [] } ] }