Skip to content

Commit 482ad8a

Browse files
committed
Add Application ID to List Route Applications
Previously we did not allow for retrieving a specific application when listing applications for a route. This commit adds the application id field to allow for this. [resolves #604]
1 parent d0cd4da commit 482ad8a

File tree

3 files changed

+52
-43
lines changed

3 files changed

+52
-43
lines changed

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v2/routes/ReactorRoutesTest.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public void list() {
309309
public void listApplications() {
310310
mockRequest(InteractionContext.builder()
311311
.request(TestRequest.builder()
312-
.method(GET).path("/v2/routes/test-route-id/apps?page=-1")
312+
.method(GET).path("/v2/routes/81464707-0f48-4ab9-87dc-667ef15489fb/apps?app_guid=6e62b293-f4c8-405a-be2b-b719e2848984")
313313
.build())
314314
.response(TestResponse.builder()
315315
.status(OK)
@@ -319,44 +319,44 @@ public void listApplications() {
319319

320320
this.routes
321321
.listApplications(ListRouteApplicationsRequest.builder()
322-
.routeId("test-route-id")
323-
.page(-1)
322+
.routeId("81464707-0f48-4ab9-87dc-667ef15489fb")
323+
.applicationId("6e62b293-f4c8-405a-be2b-b719e2848984")
324324
.build())
325325
.as(StepVerifier::create)
326326
.expectNext(ListRouteApplicationsResponse.builder()
327327
.totalResults(1)
328328
.totalPages(1)
329329
.resource(ApplicationResource.builder()
330330
.metadata(Metadata.builder()
331-
.id("f1243da8-e613-490a-8a0e-21ef1bcce952")
332-
.url("/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952")
333-
.createdAt("2015-11-30T23:38:56Z")
334-
.updatedAt("2015-11-30T23:38:56Z")
331+
.createdAt("2016-06-08T16:41:28Z")
332+
.id("6141e57e-7636-480b-8f17-78c6049813f6")
333+
.updatedAt("2016-06-08T16:41:28Z")
334+
.url("/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6")
335335
.build())
336336
.entity(ApplicationEntity.builder()
337-
.name("name-2404")
338-
.production(false)
339-
.spaceId("55f1c5ea-12a5-4128-8f20-606af2a3bce1")
340-
.stackId("0ef84d2a-4fdd-43ba-afbc-074a5e19ea66")
341-
.memory(1024)
342-
.instances(1)
343-
.diskQuota(1024)
344-
.state("STOPPED")
345-
.version("5c7c81b2-941b-48a6-b718-c57c02a5f802")
346337
.console(false)
347-
.packageState("PENDING")
348-
.healthCheckType("port")
349-
.diego(false)
350-
.packageUpdatedAt("2015-11-30T23:38:56Z")
351338
.detectedStartCommand("")
352-
.enableSsh(true)
339+
.diego(false)
340+
.diskQuota(1024)
353341
.dockerCredentialsJson("redacted_message", "[PRIVATE DATA HIDDEN]")
354-
.spaceUrl("/v2/spaces/55f1c5ea-12a5-4128-8f20-606af2a3bce1")
355-
.stackUrl("/v2/stacks/0ef84d2a-4fdd-43ba-afbc-074a5e19ea66")
356-
.eventsUrl("/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952/events")
357-
.serviceBindingsUrl("/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952/service_bindings")
358-
.routesUrl("/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952/routes")
359-
.routeMappingsUrl("/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952/route_mappings")
342+
.enableSsh(true)
343+
.eventsUrl("/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6/events")
344+
.memory(1024)
345+
.healthCheckType("port")
346+
.instances(1)
347+
.name("name-1412")
348+
.packageState("PENDING")
349+
.packageUpdatedAt("2016-06-08T16:41:28Z")
350+
.production(false)
351+
.routeMappingsUrl("/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6/route_mappings")
352+
.routesUrl("/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6/routes")
353+
.serviceBindingsUrl("/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6/service_bindings")
354+
.spaceId("93e43758-13fe-4751-8edc-caf225e27647")
355+
.spaceUrl("/v2/spaces/93e43758-13fe-4751-8edc-caf225e27647")
356+
.stackId("0459956d-e777-412d-af7e-d45f8d172edc")
357+
.stackUrl("/v2/stacks/0459956d-e777-412d-af7e-d45f8d172edc")
358+
.state("STOPPED")
359+
.version("51207851-f39e-428e-9a16-1372f4d6d4f6")
360360
.build())
361361
.build())
362362
.build())

cloudfoundry-client-reactor/src/test/resources/fixtures/client/v2/routes/GET_{id}_apps_response.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
"resources": [
77
{
88
"metadata": {
9-
"guid": "f1243da8-e613-490a-8a0e-21ef1bcce952",
10-
"url": "/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952",
11-
"created_at": "2015-11-30T23:38:56Z",
12-
"updated_at": "2015-11-30T23:38:56Z"
9+
"guid": "6141e57e-7636-480b-8f17-78c6049813f6",
10+
"url": "/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6",
11+
"created_at": "2016-06-08T16:41:28Z",
12+
"updated_at": "2016-06-08T16:41:28Z"
1313
},
1414
"entity": {
15-
"name": "name-2404",
15+
"name": "name-1412",
1616
"production": false,
17-
"space_guid": "55f1c5ea-12a5-4128-8f20-606af2a3bce1",
18-
"stack_guid": "0ef84d2a-4fdd-43ba-afbc-074a5e19ea66",
17+
"space_guid": "93e43758-13fe-4751-8edc-caf225e27647",
18+
"stack_guid": "0459956d-e777-412d-af7e-d45f8d172edc",
1919
"buildpack": null,
2020
"detected_buildpack": null,
2121
"environment_json": null,
2222
"memory": 1024,
2323
"instances": 1,
2424
"disk_quota": 1024,
2525
"state": "STOPPED",
26-
"version": "5c7c81b2-941b-48a6-b718-c57c02a5f802",
26+
"version": "51207851-f39e-428e-9a16-1372f4d6d4f6",
2727
"command": null,
2828
"console": false,
2929
"debug": null,
@@ -35,19 +35,20 @@
3535
"staging_failed_description": null,
3636
"diego": false,
3737
"docker_image": null,
38-
"package_updated_at": "2015-11-30T23:38:56Z",
38+
"package_updated_at": "2016-06-08T16:41:28Z",
3939
"detected_start_command": "",
4040
"enable_ssh": true,
4141
"docker_credentials_json": {
4242
"redacted_message": "[PRIVATE DATA HIDDEN]"
4343
},
44-
"space_url": "/v2/spaces/55f1c5ea-12a5-4128-8f20-606af2a3bce1",
45-
"stack_url": "/v2/stacks/0ef84d2a-4fdd-43ba-afbc-074a5e19ea66",
46-
"events_url": "/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952/events",
47-
"service_bindings_url": "/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952/service_bindings",
48-
"routes_url": "/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952/routes",
49-
"route_mappings_url": "/v2/apps/f1243da8-e613-490a-8a0e-21ef1bcce952/route_mappings"
44+
"ports": null,
45+
"space_url": "/v2/spaces/93e43758-13fe-4751-8edc-caf225e27647",
46+
"stack_url": "/v2/stacks/0459956d-e777-412d-af7e-d45f8d172edc",
47+
"routes_url": "/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6/routes",
48+
"events_url": "/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6/events",
49+
"service_bindings_url": "/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6/service_bindings",
50+
"route_mappings_url": "/v2/apps/6141e57e-7636-480b-8f17-78c6049813f6/route_mappings"
5051
}
5152
}
5253
]
53-
}
54+
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v2/routes/_ListRouteApplicationsRequest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.fasterxml.jackson.annotation.JsonIgnore;
2020
import org.cloudfoundry.Nullable;
21+
import org.cloudfoundry.QueryParameter;
2122
import org.cloudfoundry.client.v2.InFilterParameter;
2223
import org.cloudfoundry.client.v2.IsFilterParameter;
2324
import org.cloudfoundry.client.v2.PaginatedRequest;
@@ -31,6 +32,13 @@
3132
@Value.Immutable
3233
abstract class _ListRouteApplicationsRequest extends PaginatedRequest {
3334

35+
/**
36+
* The application id
37+
*/
38+
@Nullable
39+
@QueryParameter("app_guid")
40+
abstract String getApplicationId();
41+
3442
/**
3543
* The diego flag
3644
*/

0 commit comments

Comments
 (0)