Skip to content

Commit 92c974b

Browse files
committed
Merge branch '2.x'
2 parents 0695433 + 72a9705 commit 92c974b

File tree

17 files changed

+503
-2
lines changed

17 files changed

+503
-2
lines changed

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/applications/ReactorApplicationsV3.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
import org.cloudfoundry.client.v3.applications.GetApplicationProcessStatisticsResponse;
3535
import org.cloudfoundry.client.v3.applications.GetApplicationRequest;
3636
import org.cloudfoundry.client.v3.applications.GetApplicationResponse;
37+
import org.cloudfoundry.client.v3.applications.ListApplicationBuildsRequest;
38+
import org.cloudfoundry.client.v3.applications.ListApplicationBuildsResponse;
3739
import org.cloudfoundry.client.v3.applications.ListApplicationDropletsRequest;
3840
import org.cloudfoundry.client.v3.applications.ListApplicationDropletsResponse;
3941
import org.cloudfoundry.client.v3.applications.ListApplicationPackagesRequest;
@@ -138,6 +140,12 @@ public Mono<ListApplicationsResponse> list(ListApplicationsRequest request) {
138140
.checkpoint();
139141
}
140142

143+
@Override
144+
public Mono<ListApplicationBuildsResponse> listBuilds(ListApplicationBuildsRequest request) {
145+
return get(request, ListApplicationBuildsResponse.class, builder -> builder.pathSegment("apps", request.getApplicationId(), "builds"))
146+
.checkpoint();
147+
}
148+
141149
@Override
142150
public Mono<ListApplicationDropletsResponse> listDroplets(ListApplicationDropletsRequest request) {
143151
return get(request, ListApplicationDropletsResponse.class, builder -> builder.pathSegment("apps", request.getApplicationId(), "droplets"))

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/client/v3/builds/ReactorBuilds.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import org.cloudfoundry.client.v3.builds.CreateBuildResponse;
2222
import org.cloudfoundry.client.v3.builds.GetBuildRequest;
2323
import org.cloudfoundry.client.v3.builds.GetBuildResponse;
24+
import org.cloudfoundry.client.v3.builds.ListBuildsRequest;
25+
import org.cloudfoundry.client.v3.builds.ListBuildsResponse;
2426
import org.cloudfoundry.reactor.ConnectionContext;
2527
import org.cloudfoundry.reactor.TokenProvider;
2628
import org.cloudfoundry.reactor.client.v3.AbstractClientV3Operations;
@@ -54,4 +56,10 @@ public Mono<GetBuildResponse> get(GetBuildRequest request) {
5456
.checkpoint();
5557
}
5658

59+
@Override
60+
public Mono<ListBuildsResponse> list(ListBuildsRequest request) {
61+
return get(request, ListBuildsResponse.class, builder -> builder.pathSegment("builds"))
62+
.checkpoint();
63+
}
64+
5765
}

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

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
import org.cloudfoundry.client.v3.applications.GetApplicationProcessStatisticsResponse;
4747
import org.cloudfoundry.client.v3.applications.GetApplicationRequest;
4848
import org.cloudfoundry.client.v3.applications.GetApplicationResponse;
49+
import org.cloudfoundry.client.v3.applications.ListApplicationBuildsRequest;
50+
import org.cloudfoundry.client.v3.applications.ListApplicationBuildsResponse;
4951
import org.cloudfoundry.client.v3.applications.ListApplicationDropletsRequest;
5052
import org.cloudfoundry.client.v3.applications.ListApplicationDropletsResponse;
5153
import org.cloudfoundry.client.v3.applications.ListApplicationPackagesRequest;
@@ -69,6 +71,9 @@
6971
import org.cloudfoundry.client.v3.applications.UpdateApplicationEnvironmentVariablesResponse;
7072
import org.cloudfoundry.client.v3.applications.UpdateApplicationRequest;
7173
import org.cloudfoundry.client.v3.applications.UpdateApplicationResponse;
74+
import org.cloudfoundry.client.v3.builds.BuildResource;
75+
import org.cloudfoundry.client.v3.builds.BuildState;
76+
import org.cloudfoundry.client.v3.builds.CreatedBy;
7277
import org.cloudfoundry.client.v3.droplets.Buildpack;
7378
import org.cloudfoundry.client.v3.droplets.DropletResource;
7479
import org.cloudfoundry.client.v3.droplets.DropletState;
@@ -716,6 +721,67 @@ public void list() {
716721
.verify(Duration.ofSeconds(5));
717722
}
718723

724+
@Test
725+
public void listBuilds() {
726+
mockRequest(InteractionContext.builder()
727+
.request(TestRequest.builder()
728+
.method(GET).path("/apps/test-application-id/builds")
729+
.build())
730+
.response(TestResponse.builder()
731+
.status(OK)
732+
.payload("fixtures/client/v3/apps/GET_{id}_builds_response.json")
733+
.build())
734+
.build());
735+
736+
this.applications
737+
.listBuilds(ListApplicationBuildsRequest.builder()
738+
.applicationId("test-application-id")
739+
.build())
740+
.as(StepVerifier::create)
741+
.expectNext(ListApplicationBuildsResponse.builder()
742+
.pagination(Pagination.builder()
743+
.totalResults(1)
744+
.totalPages(1)
745+
.first(Link.builder()
746+
.href("https://api.example.org/v3/apps/test-application-id/builds?states=STAGING&page=1&per_page=2")
747+
.build())
748+
.last(Link.builder()
749+
.href("https://api.example.org/v3/apps/test-application-id/builds?states=STAGING&page=1&per_page=2")
750+
.build())
751+
.build())
752+
.resource(BuildResource.builder()
753+
.id("585bc3c1-3743-497d-88b0-403ad6b56d16")
754+
.createdAt("2016-03-28T23:39:34Z")
755+
.updatedAt("2016-06-08T16:41:26Z")
756+
.createdBy(CreatedBy.builder()
757+
.id("3cb4e243-bed4-49d5-8739-f8b45abdec1c")
758+
.name("bill")
759+
760+
.build())
761+
.state(BuildState.STAGING)
762+
.error(null)
763+
.lifecycle(Lifecycle.builder()
764+
.type(LifecycleType.BUILDPACK)
765+
.data(BuildpackData.builder()
766+
.buildpack("ruby_buildpack")
767+
.stack("cflinuxfs2")
768+
.build())
769+
.build())
770+
.inputPackage(Relationship.builder()
771+
.id("8e4da443-f255-499c-8b47-b3729b5b7432")
772+
.build())
773+
.link("self", Link.builder()
774+
.href("https://api.example.org/v3/builds/585bc3c1-3743-497d-88b0-403ad6b56d16")
775+
.build())
776+
.link("app", Link.builder()
777+
.href("https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396")
778+
.build())
779+
.build())
780+
.build())
781+
.expectComplete()
782+
.verify(Duration.ofSeconds(5));
783+
}
784+
719785
@Test
720786
public void listDroplets() {
721787
mockRequest(InteractionContext.builder()

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/builds/ReactorBuildsTest.java

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@
2020
import org.cloudfoundry.client.v3.Lifecycle;
2121
import org.cloudfoundry.client.v3.LifecycleType;
2222
import org.cloudfoundry.client.v3.Link;
23+
import org.cloudfoundry.client.v3.Pagination;
2324
import org.cloudfoundry.client.v3.Relationship;
25+
import org.cloudfoundry.client.v3.builds.BuildResource;
2426
import org.cloudfoundry.client.v3.builds.BuildState;
2527
import org.cloudfoundry.client.v3.builds.CreateBuildRequest;
2628
import org.cloudfoundry.client.v3.builds.CreateBuildResponse;
2729
import org.cloudfoundry.client.v3.builds.CreatedBy;
2830
import org.cloudfoundry.client.v3.builds.GetBuildRequest;
2931
import org.cloudfoundry.client.v3.builds.GetBuildResponse;
32+
import org.cloudfoundry.client.v3.builds.ListBuildsRequest;
33+
import org.cloudfoundry.client.v3.builds.ListBuildsResponse;
3034
import org.cloudfoundry.reactor.InteractionContext;
3135
import org.cloudfoundry.reactor.TestRequest;
3236
import org.cloudfoundry.reactor.TestResponse;
@@ -150,4 +154,64 @@ public void get() {
150154
.verify(Duration.ofSeconds(5));
151155
}
152156

157+
@Test
158+
public void list() {
159+
mockRequest(InteractionContext.builder()
160+
.request(TestRequest.builder()
161+
.method(GET).path("/builds")
162+
.build())
163+
.response(TestResponse.builder()
164+
.status(OK)
165+
.payload("fixtures/client/v3/builds/GET_response.json")
166+
.build())
167+
.build());
168+
169+
this.builds
170+
.list(ListBuildsRequest.builder()
171+
.build())
172+
.as(StepVerifier::create)
173+
.expectNext(ListBuildsResponse.builder()
174+
.pagination(Pagination.builder()
175+
.totalResults(1)
176+
.totalPages(1)
177+
.first(Link.builder()
178+
.href("https://api.example.org/v3/builds?states=STAGING&page=1&per_page=2")
179+
.build())
180+
.last(Link.builder()
181+
.href("https://api.example.org/v3/builds?states=STAGING&page=1&per_page=2")
182+
.build())
183+
.build())
184+
.resource(BuildResource.builder()
185+
.id("585bc3c1-3743-497d-88b0-403ad6b56d16")
186+
.createdAt("2016-03-28T23:39:34Z")
187+
.updatedAt("2016-06-08T16:41:26Z")
188+
.createdBy(CreatedBy.builder()
189+
.id("3cb4e243-bed4-49d5-8739-f8b45abdec1c")
190+
.name("bill")
191+
192+
.build())
193+
.state(BuildState.STAGING)
194+
.error(null)
195+
.lifecycle(Lifecycle.builder()
196+
.type(LifecycleType.BUILDPACK)
197+
.data(BuildpackData.builder()
198+
.buildpack("ruby_buildpack")
199+
.stack("cflinuxfs2")
200+
.build())
201+
.build())
202+
.inputPackage(Relationship.builder()
203+
.id("8e4da443-f255-499c-8b47-b3729b5b7432")
204+
.build())
205+
.link("self", Link.builder()
206+
.href("https://api.example.org/v3/builds/585bc3c1-3743-497d-88b0-403ad6b56d16")
207+
.build())
208+
.link("app", Link.builder()
209+
.href("https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396")
210+
.build())
211+
.build())
212+
.build())
213+
.expectComplete()
214+
.verify(Duration.ofSeconds(5));
215+
}
216+
153217
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"pagination": {
3+
"total_results": 1,
4+
"total_pages": 1,
5+
"first": {
6+
"href": "https://api.example.org/v3/apps/test-application-id/builds?states=STAGING&page=1&per_page=2"
7+
},
8+
"last": {
9+
"href": "https://api.example.org/v3/apps/test-application-id/builds?states=STAGING&page=1&per_page=2"
10+
},
11+
"next": null,
12+
"previous": null
13+
},
14+
"resources": [
15+
{
16+
"guid": "585bc3c1-3743-497d-88b0-403ad6b56d16",
17+
"created_at": "2016-03-28T23:39:34Z",
18+
"updated_at": "2016-06-08T16:41:26Z",
19+
"created_by": {
20+
"guid": "3cb4e243-bed4-49d5-8739-f8b45abdec1c",
21+
"name": "bill",
22+
"email": "[email protected]"
23+
},
24+
"state": "STAGING",
25+
"error": null,
26+
"lifecycle": {
27+
"type": "buildpack",
28+
"data": {
29+
"buildpacks": [
30+
"ruby_buildpack"
31+
],
32+
"stack": "cflinuxfs2"
33+
}
34+
},
35+
"package": {
36+
"guid": "8e4da443-f255-499c-8b47-b3729b5b7432"
37+
},
38+
"droplet": null,
39+
"links": {
40+
"self": {
41+
"href": "https://api.example.org/v3/builds/585bc3c1-3743-497d-88b0-403ad6b56d16"
42+
},
43+
"app": {
44+
"href": "https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396"
45+
}
46+
}
47+
}
48+
]
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"pagination": {
3+
"total_results": 1,
4+
"total_pages": 1,
5+
"first": {
6+
"href": "https://api.example.org/v3/builds?states=STAGING&page=1&per_page=2"
7+
},
8+
"last": {
9+
"href": "https://api.example.org/v3/builds?states=STAGING&page=1&per_page=2"
10+
},
11+
"next": null,
12+
"previous": null
13+
},
14+
"resources": [
15+
{
16+
"guid": "585bc3c1-3743-497d-88b0-403ad6b56d16",
17+
"created_at": "2016-03-28T23:39:34Z",
18+
"updated_at": "2016-06-08T16:41:26Z",
19+
"created_by": {
20+
"guid": "3cb4e243-bed4-49d5-8739-f8b45abdec1c",
21+
"name": "bill",
22+
"email": "[email protected]"
23+
},
24+
"state": "STAGING",
25+
"error": null,
26+
"lifecycle": {
27+
"type": "buildpack",
28+
"data": {
29+
"buildpacks": [
30+
"ruby_buildpack"
31+
],
32+
"stack": "cflinuxfs2"
33+
}
34+
},
35+
"package": {
36+
"guid": "8e4da443-f255-499c-8b47-b3729b5b7432"
37+
},
38+
"droplet": null,
39+
"links": {
40+
"self": {
41+
"href": "https://api.example.org/v3/builds/585bc3c1-3743-497d-88b0-403ad6b56d16"
42+
},
43+
"app": {
44+
"href": "https://api.example.org/v3/apps/7b34f1cf-7e73-428a-bb5a-8a17a8058396"
45+
}
46+
}
47+
}
48+
]
49+
}

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/applications/Application.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.cloudfoundry.Nullable;
2121
import org.cloudfoundry.client.v3.Lifecycle;
2222
import org.cloudfoundry.client.v3.Resource;
23-
import org.cloudfoundry.client.v3.spaces.SpaceRelationships;
2423

2524
/**
2625
* Base class for responses that are applications

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/applications/ApplicationsV3.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ public interface ApplicationsV3 {
103103
*/
104104
Mono<ListApplicationsResponse> list(ListApplicationsRequest request);
105105

106+
/**
107+
* Makes the <a href="http://v3-apidocs.cloudfoundry.org/version/3.47.0/#list-builds-for-an-app">List Application Builds</a> request
108+
*
109+
* @param request the List Application Builds request
110+
* @return the response from the List Application Builds request
111+
*/
112+
Mono<ListApplicationBuildsResponse> listBuilds(ListApplicationBuildsRequest request);
113+
106114
/**
107115
* Makes the <a href="http://v3-apidocs.cloudfoundry.org/version/3.27.0/index.html#list-droplets-for-an-app">List Application Droplets</a> request
108116
*
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2013-2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.cloudfoundry.client.v3.applications;
18+
19+
import com.fasterxml.jackson.annotation.JsonIgnore;
20+
import org.cloudfoundry.client.v3.FilterParameter;
21+
import org.cloudfoundry.client.v3.PaginatedRequest;
22+
import org.immutables.value.Value;
23+
24+
import java.util.List;
25+
26+
/**
27+
* The request payload for the List Application Builds operation
28+
*/
29+
@Value.Immutable
30+
abstract class _ListApplicationBuildsRequest extends PaginatedRequest {
31+
32+
/**
33+
* The application id
34+
*/
35+
@JsonIgnore
36+
abstract String getApplicationId();
37+
38+
/**
39+
* The build states
40+
*/
41+
@FilterParameter("states")
42+
abstract List<String> getStates();
43+
44+
}

0 commit comments

Comments
 (0)