How to retrieve credentials from services using the cf cli v6
In some cases you need to retrieve user credentials for your services from the anynines system. For example if you want to access a swift service instance's containers from outside of the anynines system.
You can use the cf service command to retrieve the credentials and meta information for a given service in one of your spaces:
$> CF_TRACE=true cf service <your_service_name>
The CF_TRACE environment variable enables the output of a detailed trace of the interactions between the cli v6 and the anynines Cloud Controller.
The following snippet shows an example output for a PostgreSQL service instance named test_service using the Pluto-free plan:
{ "total_results": 1, "total_pages": 1, "prev_url": null, "next_url": null, "resources": [ { "metadata": { "guid": "1da2ea1e-738f-49d1-98a2-aca7ba906397", "url": "/v2/service_instances/1da2ea1e-738f-49d1-98a2-aca7ba906397", "created_at": "2014-09-05T08:58:09+00:00", "updated_at": null }, "entity": { "name": "test_service", "credentials": { "name": "d7dfa6dc323754780bb459af394c660fb", "host": "10.12.0.9", "hostname": "10.12.0.9", "port": 5433, "user": "ucc24bf3744ad4234a1c9fbf72ecf11ed", "username": "ucc24bf3744ad4234a1c9fbf72ecf11ed", "password":"[PRIVATE DATA HIDDEN]", "uri": "postgres://ucc24bf3744ad4234a1c9fbf72ecf11ed:the_password@10.12.0.9:5433/d7dfa6dc323754780bb459af394c660fb", "node_id": "postgresql_node_Pluto-free_0" }, "service_plan_guid": "9a720b12-e37e-4fbb-99b3-325b9e5d78aa", "space_guid": "d56d5410-5092-4dd6-a52e-3c460c68d4cb", "gateway_data": { "plan": "Pluto-free", "version": "9.1" }, "dashboard_url": null, "type": "managed_service_instance", "space_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb", "space": { "metadata": { "guid": "d56d5410-5092-4dd6-a52e-3c460c68d4cb", "url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb", "created_at": "2013-07-22T12:15:44+00:00", "updated_at": "2014-07-02T12:30:07+00:00" }, "entity": { "name": "test", "organization_guid": "93c41150-3b49-478e-87c5-ec615358dacb", "organization_url": "/v2/organizations/93c41150-3b49-478e-87c5-ec615358dacb", "developers_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb/developers", "managers_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb/managers", "auditors_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb/auditors", "apps_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb/apps", "routes_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb/routes", "domains_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb/domains", "service_instances_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb/service_instances", "app_events_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb/app_events", "events_url": "/v2/spaces/d56d5410-5092-4dd6-a52e-3c460c68d4cb/events" } }, "service_plan_url": "/v2/service_plans/9a720b12-e37e-4fbb-99b3-325b9e5d78aa", "service_plan": { "metadata": { "guid": "9a720b12-e37e-4fbb-99b3-325b9e5d78aa", "url": "/v2/service_plans/9a720b12-e37e-4fbb-99b3-325b9e5d78aa", "created_at": "2014-03-11T14:34:25+00:00", "updated_at": null }, "entity": { "name": "Pluto-free", "free": true, "description": "Shared VM, shared DB: free plan", "service_guid": "e8ccbddb-ff8e-431f-9ea5-b55cfca90a02", "extra": null, "unique_id": "Pluto-free-b98ab4cc-53e3-44a0-a53b-f09d7827f950", "public": true, "service_url": "/v2/services/e8ccbddb-ff8e-431f-9ea5-b55cfca90a02", "service_instances_url": "/v2/service_plans/9a720b12-e37e-4fbb-99b3-325b9e5d78aa/service_instances" } }, "service_bindings_url": "/v2/service_instances/1da2ea1e-738f-49d1-98a2-aca7ba906397/service_bindings", "service_bindings": [ ] } } ] } ... { "metadata": { "guid": "e8ccbddb-ff8e-431f-9ea5-b55cfca90a02", "url": "/v2/services/e8ccbddb-ff8e-431f-9ea5-b55cfca90a02", "created_at": "2013-05-28T14:33:04+00:00", "updated_at": "2014-09-05T08:58:13+00:00" }, "entity": { "label": "postgresql", "provider": "core", "url": "http://10.10.0.50:33573", "description": "PostgreSQL database (vFabric)", "long_description": null, "version": "9.1", "info_url": null, "active": true, "bindable": true, "unique_id": "core_postgresql", "extra": null, "tags": [ ], "requires": [ ], "documentation_url": null, "service_broker_guid": null, "service_plans_url": "/v2/services/e8ccbddb-ff8e-431f-9ea5-b55cfca90a02/service_plans" } } Service instance: test_service Service: postgresql Plan: Pluto-free Description: PostgreSQL database (vFabric) Documentation url:
The service credentials can be retrieved from the credentials hash.
0
Please sign in to leave a comment.
Comments
0 comments