Skip to content

Commit 197c8f4

Browse files
authored
Merge pull request #1270 from Extensive-IT/fix/add-upload-droplet-states
Add the AWAITING_UPLOAD and PROCESSING_UPLOAD state for the Droplet Resource.
2 parents 0867bfb + 883034d commit 197c8f4

File tree

3 files changed

+97
-3
lines changed

3 files changed

+97
-3
lines changed

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/droplets/ReactorDropletsTest.java

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,53 @@ void list() {
339339
.resource(
340340
DropletResource.builder()
341341
.id("fdf3851c-def8-4de1-87f1-6d4543189e22")
342-
.state(DropletState.STAGED)
342+
.state(DropletState.PROCESSING_UPLOAD)
343+
.error(null)
344+
.lifecycle(
345+
Lifecycle.builder()
346+
.type(LifecycleType.DOCKER)
347+
.data(DockerData.builder().build())
348+
.build())
349+
.executionMetadata("[PRIVATE DATA HIDDEN IN LISTS]")
350+
.processType(
351+
"redacted_message",
352+
"[PRIVATE DATA HIDDEN IN LISTS]")
353+
.image(
354+
"cloudfoundry/diego-docker-app-custom:latest")
355+
.checksum(null)
356+
.stack(null)
357+
.createdAt("2016-03-17T00:00:01Z")
358+
.updatedAt("2016-03-17T21:41:32Z")
359+
.link(
360+
"self",
361+
Link.builder()
362+
.href(
363+
"https://api.example.org/v3/droplets/fdf3851c-def8-4de1-87f1-6d4543189e22")
364+
.build())
365+
.link(
366+
"package",
367+
Link.builder()
368+
.href(
369+
"https://api.example.org/v3/packages/c5725684-a02f-4e59-bc67-8f36ae944688")
370+
.build())
371+
.link(
372+
"app",
373+
Link.builder()
374+
.href(
375+
"https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396")
376+
.build())
377+
.link(
378+
"assign_current_droplet",
379+
Link.builder()
380+
.href(
381+
"https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396/relationships/current_droplet")
382+
.method("PATCH")
383+
.build())
384+
.build())
385+
.resource(
386+
DropletResource.builder()
387+
.id("fdf3851c-def8-4de1-87f1-6d4543189e23")
388+
.state(DropletState.AWAITING_UPLOAD)
343389
.error(null)
344390
.lifecycle(
345391
Lifecycle.builder()

cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/droplets/GET_response.json

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,41 @@
5656
},
5757
{
5858
"guid": "fdf3851c-def8-4de1-87f1-6d4543189e22",
59-
"state": "STAGED",
59+
"state": "PROCESSING_UPLOAD",
60+
"error": null,
61+
"lifecycle": {
62+
"type": "docker",
63+
"data": {}
64+
},
65+
"execution_metadata": "[PRIVATE DATA HIDDEN IN LISTS]",
66+
"process_types": {
67+
"redacted_message": "[PRIVATE DATA HIDDEN IN LISTS]"
68+
},
69+
"image": "cloudfoundry/diego-docker-app-custom:latest",
70+
"checksum": null,
71+
"buildpacks": null,
72+
"stack": null,
73+
"created_at": "2016-03-17T00:00:01Z",
74+
"updated_at": "2016-03-17T21:41:32Z",
75+
"links": {
76+
"self": {
77+
"href": "https://api.example.org/v3/droplets/fdf3851c-def8-4de1-87f1-6d4543189e22"
78+
},
79+
"package": {
80+
"href": "https://api.example.org/v3/packages/c5725684-a02f-4e59-bc67-8f36ae944688"
81+
},
82+
"app": {
83+
"href": "https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396"
84+
},
85+
"assign_current_droplet": {
86+
"href": "https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396/relationships/current_droplet",
87+
"method": "PATCH"
88+
}
89+
}
90+
},
91+
{
92+
"guid": "fdf3851c-def8-4de1-87f1-6d4543189e23",
93+
"state": "AWAITING_UPLOAD",
6094
"error": null,
6195
"lifecycle": {
6296
"type": "docker",

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/droplets/DropletState.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,17 @@ public enum DropletState {
4343
/**
4444
* The staged state
4545
*/
46-
STAGED("STAGED");
46+
STAGED("STAGED"),
47+
48+
/**
49+
* The awaiting upload state
50+
*/
51+
AWAITING_UPLOAD("AWAITING_UPLOAD"),
52+
53+
/**
54+
* The processing upload state
55+
*/
56+
PROCESSING_UPLOAD("PROCESSING_UPLOAD");
4757

4858
private final String value;
4959

@@ -62,6 +72,10 @@ public static DropletState from(String s) {
6272
return FAILED;
6373
case "staged":
6474
return STAGED;
75+
case "awaiting_upload":
76+
return AWAITING_UPLOAD;
77+
case "processing_upload":
78+
return PROCESSING_UPLOAD;
6579
default:
6680
throw new IllegalArgumentException(String.format("Unknown droplet state: %s", s));
6781
}

0 commit comments

Comments
 (0)