Skip to content
Permalink
Browse files
add show nested stack to list stacks
  • Loading branch information
lbortman authored and nacx committed Feb 4, 2016
1 parent 75c270e commit 3b490162a5c295e532ddbcf76e68a641c75566d3
Showing 5 changed files with 31 additions and 6 deletions.
@@ -160,8 +160,8 @@ public ListStackOptions name(String name) {
/**
* Return all the stack of all the tenant
*/
public ListStackOptions globalTenant(Boolean globalTenant) {
this.queryParameters.put("global_tenant", globalTenant != null ? Boolean.toString(globalTenant) : "false");
public ListStackOptions globalTenant(boolean globalTenant) {
this.queryParameters.put("global_tenant", Boolean.toString(globalTenant));
return this;
}

@@ -184,6 +184,14 @@ public ListStackOptions sortDirection(SortDirection direction) {
return this;
}

/**
* Include nested stacks in the stack listing.
*/
public ListStackOptions showNested(boolean showNested) {
this.queryParameters.put("show_nested", Boolean.toString(showNested));
return this;
}

public static Builder builder() {
return new Builder();
}
@@ -233,11 +241,18 @@ public static ListStackOptions sortDirection(SortDirection direction) {
}

/**
* @see ListStackOptions#globalTenant(Boolean
* @see ListStackOptions#globalTenant(boolean)
*/
public static ListStackOptions globalTenant(Boolean globalTenant) {
public static ListStackOptions globalTenant(boolean globalTenant) {
return new ListStackOptions().globalTenant(globalTenant);
}

/**
* @see ListStackOptions#showNested(boolean)
*/
public static ListStackOptions showNested(boolean showNested) {
return new ListStackOptions().showNested(showNested);
}
}

}
@@ -204,7 +204,7 @@ public void testListWithOptions() throws Exception {
HeatApi heatApi = api(server.getUrl("/").toString(), "openstack-heat", overrides);
StackApi api = heatApi.getStackApi("RegionOne");

ListStackOptions options = ListStackOptions.Builder.name("simple_stack");
ListStackOptions options = ListStackOptions.Builder.name("simple_stack").showNested(true).globalTenant(true);

List<Stack> stacks = api.list(options);

@@ -213,7 +213,7 @@ public void testListWithOptions() throws Exception {
*/
assertThat(server.getRequestCount()).isEqualTo(2);
assertAuthentication(server);
assertRequest(server.takeRequest(), "GET", BASE_URI + "/stacks?name=simple_stack");
assertRequest(server.takeRequest(), "GET", BASE_URI + "/stacks?name=simple_stack&show_nested=true&global_tenant=true");

/*
* Check response
@@ -24,6 +24,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.jclouds.openstack.heat.v1.options.ListStackOptions.Builder.globalTenant;
import static org.jclouds.openstack.heat.v1.options.ListStackOptions.Builder.showNested;
import static org.jclouds.openstack.heat.v1.options.ListStackOptions.Builder.limit;
import static org.jclouds.openstack.heat.v1.options.ListStackOptions.Builder.marker;
import static org.jclouds.openstack.heat.v1.options.ListStackOptions.Builder.name;
@@ -106,4 +107,11 @@ public void testGlobalTenant() {
assertThat(options.buildQueryParameters().get("global_tenant"))
.isEqualTo(ImmutableSet.of("true"));
}

public void testShowNested() {
ListStackOptions options = showNested(true);
assertThat(options.buildQueryParameters().get("show_nested"))
.isEqualTo(ImmutableSet.of("true"));
}

}
@@ -1,5 +1,6 @@
{
"stack": {
"parent": null,
"capabilities": [],
"creation_time": "2014-06-03T20:59:46Z",
"description": "sample stack",
@@ -1,6 +1,7 @@
{
"stacks": [
{
"parent": null,
"creation_time": "2014-06-03T20:59:46Z",
"description": "sample stack",
"id": "3095aefc-09fb-4bc7-b1f0-f21a304e864c",

0 comments on commit 3b49016

Please sign in to comment.