Skip to content

Commit b93dc2d

Browse files
arghya88twoseat
authored andcommitted
Adds space_guid, organization_guid as parameter to the list events operation
1 parent 751456b commit b93dc2d

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v2/events/_ListEventsRequest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ abstract class _ListEventsRequest extends PaginatedRequest {
3636
@Nullable
3737
abstract List<String> getActees();
3838

39+
/**
40+
* The organization id
41+
*/
42+
@FilterParameter("organization_guid")
43+
@Nullable
44+
abstract List<String> getOrganizationId();
45+
46+
/**
47+
* The space id
48+
*/
49+
@FilterParameter("space_guid")
50+
@Nullable
51+
abstract List<String> getSpaceId();
52+
3953
/**
4054
* The timestamps
4155
*/

integration-test/src/test/java/org/cloudfoundry/client/v2/EventsTest.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,42 @@ public void listFilterByType() {
125125
.verify(Duration.ofMinutes(5));
126126
}
127127

128+
@Test
129+
public void listFilterByOrganizationId(){
130+
getFirstEvent(this.cloudFoundryClient)
131+
.flatMap(resource -> Mono.zip(
132+
Mono.just(resource),
133+
this.cloudFoundryClient.events()
134+
.list(ListEventsRequest.builder()
135+
.spaceId(ResourceUtils.getEntity(resource).getOrganizationId())
136+
.build())
137+
.flatMapMany(ResourceUtils::getResources)
138+
.next()
139+
))
140+
.as(StepVerifier::create)
141+
.consumeNextWith(tupleEquality())
142+
.expectComplete()
143+
.verify(Duration.ofMinutes(5));
144+
}
145+
146+
@Test
147+
public void listFilterBySpaceId() {
148+
getFirstEvent(this.cloudFoundryClient)
149+
.flatMap(resource -> Mono.zip(
150+
Mono.just(resource),
151+
this.cloudFoundryClient.events()
152+
.list(ListEventsRequest.builder()
153+
.spaceId(ResourceUtils.getEntity(resource).getSpaceId())
154+
.build())
155+
.flatMapMany(ResourceUtils::getResources)
156+
.next()
157+
))
158+
.as(StepVerifier::create)
159+
.consumeNextWith(tupleEquality())
160+
.expectComplete()
161+
.verify(Duration.ofMinutes(5));
162+
}
163+
128164
private static Mono<EventResource> getFirstEvent(CloudFoundryClient cloudFoundryClient) {
129165
return listEvents(cloudFoundryClient)
130166
.next();

0 commit comments

Comments
 (0)