AMBARI-20970. Integrate StackService resource with swagger (Balazs Bence Sari via adoroszlai)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/54983ee3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/54983ee3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/54983ee3 Branch: refs/heads/trunk Commit: 54983ee3b8980e3f1e35a7859d4e759eb17fac87 Parents: 0e13b01 Author: Balazs Bence Sari <[email protected]> Authored: Wed May 10 17:14:08 2017 +0200 Committer: Attila Doroszlai <[email protected]> Committed: Wed May 10 17:14:08 2017 +0200 ---------------------------------------------------------------------- .../ambari/server/api/services/BaseService.java | 25 +- .../ambari/server/api/services/HostService.java | 96 +-- .../server/api/services/StacksService.java | 730 ++++++++++++++++--- .../server/api/services/users/UserService.java | 2 +- .../api/services/views/ViewInstanceService.java | 2 +- .../controller/ComponentDependencyResponse.java | 64 ++ .../controller/ExtensionLinkResponse.java | 137 ++-- .../server/controller/QuickLinksResponse.java | 56 ++ .../controller/StackArtifactResponse.java | 52 ++ .../StackConfigurationDependencyResponse.java | 17 + .../controller/StackConfigurationResponse.java | 26 +- .../ambari/server/controller/StackResponse.java | 12 + .../StackServiceArtifactResponse.java | 53 ++ .../StackServiceComponentResponse.java | 27 + .../server/controller/StackServiceResponse.java | 31 +- .../server/controller/StackVersionResponse.java | 59 +- .../ambari/server/controller/ThemeResponse.java | 56 ++ .../server/controller/ViewInstanceResponse.java | 2 +- .../state/QuickLinksConfigurationInfo.java | 8 +- .../apache/ambari/server/state/StackInfo.java | 2 +- .../server/state/ValueAttributesInfo.java | 87 ++- .../ambari/server/state/ValueEntryInfo.java | 8 +- .../server/state/theme/ConfigCondition.java | 13 +- .../server/state/theme/ConfigPlacement.java | 25 +- .../ambari/server/state/theme/Layout.java | 5 + .../ambari/server/state/theme/Section.java | 22 +- .../ambari/server/state/theme/Subsection.java | 13 +- .../apache/ambari/server/state/theme/Tab.java | 12 +- .../ambari/server/state/theme/TabLayout.java | 8 +- .../apache/ambari/server/state/theme/Theme.java | 9 +- .../server/state/theme/ThemeConfiguration.java | 10 +- .../apache/ambari/server/state/theme/Unit.java | 7 +- .../ambari/server/state/theme/Widget.java | 12 +- .../ambari/server/state/theme/WidgetEntry.java | 9 +- 34 files changed, 1397 insertions(+), 300 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/54983ee3/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java index 76d2b70..0b2afd1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java @@ -49,14 +49,15 @@ import org.slf4j.LoggerFactory; public abstract class BaseService { public final static MediaType MEDIA_TYPE_TEXT_CSV_TYPE = new MediaType("text", "csv"); - static final String SUCCESSFUL_OPERATION = "Successful operation"; - static final String REQUEST_ACCEPTED = "Request is accepted, but not completely processed yet"; - static final String INVALID_ARGUMENTS = "Invalid arguments"; - static final String CLUSTER_NOT_FOUND = "Cluster not found"; - static final String CLUSTER_OR_HOST_NOT_FOUND = "Cluster or host not found"; - static final String NOT_AUTHENTICATED = "Not authenticated"; - static final String PERMISSION_DENIED = "Not permitted to perform the operation"; - static final String SERVER_ERROR = "Internal server error"; + static final String MSG_SUCCESSFUL_OPERATION = "Successful operation"; + static final String MSG_REQUEST_ACCEPTED = "Request is accepted, but not completely processed yet"; + static final String MSG_INVALID_ARGUMENTS = "Invalid arguments"; + static final String MSG_CLUSTER_NOT_FOUND = "Cluster not found"; + static final String MSG_CLUSTER_OR_HOST_NOT_FOUND = "Cluster or host not found"; + static final String MSG_NOT_AUTHENTICATED = "Not authenticated"; + static final String MSG_PERMISSION_DENIED = "Not permitted to perform the operation"; + static final String MSG_SERVER_ERROR = "Internal server error"; + static final String MSG_RESOURCE_NOT_FOUND = "The requested resource doesn't exist."; static final String QUERY_FIELDS = "fields"; static final String QUERY_FILTER_DESCRIPTION = "Filter fields in the response (identifier fields are mandatory)"; @@ -67,7 +68,6 @@ public abstract class BaseService { static final String DEFAULT_PAGE_SIZE = "10"; static final String QUERY_FROM = "from"; static final String QUERY_FROM_DESCRIPTION = "The starting page resource (inclusive). \"start\" is also accepted."; - static final String QUERY_FROM_TYPE = "integer"; static final String QUERY_FROM_VALUES = "range[0, infinity]"; static final String DEFAULT_FROM = "0"; static final String QUERY_TO = "to"; @@ -75,6 +75,13 @@ public abstract class BaseService { static final String QUERY_TO_TYPE = "integer"; static final String QUERY_TO_VALUES = "range[1, infinity]"; + static final String RESPONSE_CONTAINER_LIST = "List"; + + static final String DATA_TYPE_INT = "integer"; + static final String DATA_TYPE_STRING = "string"; + + static final String PARAM_TYPE_QUERY = "query"; + /** * Logger instance. */ http://git-wip-us.apache.org/repos/asf/ambari/blob/54983ee3/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java index 7b5f9cf..e50d70f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostService.java @@ -95,11 +95,11 @@ public class HostService extends BaseService { @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = "string", paramType = "query"), }) @ApiResponses({ - @ApiResponse(code = HttpStatus.SC_OK, message = SUCCESSFUL_OPERATION), - @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = CLUSTER_OR_HOST_NOT_FOUND), - @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = NOT_AUTHENTICATED), - @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = PERMISSION_DENIED), - @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = SERVER_ERROR), + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_CLUSTER_OR_HOST_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED), + @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR), }) public Response getHost(String body, @Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "host name", required = true) @PathParam("hostName") String hostName @@ -123,15 +123,15 @@ public class HostService extends BaseService { @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, defaultValue = "Hosts/*", dataType = "string", paramType = "query"), @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION, defaultValue = "Hosts/host_name.asc", dataType = "string", paramType = "query"), @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = "integer", paramType = "query"), - @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, allowableValues = QUERY_FROM_VALUES, defaultValue = DEFAULT_FROM, dataType = QUERY_FROM_TYPE, paramType = "query"), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, allowableValues = QUERY_FROM_VALUES, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_INT, paramType = "query"), @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, allowableValues = QUERY_TO_VALUES, dataType = QUERY_TO_TYPE, paramType = "query"), }) @ApiResponses({ - @ApiResponse(code = HttpStatus.SC_OK, message = SUCCESSFUL_OPERATION), - @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = CLUSTER_NOT_FOUND), - @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = NOT_AUTHENTICATED), - @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = PERMISSION_DENIED), - @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = SERVER_ERROR), + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_CLUSTER_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED), + @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR), }) public Response getHosts(String body, @Context HttpHeaders headers, @Context UriInfo ui) { return handleRequest(headers, body, ui, Request.Type.GET, @@ -156,14 +156,14 @@ public class HostService extends BaseService { @ApiImplicitParam(dataType = HOST_REQUEST_TYPE, paramType = "body", allowMultiple = true) }) @ApiResponses({ - @ApiResponse(code = HttpStatus.SC_CREATED, message = SUCCESSFUL_OPERATION), - @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = REQUEST_ACCEPTED), + @ApiResponse(code = HttpStatus.SC_CREATED, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED), @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = UNKNOWN_HOSTS), - @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = CLUSTER_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_CLUSTER_NOT_FOUND), @ApiResponse(code = HttpStatus.SC_CONFLICT, message = HOST_ALREADY_EXISTS), - @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = NOT_AUTHENTICATED), - @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = PERMISSION_DENIED), - @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = SERVER_ERROR), + @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED), + @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR), }) public Response createHosts(String body, @Context HttpHeaders headers, @Context UriInfo ui) { return handleRequest(headers, body, ui, Request.Type.POST, @@ -189,14 +189,14 @@ public class HostService extends BaseService { @ApiImplicitParam(dataType = HOST_REQUEST_TYPE, paramType = "body") }) @ApiResponses({ - @ApiResponse(code = HttpStatus.SC_CREATED, message = SUCCESSFUL_OPERATION), - @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = REQUEST_ACCEPTED), - @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = INVALID_ARGUMENTS), - @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = CLUSTER_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_CREATED, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED), + @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = MSG_INVALID_ARGUMENTS), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_CLUSTER_NOT_FOUND), @ApiResponse(code = HttpStatus.SC_CONFLICT, message = HOST_ALREADY_EXISTS), - @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = NOT_AUTHENTICATED), - @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = PERMISSION_DENIED), - @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = SERVER_ERROR), + @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED), + @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR), }) public Response createHost(String body, @Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "host name", required = true) @PathParam("hostName") String hostName @@ -224,13 +224,13 @@ public class HostService extends BaseService { @ApiImplicitParam(dataType = HOST_REQUEST_TYPE, paramType = "body") }) @ApiResponses({ - @ApiResponse(code = HttpStatus.SC_OK, message = SUCCESSFUL_OPERATION), - @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = REQUEST_ACCEPTED), - @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = INVALID_ARGUMENTS), - @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = CLUSTER_OR_HOST_NOT_FOUND), - @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = NOT_AUTHENTICATED), - @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = PERMISSION_DENIED), - @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = SERVER_ERROR), + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED), + @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = MSG_INVALID_ARGUMENTS), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_CLUSTER_OR_HOST_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED), + @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR), }) public Response updateHost(String body, @Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "host name", required = true) @PathParam("hostName") String hostName @@ -256,13 +256,13 @@ public class HostService extends BaseService { @ApiImplicitParam(dataType = HOST_REQUEST_TYPE, paramType = "body", allowMultiple = true) }) @ApiResponses({ - @ApiResponse(code = HttpStatus.SC_OK, message = SUCCESSFUL_OPERATION), - @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = REQUEST_ACCEPTED), - @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = INVALID_ARGUMENTS), - @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = CLUSTER_OR_HOST_NOT_FOUND), - @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = NOT_AUTHENTICATED), - @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = PERMISSION_DENIED), - @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = SERVER_ERROR), + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED), + @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = MSG_INVALID_ARGUMENTS), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_CLUSTER_OR_HOST_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED), + @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR), }) public Response updateHosts(String body, @Context HttpHeaders headers, @Context UriInfo ui) { return handleRequest(headers, body, ui, Request.Type.PUT, @@ -284,11 +284,11 @@ public class HostService extends BaseService { @Produces("text/plain") @ApiOperation(value = "Deletes a host") @ApiResponses({ - @ApiResponse(code = HttpStatus.SC_OK, message = SUCCESSFUL_OPERATION), - @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = CLUSTER_OR_HOST_NOT_FOUND), - @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = NOT_AUTHENTICATED), - @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = PERMISSION_DENIED), - @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = SERVER_ERROR), + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_CLUSTER_OR_HOST_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED), + @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR), }) public Response deleteHost(@Context HttpHeaders headers, @Context UriInfo ui, @ApiParam(value = "host name", required = true) @PathParam("hostName") String hostName @@ -304,11 +304,11 @@ public class HostService extends BaseService { @ApiImplicitParam(dataType = HOST_REQUEST_TYPE, paramType = "body", allowMultiple = true) }) @ApiResponses({ - @ApiResponse(code = HttpStatus.SC_OK, message = SUCCESSFUL_OPERATION), - @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = CLUSTER_OR_HOST_NOT_FOUND), - @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = NOT_AUTHENTICATED), - @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = PERMISSION_DENIED), - @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = SERVER_ERROR), + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_CLUSTER_OR_HOST_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED), + @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR), }) public Response deleteHosts(String body, @Context HttpHeaders headers, @Context UriInfo ui) { return handleRequest(headers, body, ui, Request.Type.DELETE, http://git-wip-us.apache.org/repos/asf/ambari/blob/54983ee3/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java index 86bacf1..465cacd 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java @@ -28,32 +28,79 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import org.apache.ambari.server.api.resources.ResourceInstance; +import org.apache.ambari.server.controller.ComponentDependencyResponse; +import org.apache.ambari.server.controller.ExtensionLinkResponse; +import org.apache.ambari.server.controller.QuickLinksResponse; +import org.apache.ambari.server.controller.StackArtifactResponse; +import org.apache.ambari.server.controller.StackConfigurationDependencyResponse; +import org.apache.ambari.server.controller.StackConfigurationResponse; +import org.apache.ambari.server.controller.StackResponse; +import org.apache.ambari.server.controller.StackServiceArtifactResponse; +import org.apache.ambari.server.controller.StackServiceComponentResponse; +import org.apache.ambari.server.controller.StackServiceResponse; +import org.apache.ambari.server.controller.StackVersionResponse; +import org.apache.ambari.server.controller.ThemeResponse; import org.apache.ambari.server.controller.spi.Resource; +import org.apache.http.HttpStatus; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; + -/** - * Service for stacks management. - */ @Path("/stacks/") +@Api(value = "Stacks", description = "Endpoint for stack specific operations") public class StacksService extends BaseService { @GET - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all stacks", + nickname = "StacksService#getStacks", + notes = "Returns all stacks.", + response = StackResponse.StackResponseSwagger.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter stack details", defaultValue = "Stacks/stack_name", dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort stack privileges (asc | desc)", defaultValue = "Stacks/stack_name.asc", dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStacks(String body, @Context HttpHeaders headers, @Context UriInfo ui) { - return handleRequest(headers, body, ui, Request.Type.GET, createStackResource(null)); } @GET @Path("{stackName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get a stack", nickname = "StacksService#getStack", notes = "Returns stack details.", + response = StackResponse.StackResponseSwagger.class, responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter stack details", + defaultValue = "Stacks/*", dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStack(String body, @Context HttpHeaders headers, @Context UriInfo ui, - @PathParam("stackName") String stackName) { + @ApiParam @PathParam("stackName") String stackName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackResource(stackName)); @@ -61,10 +108,32 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all versions for a stacks", + nickname = "StacksService#getStackVersions", + notes = "Returns all versions for a stack.", + response = StackVersionResponse.StackVersionResponseSwagger.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter stack version details", + defaultValue = "Versions/stack_name,Versions/stack_version", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort stack privileges (asc | desc)", + defaultValue = "Versions/stack_name.asc,Versions/stack_version.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackVersions(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackVersionResource(stackName, null)); @@ -72,11 +141,25 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get details for a stack version", + nickname = "StacksService#getStackVersion", + notes = "Returns the details for a stack version.", + response = StackVersionResponse.StackVersionResponseSwagger.class) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter stack version details", + defaultValue = "Versions/*", dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackVersion(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion) { return handleRequest(headers, body, ui, Request.Type.GET, createStackVersionResource(stackName, stackVersion)); @@ -84,22 +167,78 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/links") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get extension links for a stack version", + nickname = "StacksService#getStackVersionLinks", + notes = "Returns the extension links for a stack version.", + response = ExtensionLinkResponse.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter extension link attributes", + defaultValue = "ExtensionLink/link_id," + + "ExtensionLink/stack_name," + + "ExtensionLink/stack_version," + + "ExtensionLink/extension_name," + + "ExtensionLink/extension_version", dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort extension links (asc | desc)", + defaultValue = "ExtensionLink/link_id.asc," + + "ExtensionLink/stack_name.asc," + + "ExtensionLink/stack_version.asc," + + "ExtensionLink/extension_name.asc," + + "ExtensionLink/extension_version.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackVersionLinks(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion) { - + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion) { return handleRequest(headers, body, ui, Request.Type.GET, createExtensionLinkResource(stackName, stackVersion, null, null)); } @GET @Path("{stackName}/versions/{stackVersion}/configurations") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all configurations for a stack version", + nickname = "StacksService#getStackLevelConfigurations", + notes = "Returns all configurations for a stack version.", + response = StackConfigurationResponse.StackConfigurationResponseSwagger.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "StackLevelConfigurations/stack_name," + + "StackLevelConfigurations/stack_version," + + "StackLevelConfigurations/property_name", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort configuration (asc | desc)", + defaultValue = "StackLevelConfigurations/stack_name.asc," + + "StackLevelConfigurations/stack_version.asc," + + "StackLevelConfigurations/property_name.asc ", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackLevelConfigurations(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion) { return handleRequest(headers, body, ui, Request.Type.GET, createStackLevelConfigurationsResource(stackName, stackVersion, null)); @@ -107,24 +246,64 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/configurations/{propertyName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get configuration details for a given property", + nickname = "StacksService#getStackLevelConfiguration", + notes = "Returns the configuration details for a given property.", + response = StackConfigurationResponse.StackConfigurationResponseSwagger.class) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "StackLevelConfigurations/*", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackLevelConfiguration(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName, - @PathParam("propertyName") String propertyName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName, + @ApiParam @PathParam("propertyName") String propertyName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackLevelConfigurationsResource(stackName, stackVersion, propertyName)); } - @GET @Path("{stackName}/versions/{stackVersion}/services") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all services for a stack version", + nickname = "StacksService#getStackServices", + notes = "Returns all services for a stack version.", + response = StackServiceResponse.StackServiceResponseSwagger.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "StackServices/stack_name," + + "StackServices/stack_version," + + "StackServices/service_name", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort stack services (asc | desc)", + defaultValue = "StackServices/stack_name.asc," + + "StackServices/stack_version.asc," + + "StackServices/service_name.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackServices(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceResource(stackName, stackVersion, null)); @@ -132,11 +311,26 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get stack service details", + nickname = "StacksService#getStackService", + notes = "Returns the details of a stack service.", + response = StackServiceResponse.StackServiceResponseSwagger.class) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "StackServices/*", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackService(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceResource(stackName, stackVersion, serviceName)); @@ -144,10 +338,28 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/artifacts") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all stack artifacts", + nickname = "StacksService#getStackArtifacts", + notes = "Returns all stack artifacts (e.g: kerberos descriptor, metrics descriptor)", + response = StackArtifactResponse.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "Artifacts/artifact_name," + + "Artifacts/stack_name," + + "Artifacts/stack_version", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackArtifacts(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion) { return handleRequest(headers, body, ui, Request.Type.GET, createStackArtifactsResource(stackName, stackVersion, null)); @@ -155,23 +367,62 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/artifacts/{artifactName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get stack artifact details", + nickname = "StacksService#getStackArtifact", + notes = "Returns the details of a stack artifact", + response = StackArtifactResponse.class) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "Artifacts/*", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackArtifact(String body, @Context HttpHeaders headers, @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("artifactName") String artifactName) { - + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("artifactName") String artifactName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackArtifactsResource(stackName, stackVersion, artifactName)); } @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/artifacts") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all artifacts for a stack service", + nickname = "StacksService#getStackServiceArtifacts", + notes = "Returns all stack service artifacts", + response = StackServiceArtifactResponse.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "Artifacts/artifact_name," + + "Artifacts/stack_name," + + "Artifacts/stack_version", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort service artifacts (asc | desc)", + defaultValue = "Artifacts/artifact_name.asc," + + "Artifacts/stack_name.asc," + + "Artifacts/stack_version.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackServiceArtifacts(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceArtifactsResource(stackName, stackVersion, serviceName, null)); @@ -179,11 +430,39 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/themes") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all themes for a stack service", + nickname = "StacksService#getStackServiceThemes", + notes = "Returns all stack themes", + response = ThemeResponse.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "ThemeInfo/file_name," + + "ThemeInfo/service_name," + + "ThemeInfo/stack_name," + + "ThemeInfo/stack_version", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort service artifacts (asc | desc)", + defaultValue = "ThemeInfo/file_name.asc," + + "ThemeInfo/service_name.asc," + + "ThemeInfo/stack_name.asc," + + "ThemeInfo/stack_version.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackServiceThemes(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceThemesResource(stackName, stackVersion, serviceName, null)); @@ -191,12 +470,27 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/themes/{themeName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get theme details for a stack service", + nickname = "StacksService#getStackServiceTheme", + notes = "Returns stack service theme details.", + response = ThemeResponse.class) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "ThemeInfo/*", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackServiceTheme(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName, - @PathParam("themeName") String themeName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName, + @ApiParam @PathParam("themeName") String themeName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceThemesResource(stackName, stackVersion, serviceName, themeName)); @@ -204,11 +498,39 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/quicklinks") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all quicklinks configurations for a stack service", + nickname = "StacksService#getStackServiceQuickLinksConfigurations", + notes = "Returns all quicklinks configurations for a stack service.", + response = QuickLinksResponse.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "QuickLinkInfo/file_name," + + "QuickLinkInfo/service_name," + + "QuickLinkInfo/stack_name," + + "QuickLinkInfo/stack_version", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort quick links (asc | desc)", + defaultValue = "QuickLinkInfo/file_name.asc," + + "QuickLinkInfo/service_name.asc," + + "QuickLinkInfo/stack_name.asc," + + "QuickLinkInfo/stack_version.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackServiceQuickLinksConfigurations(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceQuickLinksResource(stackName, stackVersion, serviceName, null)); @@ -216,12 +538,28 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/quicklinks/{quickLinksConfigurationName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get quicklinks configuration details", + nickname = "StacksService#getStackServiceQuickLinksConfiguration", + notes = "Returns the details of a quicklinks configuration.", + response = QuickLinksResponse.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "QuickLinkInfo/*", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackServiceQuickLinksConfiguration(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName, - @PathParam("quickLinksConfigurationName") String quickLinksConfigurationName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName, + @ApiParam @PathParam("quickLinksConfigurationName") String quickLinksConfigurationName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceQuickLinksResource(stackName, stackVersion, serviceName, quickLinksConfigurationName)); @@ -229,12 +567,28 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/artifacts/{artifactName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get stack service artifact details", + nickname = "StacksService#getStackServiceArtifact", + notes = "Returns the details of a stack service artifact.", + response = StackArtifactResponse.class + ) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "Artifacts/*", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackServiceArtifact(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName, - @PathParam("artifactName") String artifactName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName, + @ApiParam @PathParam("artifactName") String artifactName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceArtifactsResource(stackName, stackVersion, serviceName, artifactName)); @@ -242,12 +596,40 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/configurations") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all configurations for a stack service", + nickname = "StacksService#getStackConfigurations", + notes = "Returns all configurations for a stack service.", + response = StackConfigurationResponse.StackConfigurationResponseSwagger.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "StackConfigurations/property_name," + + "StackConfigurations/service_name," + + "StackConfigurations/stack_name" + + "StackConfigurations/stack_version", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort service configurations (asc | desc)", + defaultValue = "StackConfigurations/property_name.asc," + + "StackConfigurations/service_name.asc," + + "StackConfigurations/stack_name.asc" + + "StackConfigurations/stack_version.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackConfigurations(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackConfigurationResource(stackName, stackVersion, serviceName, null)); @@ -256,25 +638,69 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/configurations/{propertyName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get stack service configuration details", + nickname = "StacksService#getStackConfiguration", + notes = "Returns the details of a stack service configuration.", + response = StackConfigurationResponse.StackConfigurationResponseSwagger.class) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "StackConfigurations/*", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackConfiguration(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName, - @PathParam("propertyName") String propertyName) { - + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName, + @ApiParam @PathParam("propertyName") String propertyName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackConfigurationResource(stackName, stackVersion, serviceName, propertyName)); } @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/configurations/{propertyName}/dependencies") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all dependencies for a stack service configuration", + nickname = "StacksService#getStackConfigurationDependencies", + notes = "Returns all dependencies for a stack service configuration.", + response = StackConfigurationDependencyResponse.StackConfigurationDependencyResponseSwagger.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "StackConfigurationDependency/stack_name," + + "StackConfigurationDependency/stack_version," + + "StackConfigurationDependency/service_name," + + "StackConfigurationDependency/property_name," + + "StackConfigurationDependency/dependency_name", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort configuration dependencies (asc | desc)", + defaultValue = "StackConfigurationDependency/stack_name.asc," + + "StackConfigurationDependency/stack_version.asc," + + "StackConfigurationDependency/service_name.asc," + + "StackConfigurationDependency/property_name.asc," + + "StackConfigurationDependency/dependency_name.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getStackConfigurationDependencies(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName, - @PathParam("propertyName") String propertyName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName, + @ApiParam @PathParam("propertyName") String propertyName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackConfigurationDependencyResource(stackName, stackVersion, serviceName, propertyName)); @@ -282,12 +708,40 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/components") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all components for a stack service", + nickname = "StacksService#getServiceComponents", + notes = "Returns all components for a stack service.", + response = StackServiceComponentResponse.StackServiceComponentResponseSwagger.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "StackServiceComponents/component_name," + + "StackServiceComponents/service_name," + + "StackServiceComponents/stack_name," + + "StackServiceComponents/stack_version", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort service components (asc | desc)", + defaultValue = "StackServiceComponents/component_name.asc," + + "StackServiceComponents/service_name.asc," + + "StackServiceComponents/stack_name.asc," + + "StackServiceComponents/stack_version.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getServiceComponents(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceComponentResource(stackName, stackVersion, serviceName, null)); @@ -295,12 +749,42 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/components/{componentName}/dependencies") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get all dependencies for a stack service component", + nickname = "StacksService#getServiceComponentDependencies", + notes = "Returns all dependencies for a stack service component.", + response = ComponentDependencyResponse.class, + responseContainer = RESPONSE_CONTAINER_LIST) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "Dependencies/stack_name," + + "Dependencies/stack_version," + + "Dependencies/dependent_service_name," + + "Dependencies/dependent_component_name," + + "Dependencies/component_name", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_SORT, value = "Sort component dependencies (asc | desc)", + defaultValue = "Dependencies/stack_name.asc," + + "Dependencies/stack_version.asc," + + "Dependencies/dependent_service_name.asc," + + "Dependencies/dependent_component_name.asc," + + "Dependencies/component_name.asc", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY), + @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getServiceComponentDependencies(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName, - @PathParam("componentName") String componentName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName, + @ApiParam @PathParam("componentName") String componentName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceComponentDependencyResource(stackName, stackVersion, serviceName, componentName, null)); @@ -308,13 +792,29 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/components/{componentName}/dependencies/{dependencyName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get a stack service component dependency", + nickname = "StacksService#getServiceComponentDependency", + notes = "Returns a stack service component dependency.", + response = ComponentDependencyResponse.class + ) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "Dependencies/*", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getServiceComponentDependency(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName, - @PathParam("componentName") String componentName, - @PathParam("dependencyName") String dependencyName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName, + @ApiParam @PathParam("componentName") String componentName, + @ApiParam @PathParam("dependencyName") String dependencyName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceComponentDependencyResource(stackName, stackVersion, serviceName, componentName, dependencyName)); @@ -322,12 +822,27 @@ public class StacksService extends BaseService { @GET @Path("{stackName}/versions/{stackVersion}/services/{serviceName}/components/{componentName}") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) + @ApiOperation(value = "Get details for a stack service component", + nickname = "StacksService#getServiceComponent", + notes = "Returns details for a stack service component.", + response = StackServiceComponentResponse.StackServiceComponentResponseSwagger.class) + @ApiImplicitParams({ + @ApiImplicitParam(name = QUERY_FIELDS, value = "Filter returned attributes", + defaultValue = "StackServiceComponents/*", + dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY) + }) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), + @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND), + @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR) + }) public Response getServiceComponent(String body, @Context HttpHeaders headers, - @Context UriInfo ui, @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion, - @PathParam("serviceName") String serviceName, - @PathParam("componentName") String componentName) { + @Context UriInfo ui, + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion, + @ApiParam @PathParam("serviceName") String serviceName, + @ApiParam @PathParam("componentName") String componentName) { return handleRequest(headers, body, ui, Request.Type.GET, createStackServiceComponentResource(stackName, stackVersion, serviceName, componentName)); @@ -340,8 +855,10 @@ public class StacksService extends BaseService { * @param stackVersion stack version * @return operating system service */ + // TODO: find a way to handle this with Swagger (refactor or custom annotation?) @Path("{stackName}/versions/{stackVersion}/operating_systems") - public OperatingSystemService getOperatingSystemsHandler(@PathParam("stackName") String stackName, @PathParam("stackVersion") String stackVersion) { + public OperatingSystemService getOperatingSystemsHandler(@ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion) { final Map<Resource.Type, String> stackProperties = new HashMap<>(); stackProperties.put(Resource.Type.Stack, stackName); stackProperties.put(Resource.Type.StackVersion, stackVersion); @@ -355,8 +872,10 @@ public class StacksService extends BaseService { * @param stackVersion stack version * @return repository version service */ + // TODO: find a way to handle this with Swagger (refactor or custom annotation?) @Path("{stackName}/versions/{stackVersion}/repository_versions") - public RepositoryVersionService getRepositoryVersionHandler(@PathParam("stackName") String stackName, @PathParam("stackVersion") String stackVersion) { + public RepositoryVersionService getRepositoryVersionHandler(@ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion) { final Map<Resource.Type, String> stackProperties = new HashMap<>(); stackProperties.put(Resource.Type.Stack, stackName); stackProperties.put(Resource.Type.StackVersion, stackVersion); @@ -370,10 +889,11 @@ public class StacksService extends BaseService { * @param stackVersion stack version * @return repository version service */ + // TODO: find a way to handle this with Swagger (refactor or custom annotation?) @Path("{stackName}/versions/{stackVersion}/compatible_repository_versions") public CompatibleRepositoryVersionService getCompatibleRepositoryVersionHandler( - @PathParam("stackName") String stackName, - @PathParam("stackVersion") String stackVersion) { + @ApiParam @PathParam("stackName") String stackName, + @ApiParam @PathParam("stackVersion") String stackVersion) { final Map<Resource.Type, String> stackProperties = new HashMap<>(); stackProperties.put(Resource.Type.Stack, stackName); stackProperties.put(Resource.Type.StackVersion, stackVersion); http://git-wip-us.apache.org/repos/asf/ambari/blob/54983ee3/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserService.java index 47515c9..81f8ab8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/users/UserService.java @@ -61,7 +61,7 @@ public class UserService extends BaseService { @ApiOperation(value = "Get all users", nickname = "UserService#getUsers", notes = "Returns details of all users.", response = UserResponse.class, responseContainer = "List") @ApiImplicitParams({ @ApiImplicitParam(name = "fields", value = "Filter user details", defaultValue = "Users/*", dataType = "string", paramType = "query"), - @ApiImplicitParam(name = "sortBy", value = "Sort users (asc | desc)", defaultValue = "Users/user_name.desc", dataType = "string", paramType = "query"), + @ApiImplicitParam(name = "sortBy", value = "Sort users (asc | desc)", defaultValue = "Users/user_name.asc", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "page_size", value = "The number of resources to be returned for the paged response.", defaultValue = "10", dataType = "integer", paramType = "query"), @ApiImplicitParam(name = "from", value = "The starting page resource (inclusive). Valid values are :offset | \"start\"", defaultValue = "0", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "to", value = "The ending page resource (inclusive). Valid values are :offset | \"end\"", dataType = "string", paramType = "query") http://git-wip-us.apache.org/repos/asf/ambari/blob/54983ee3/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewInstanceService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewInstanceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewInstanceService.java index 8e87e6f..08e0e9f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewInstanceService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/views/ViewInstanceService.java @@ -139,7 +139,7 @@ public class ViewInstanceService extends BaseService { @Produces("text/plain") @ApiOperation(value = "Create view instance", nickname = "ViewInstanceService#createService", notes = "Creates view instance resource.") @ApiImplicitParams({ - @ApiImplicitParam(name = "body", value = "input parameters in json form", required = true, dataType = "org.apache.ambari.server.controller.ViewInstanceRequest", paramType = "body") + @ApiImplicitParam(name = "body", value = "input parameters in json form", required = true, dataType = "org.apache.ambari.server.controller.ViewInstanceRequest", paramType = "body") }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), http://git-wip-us.apache.org/repos/asf/ambari/blob/54983ee3/ambari-server/src/main/java/org/apache/ambari/server/controller/ComponentDependencyResponse.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ComponentDependencyResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ComponentDependencyResponse.java new file mode 100644 index 0000000..0795919 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ComponentDependencyResponse.java @@ -0,0 +1,64 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.server.controller; + +import java.util.List; + +import org.apache.ambari.server.state.DependencyConditionInfo; + +import io.swagger.annotations.ApiModelProperty; + +/** + * Response schema for endpoint {@link org.apache.ambari.server.api.services.StacksService#getServiceComponentDependency( + * String, javax.ws.rs.core.HttpHeaders, javax.ws.rs.core.UriInfo, String, String, String, String, String)} + + * The interface is not actually implemented, it only carries swagger annotations. + */ +public interface ComponentDependencyResponse extends ApiModel{ + + @ApiModelProperty(name = "Dependencies") + public ComponentDependencyResponseInfo getDependencyResponseInfo(); + + public interface ComponentDependencyResponseInfo { + @ApiModelProperty(name = "component_name") + public String getComponentName(); + + @ApiModelProperty(name = "conditions") + public List<DependencyConditionInfo> getDependencyConditions(); + + @ApiModelProperty(name = "dependent_component_name") + public String getDependentComponentName(); + + @ApiModelProperty(name = "dependent_service_name") + public String getDependentServiceName(); + + @ApiModelProperty(name = "scope") + public String getScope(); + + @ApiModelProperty(name = "service_name") + public String getServiceName(); + + @ApiModelProperty(name = "stack_name") + public String getStackName(); + + @ApiModelProperty(name = "stack_version") + public String getStackVersion(); + } + +}
