Skip to content

Commit 1033a9d

Browse files
committed
Merge branch '966-metadata'
2 parents caa1cb8 + a7e0a59 commit 1033a9d

File tree

22 files changed

+405
-9
lines changed

22 files changed

+405
-9
lines changed

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/serviceinstances/ReactorServiceInstancesV3.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import org.cloudfoundry.client.v3.serviceInstances.ShareServiceInstanceRequest;
2525
import org.cloudfoundry.client.v3.serviceInstances.ShareServiceInstanceResponse;
2626
import org.cloudfoundry.client.v3.serviceInstances.UnshareServiceInstanceRequest;
27+
import org.cloudfoundry.client.v3.serviceInstances.UpdateServiceInstanceRequest;
28+
import org.cloudfoundry.client.v3.serviceInstances.UpdateServiceInstanceResponse;
2729
import org.cloudfoundry.reactor.ConnectionContext;
2830
import org.cloudfoundry.reactor.TokenProvider;
2931
import org.cloudfoundry.reactor.client.v3.AbstractClientV3Operations;
@@ -69,4 +71,8 @@ public Mono<Void> unshare(UnshareServiceInstanceRequest request) {
6971
.checkpoint();
7072
}
7173

74+
@Override
75+
public Mono<UpdateServiceInstanceResponse> update(UpdateServiceInstanceRequest request) {
76+
return patch(request, UpdateServiceInstanceResponse.class, builder -> builder.pathSegment("service_instances", request.getServiceInstanceId()));
77+
}
7278
}

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/applications/ReactorApplicationsV3Test.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.cloudfoundry.client.v3.Lifecycle;
2424
import org.cloudfoundry.client.v3.LifecycleType;
2525
import org.cloudfoundry.client.v3.Link;
26+
import org.cloudfoundry.client.v3.Metadata;
2627
import org.cloudfoundry.client.v3.Pagination;
2728
import org.cloudfoundry.client.v3.Relationship;
2829
import org.cloudfoundry.client.v3.ToOneRelationship;
@@ -141,6 +142,10 @@ public void create() {
141142
.build())
142143
.build())
143144
.build())
145+
.metadata(Metadata.builder()
146+
.annotation("version", "1.2.3")
147+
.label("isLive", "true")
148+
.build())
144149
.build())
145150
.as(StepVerifier::create)
146151
.expectNext(CreateApplicationResponse.builder()
@@ -163,6 +168,10 @@ public void create() {
163168
.build())
164169
.build())
165170
.build())
171+
.metadata(Metadata.builder()
172+
.annotation("version", "1.2.3")
173+
.label("isLive", "true")
174+
.build())
166175
.link("self", Link.builder()
167176
.href("https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446")
168177
.build())
@@ -262,6 +271,11 @@ public void get() {
262271
.build())
263272
.build())
264273
.build())
274+
.metadata(Metadata.builder()
275+
.annotation("version", "1.2.4")
276+
.label("isLive", "false")
277+
.label("maintenance", "true")
278+
.build())
265279
.link("self", Link.builder()
266280
.href("https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446")
267281
.build())
@@ -624,6 +638,10 @@ public void list() {
624638
.build())
625639
.build())
626640
.build())
641+
.metadata(Metadata.builder()
642+
.annotation("version", "1.2.3")
643+
.label("isLive", "true")
644+
.build())
627645
.link("self", Link.builder()
628646
.href("https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446")
629647
.build())
@@ -1428,6 +1446,11 @@ public void update() {
14281446
.buildpack("java_buildpack")
14291447
.build())
14301448
.build())
1449+
.metadata(Metadata.builder()
1450+
.annotation("version", "1.2.4")
1451+
.label("isLive", "false")
1452+
.label("maintenance", "true")
1453+
.build())
14311454
.build())
14321455
.as(StepVerifier::create)
14331456
.expectNext(UpdateApplicationResponse.builder()
@@ -1450,6 +1473,11 @@ public void update() {
14501473
.build())
14511474
.build())
14521475
.build())
1476+
.metadata(Metadata.builder()
1477+
.annotation("version", "1.2.4")
1478+
.label("isLive", "false")
1479+
.label("maintenance", "true")
1480+
.build())
14531481
.link("self", Link.builder()
14541482
.href("https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446")
14551483
.build())

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/serviceInstances/ReactorServiceInstancesV3Test.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.cloudfoundry.reactor.client.v3.serviceInstances;
1818

1919
import org.cloudfoundry.client.v3.Link;
20+
import org.cloudfoundry.client.v3.Metadata;
2021
import org.cloudfoundry.client.v3.Pagination;
2122
import org.cloudfoundry.client.v3.Relationship;
2223
import org.cloudfoundry.client.v3.ToOneRelationship;
@@ -29,6 +30,8 @@
2930
import org.cloudfoundry.client.v3.serviceInstances.ShareServiceInstanceRequest;
3031
import org.cloudfoundry.client.v3.serviceInstances.ShareServiceInstanceResponse;
3132
import org.cloudfoundry.client.v3.serviceInstances.UnshareServiceInstanceRequest;
33+
import org.cloudfoundry.client.v3.serviceInstances.UpdateServiceInstanceRequest;
34+
import org.cloudfoundry.client.v3.serviceInstances.UpdateServiceInstanceResponse;
3235
import org.cloudfoundry.reactor.InteractionContext;
3336
import org.cloudfoundry.reactor.TestRequest;
3437
import org.cloudfoundry.reactor.TestResponse;
@@ -41,6 +44,7 @@
4144

4245
import static io.netty.handler.codec.http.HttpMethod.DELETE;
4346
import static io.netty.handler.codec.http.HttpMethod.GET;
47+
import static io.netty.handler.codec.http.HttpMethod.PATCH;
4448
import static io.netty.handler.codec.http.HttpMethod.POST;
4549
import static io.netty.handler.codec.http.HttpResponseStatus.CREATED;
4650
import static io.netty.handler.codec.http.HttpResponseStatus.NO_CONTENT;
@@ -224,4 +228,50 @@ public void unshare() {
224228
.expectComplete()
225229
.verify(Duration.ofSeconds(5));
226230
}
231+
232+
@Test
233+
public void update() {
234+
mockRequest(InteractionContext.builder()
235+
.request(TestRequest.builder()
236+
.method(PATCH).path("/service_instances/68d54d31-9b3a-463b-ba94-e8e4c32edbac")
237+
.payload("fixtures/client/v3/serviceinstances/PATCH_request.json")
238+
.build())
239+
.response(TestResponse.builder()
240+
.status(OK)
241+
.payload("fixtures/client/v3/serviceinstances/PATCH_response.json")
242+
.build())
243+
.build());
244+
245+
this.serviceInstances
246+
.update(UpdateServiceInstanceRequest.builder()
247+
.serviceInstanceId("68d54d31-9b3a-463b-ba94-e8e4c32edbac")
248+
.metadata(Metadata.builder()
249+
.annotation("note", "detailed information")
250+
.label("key", "value")
251+
.build())
252+
.build())
253+
.as(StepVerifier::create)
254+
.expectNext(UpdateServiceInstanceResponse.builder()
255+
.createdAt("2017-11-17T13:54:21Z")
256+
.id("85ccdcad-d725-4109-bca4-fd6ba062b5c8")
257+
.link("space", Link.builder()
258+
.href("https://api.example.org/v3/spaces/ae0031f9-dd49-461c-a945-df40e77c39cb")
259+
.build())
260+
.metadata(Metadata.builder()
261+
.annotation("note", "detailed information")
262+
.label("key", "value")
263+
.build())
264+
.name("my_service_instance")
265+
.relationships(ServiceInstanceRelationships.builder()
266+
.space(ToOneRelationship.builder()
267+
.data(Relationship.builder()
268+
.id("ae0031f9-dd49-461c-a945-df40e77c39cb")
269+
.build())
270+
.build())
271+
.build())
272+
.updatedAt("2017-11-17T13:54:21Z")
273+
.build())
274+
.expectComplete()
275+
.verify(Duration.ofSeconds(5));
276+
}
227277
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
}
3737
}
3838
},
39+
"metadata": {
40+
"labels": {
41+
"isLive": true
42+
},
43+
"annotations": {
44+
"version": "1.2.3"
45+
}
46+
},
3947
"links": {
4048
"self": {
4149
"href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446"

cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/apps/GET_{id}_response.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
}
2121
}
2222
},
23+
"metadata": {
24+
"labels": {
25+
"isLive": "false",
26+
"maintenance": "true"
27+
},
28+
"annotations": {
29+
"version": "1.2.4"
30+
}
31+
},
2332
"links": {
2433
"self": {
2534
"href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446"

cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/apps/PATCH_{id}_request.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,14 @@
77
"java_buildpack"
88
]
99
}
10+
},
11+
"metadata": {
12+
"labels": {
13+
"isLive": "false",
14+
"maintenance": "true"
15+
},
16+
"annotations": {
17+
"version": "1.2.4"
18+
}
1019
}
1120
}

cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/apps/PATCH_{id}_response.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
}
2121
}
2222
},
23+
"metadata": {
24+
"labels": {
25+
"isLive": "false",
26+
"maintenance": "true"
27+
},
28+
"annotations": {
29+
"version": "1.2.4"
30+
}
31+
},
2332
"links": {
2433
"self": {
2534
"href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446"
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
{
2-
"name": "my_app",
3-
"relationships": {
4-
"space": {
5-
"data": {
6-
"guid": "2f35885d-0c9d-4423-83ad-fd05066f8576"
7-
}
8-
}
9-
}
2+
"name": "my_app",
3+
"relationships": {
4+
"space": {
5+
"data": {
6+
"guid": "2f35885d-0c9d-4423-83ad-fd05066f8576"
7+
}
8+
}
9+
},
10+
"metadata": {
11+
"labels": {
12+
"isLive": "true"
13+
},
14+
"annotations": {
15+
"version": "1.2.3"
16+
}
17+
}
1018
}

cloudfoundry-client-reactor/src/test/resources/fixtures/client/v3/apps/POST_response.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
}
1919
}
2020
},
21+
"metadata": {
22+
"labels": {
23+
"isLive": true
24+
},
25+
"annotations": {
26+
"version": "1.2.3"
27+
}
28+
},
2129
"links": {
2230
"self": {
2331
"href": "https://api.example.org/v3/apps/1cb006ee-fb05-47e1-b541-c34179ddc446"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"metadata": {
3+
"labels": {
4+
"key": "value"
5+
},
6+
"annotations": {
7+
"note": "detailed information"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)