For spring cloud services you may need to identify the service instance for a specific SERVICE_INSTANCE_GUID.
This provides the steps to identify the service instance name and location (org/space)
1. Get the service name using the "entity.name".
$ cf curl /v2/service_instances/8b8f0862-c6fb-4a2d-9479-c4306c6a0134
{
"metadata": {
"guid": "8b8f0862-c6fb-4a2d-9479-c4306c6a0134",
"url": "/v2/service_instances/8b8f0862-c6fb-4a2d-9479-c4306c6a0134",
"created_at": "2022-01-21T20:39:34Z",
"updated_at": "2022-01-21T20:39:34Z"
},
"entity": {
"name": "config-periodic",
"credentials": {},
"service_plan_guid": "6c9d5c0d-dd37-4e3d-8c30-dcb4b6785cfd",
"space_guid": "27687e6f-0c8a-4bc2-b271-95535bef4ac3",
"gateway_data": null,
"dashboard_url": "https://config-server-8b8f0862-c6fb-4a2d-9479-c4306c6a0134.example.com/dashboard"",
"type": "managed_service_instance",
"last_operation": {
"type": "create",
"state": "succeeded",
"description": "create service instance completed",
"updated_at": "2022-01-21T20:40:41Z",
"created_at": "2022-01-21T20:39:34Z"
},
"tags": [],
"maintenance_info": {},
"service_guid": "09a7dfcf-27b6-4b07-8cc6-aa18cd53b795",
"space_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3",
"service_plan_url": "/v2/service_plans/6c9d5c0d-dd37-4e3d-8c30-dcb4b6785cfd",
"service_bindings_url": "/v2/service_instances/8b8f0862-c6fb-4a2d-9479-c4306c6a0134/service_bindings",
"service_keys_url": "/v2/service_instances/8b8f0862-c6fb-4a2d-9479-c4306c6a0134/service_keys",
"routes_url": "/v2/service_instances/8b8f0862-c6fb-4a2d-9479-c4306c6a0134/routes",
"service_url": "/v2/services/09a7dfcf-27b6-4b07-8cc6-aa18cd53b795",
"shared_from_url": "/v2/service_instances/8b8f0862-c6fb-4a2d-9479-c4306c6a0134/shared_from",
"shared_to_url": "/v2/service_instances/8b8f0862-c6fb-4a2d-9479-c4306c6a0134/shared_to",
"service_instance_parameters_url": "/v2/service_instances/8b8f0862-c6fb-4a2d-9479-c4306c6a0134/parameters"
}
}
2. Get the space name with the "space_url"
cf curl /v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3
{
"metadata": {
"guid": "27687e6f-0c8a-4bc2-b271-95535bef4ac3",
"url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3",
"created_at": "2022-01-20T04:04:07Z",
"updated_at": "2022-01-20T04:04:07Z"
},
"entity": {
"name": "myspace",
"organization_guid": "98238b78-a7ee-4b6f-9631-71483ace639e",
"space_quota_definition_guid": null,
"isolation_segment_guid": null,
"allow_ssh": true,
"organization_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e",
"developers_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/developers",
"managers_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/managers",
"auditors_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/auditors",
"apps_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/apps",
"routes_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/routes",
"domains_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/domains",
"service_instances_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/service_instances",
"app_events_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/app_events",
"events_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/events",
"security_groups_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/security_groups",
"staging_security_groups_url": "/v2/spaces/27687e6f-0c8a-4bc2-b271-95535bef4ac3/staging_security_groups"
}
}
3. Get the org name with "organization_url"
$ cf curl /v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e
{
"metadata": {
"guid": "98238b78-a7ee-4b6f-9631-71483ace639e",
"url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e",
"created_at": "2022-01-20T04:03:51Z",
"updated_at": "2022-01-20T04:03:51Z"
},
"entity": {
"name": "myorg",
"billing_enabled": false,
"quota_definition_guid": "2518e86a-b576-4520-96cb-516aa41819b0",
"status": "active",
"default_isolation_segment_guid": null,
"quota_definition_url": "/v2/quota_definitions/2518e86a-b576-4520-96cb-516aa41819b0",
"spaces_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e/spaces",
"domains_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e/domains",
"private_domains_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e/private_domains",
"users_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e/users",
"managers_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e/managers",
"billing_managers_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e/billing_managers",
"auditors_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e/auditors",
"app_events_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e/app_events",
"space_quota_definitions_url": "/v2/organizations/98238b78-a7ee-4b6f-9631-71483ace639e/space_quota_definitions"
}
}
4. The mirror service instance bc482cb0-981e-476e-8672-91c2d55e69c5 is referring to the
Service instance name is "config-periodic" in org "myorg" space "myspace"