You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ha...@apache.org on 2015/08/09 04:55:32 UTC
[25/28] incubator-brooklyn git commit: brooklyn-rest-api: add
org.apache package prefix
brooklyn-rest-api: add org.apache package prefix
Also update dependent projects: brooklyn-cli, brooklyn-rest-client and
brooklyn-rest-server.
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/4c98f111
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/4c98f111
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/4c98f111
Branch: refs/heads/master
Commit: 4c98f1111f6009b49f9e0a22f622c1d68b452701
Parents: a9e5ca5
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Sun Jul 19 12:37:48 2015 +0300
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Fri Aug 7 15:59:51 2015 +0300
----------------------------------------------------------------------
.../brooklyn/cli/lister/ItemDescriptors.java | 8 +-
.../main/java/brooklyn/rest/api/AccessApi.java | 62 ----
.../java/brooklyn/rest/api/ActivityApi.java | 69 ----
.../java/brooklyn/rest/api/ApplicationApi.java | 222 -------------
.../main/java/brooklyn/rest/api/CatalogApi.java | 325 -------------------
.../java/brooklyn/rest/api/EffectorApi.java | 85 -----
.../main/java/brooklyn/rest/api/EntityApi.java | 235 --------------
.../java/brooklyn/rest/api/EntityConfigApi.java | 145 ---------
.../java/brooklyn/rest/api/LocationApi.java | 101 ------
.../main/java/brooklyn/rest/api/PolicyApi.java | 151 ---------
.../java/brooklyn/rest/api/PolicyConfigApi.java | 120 -------
.../main/java/brooklyn/rest/api/ScriptApi.java | 52 ---
.../main/java/brooklyn/rest/api/SensorApi.java | 150 ---------
.../main/java/brooklyn/rest/api/ServerApi.java | 203 ------------
.../main/java/brooklyn/rest/api/UsageApi.java | 156 ---------
.../main/java/brooklyn/rest/api/VersionApi.java | 42 ---
.../brooklyn/rest/domain/AccessSummary.java | 74 -----
.../java/brooklyn/rest/domain/ApiError.java | 208 ------------
.../brooklyn/rest/domain/ApplicationSpec.java | 181 -----------
.../rest/domain/ApplicationSummary.java | 117 -------
.../rest/domain/BrooklynFeatureSummary.java | 91 ------
.../rest/domain/CatalogEntitySummary.java | 81 -----
.../rest/domain/CatalogItemSummary.java | 151 ---------
.../rest/domain/CatalogLocationSummary.java | 59 ----
.../rest/domain/CatalogPolicySummary.java | 64 ----
.../brooklyn/rest/domain/ConfigSummary.java | 172 ----------
.../brooklyn/rest/domain/EffectorSummary.java | 187 -----------
.../rest/domain/EntityConfigSummary.java | 69 ----
.../java/brooklyn/rest/domain/EntitySpec.java | 102 ------
.../brooklyn/rest/domain/EntitySummary.java | 97 ------
.../java/brooklyn/rest/domain/HasConfig.java | 28 --
.../main/java/brooklyn/rest/domain/HasId.java | 26 --
.../main/java/brooklyn/rest/domain/HasName.java | 26 --
.../rest/domain/HighAvailabilitySummary.java | 144 --------
.../brooklyn/rest/domain/LinkWithMetadata.java | 88 -----
.../rest/domain/LocationConfigSummary.java | 62 ----
.../java/brooklyn/rest/domain/LocationSpec.java | 96 ------
.../brooklyn/rest/domain/LocationSummary.java | 96 ------
.../rest/domain/PolicyConfigSummary.java | 60 ----
.../brooklyn/rest/domain/PolicySummary.java | 108 ------
.../rest/domain/ScriptExecutionSummary.java | 67 ----
.../brooklyn/rest/domain/SensorSummary.java | 107 ------
.../main/java/brooklyn/rest/domain/Status.java | 33 --
.../rest/domain/SummaryComparators.java | 82 -----
.../java/brooklyn/rest/domain/TaskSummary.java | 232 -------------
.../brooklyn/rest/domain/UsageStatistic.java | 124 -------
.../brooklyn/rest/domain/UsageStatistics.java | 76 -----
.../brooklyn/rest/domain/VersionSummary.java | 81 -----
.../org/apache/brooklyn/rest/api/AccessApi.java | 62 ++++
.../apache/brooklyn/rest/api/ActivityApi.java | 69 ++++
.../brooklyn/rest/api/ApplicationApi.java | 222 +++++++++++++
.../apache/brooklyn/rest/api/CatalogApi.java | 325 +++++++++++++++++++
.../apache/brooklyn/rest/api/EffectorApi.java | 85 +++++
.../org/apache/brooklyn/rest/api/EntityApi.java | 235 ++++++++++++++
.../brooklyn/rest/api/EntityConfigApi.java | 145 +++++++++
.../apache/brooklyn/rest/api/LocationApi.java | 101 ++++++
.../org/apache/brooklyn/rest/api/PolicyApi.java | 151 +++++++++
.../brooklyn/rest/api/PolicyConfigApi.java | 120 +++++++
.../org/apache/brooklyn/rest/api/ScriptApi.java | 52 +++
.../org/apache/brooklyn/rest/api/SensorApi.java | 150 +++++++++
.../org/apache/brooklyn/rest/api/ServerApi.java | 203 ++++++++++++
.../org/apache/brooklyn/rest/api/UsageApi.java | 156 +++++++++
.../apache/brooklyn/rest/api/VersionApi.java | 42 +++
.../brooklyn/rest/domain/AccessSummary.java | 74 +++++
.../apache/brooklyn/rest/domain/ApiError.java | 208 ++++++++++++
.../brooklyn/rest/domain/ApplicationSpec.java | 181 +++++++++++
.../rest/domain/ApplicationSummary.java | 117 +++++++
.../rest/domain/BrooklynFeatureSummary.java | 91 ++++++
.../rest/domain/CatalogEntitySummary.java | 81 +++++
.../rest/domain/CatalogItemSummary.java | 151 +++++++++
.../rest/domain/CatalogLocationSummary.java | 59 ++++
.../rest/domain/CatalogPolicySummary.java | 64 ++++
.../brooklyn/rest/domain/ConfigSummary.java | 172 ++++++++++
.../brooklyn/rest/domain/EffectorSummary.java | 187 +++++++++++
.../rest/domain/EntityConfigSummary.java | 69 ++++
.../apache/brooklyn/rest/domain/EntitySpec.java | 102 ++++++
.../brooklyn/rest/domain/EntitySummary.java | 97 ++++++
.../apache/brooklyn/rest/domain/HasConfig.java | 28 ++
.../org/apache/brooklyn/rest/domain/HasId.java | 26 ++
.../apache/brooklyn/rest/domain/HasName.java | 26 ++
.../rest/domain/HighAvailabilitySummary.java | 144 ++++++++
.../brooklyn/rest/domain/LinkWithMetadata.java | 88 +++++
.../rest/domain/LocationConfigSummary.java | 62 ++++
.../brooklyn/rest/domain/LocationSpec.java | 96 ++++++
.../brooklyn/rest/domain/LocationSummary.java | 96 ++++++
.../rest/domain/PolicyConfigSummary.java | 60 ++++
.../brooklyn/rest/domain/PolicySummary.java | 108 ++++++
.../rest/domain/ScriptExecutionSummary.java | 67 ++++
.../brooklyn/rest/domain/SensorSummary.java | 107 ++++++
.../org/apache/brooklyn/rest/domain/Status.java | 33 ++
.../rest/domain/SummaryComparators.java | 82 +++++
.../brooklyn/rest/domain/TaskSummary.java | 232 +++++++++++++
.../brooklyn/rest/domain/UsageStatistic.java | 124 +++++++
.../brooklyn/rest/domain/UsageStatistics.java | 76 +++++
.../brooklyn/rest/domain/VersionSummary.java | 81 +++++
.../java/brooklyn/rest/domain/ApiErrorTest.java | 63 ----
.../rest/domain/ApplicationSpecTest.java | 53 ---
.../rest/domain/EffectorSummaryTest.java | 53 ---
.../brooklyn/rest/domain/EntitySpecTest.java | 50 ---
.../brooklyn/rest/domain/EntitySummaryTest.java | 61 ----
.../brooklyn/rest/domain/LocationSpecTest.java | 58 ----
.../rest/domain/VersionSummaryTest.java | 62 ----
.../brooklyn/rest/util/RestApiTestUtils.java | 58 ----
.../brooklyn/rest/domain/ApiErrorTest.java | 63 ++++
.../rest/domain/ApplicationSpecTest.java | 53 +++
.../rest/domain/EffectorSummaryTest.java | 53 +++
.../brooklyn/rest/domain/EntitySpecTest.java | 50 +++
.../brooklyn/rest/domain/EntitySummaryTest.java | 61 ++++
.../brooklyn/rest/domain/LocationSpecTest.java | 58 ++++
.../rest/domain/VersionSummaryTest.java | 62 ++++
.../brooklyn/rest/util/RestApiTestUtils.java | 58 ++++
.../brooklyn/rest/client/BrooklynApi.java | 30 +-
.../ApplicationResourceIntegrationTest.java | 10 +-
.../rest/client/BrooklynApiRestClientTest.java | 4 +-
.../rest/filter/HaHotCheckResourceFilter.java | 2 +-
.../rest/filter/HaMasterCheckFilter.java | 2 +-
.../brooklyn/rest/resources/AccessResource.java | 4 +-
.../rest/resources/ActivityResource.java | 4 +-
.../rest/resources/ApplicationResource.java | 12 +-
.../rest/resources/CatalogResource.java | 12 +-
.../rest/resources/EffectorResource.java | 6 +-
.../rest/resources/EntityConfigResource.java | 4 +-
.../brooklyn/rest/resources/EntityResource.java | 8 +-
.../rest/resources/LocationResource.java | 6 +-
.../rest/resources/PolicyConfigResource.java | 4 +-
.../brooklyn/rest/resources/PolicyResource.java | 8 +-
.../brooklyn/rest/resources/ScriptResource.java | 4 +-
.../brooklyn/rest/resources/SensorResource.java | 4 +-
.../brooklyn/rest/resources/ServerResource.java | 8 +-
.../brooklyn/rest/resources/UsageResource.java | 6 +-
.../rest/resources/VersionResource.java | 2 +-
.../rest/transform/AccessTransformer.java | 2 +-
.../rest/transform/ApplicationTransformer.java | 22 +-
.../transform/BrooklynFeatureTransformer.java | 2 +-
.../rest/transform/CatalogTransformer.java | 20 +-
.../rest/transform/EffectorTransformer.java | 4 +-
.../rest/transform/EntityTransformer.java | 4 +-
.../transform/HighAvailabilityTransformer.java | 4 +-
.../rest/transform/LocationTransformer.java | 6 +-
.../rest/transform/PolicyTransformer.java | 6 +-
.../rest/transform/SensorTransformer.java | 2 +-
.../rest/transform/TaskTransformer.java | 4 +-
.../rest/util/BrooklynRestResourceUtils.java | 6 +-
.../rest/util/DefaultExceptionMapper.java | 4 +-
.../brooklyn/rest/util/WebResourceUtils.java | 2 +-
.../brooklyn/rest/domain/ApplicationTest.java | 10 +-
.../rest/domain/LocationSummaryTest.java | 8 +-
.../brooklyn/rest/domain/SensorSummaryTest.java | 7 +-
.../rest/resources/AccessResourceTest.java | 2 +-
.../ApplicationResourceIntegrationTest.java | 10 +-
.../rest/resources/ApplicationResourceTest.java | 22 +-
.../rest/resources/CatalogResourceTest.java | 8 +-
.../rest/resources/DescendantsTest.java | 6 +-
.../resources/EntityConfigResourceTest.java | 6 +-
.../rest/resources/EntityResourceTest.java | 6 +-
.../rest/resources/ErrorResponseTest.java | 8 +-
.../rest/resources/LocationResourceTest.java | 6 +-
.../rest/resources/PolicyResourceTest.java | 8 +-
.../rest/resources/ScriptResourceTest.java | 2 +-
.../rest/resources/SensorResourceTest.java | 6 +-
.../rest/resources/ServerResourceTest.java | 4 +-
.../rest/resources/UsageResourceTest.java | 12 +-
.../rest/testing/BrooklynRestResourceTest.java | 6 +-
.../util/BrooklynRestResourceUtilsTest.java | 4 +-
164 files changed, 5950 insertions(+), 5957 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/cli/src/main/java/org/apache/brooklyn/cli/lister/ItemDescriptors.java
----------------------------------------------------------------------
diff --git a/usage/cli/src/main/java/org/apache/brooklyn/cli/lister/ItemDescriptors.java b/usage/cli/src/main/java/org/apache/brooklyn/cli/lister/ItemDescriptors.java
index af33289..d7e2c8c 100644
--- a/usage/cli/src/main/java/org/apache/brooklyn/cli/lister/ItemDescriptors.java
+++ b/usage/cli/src/main/java/org/apache/brooklyn/cli/lister/ItemDescriptors.java
@@ -38,10 +38,10 @@ import brooklyn.entity.EntityType;
import brooklyn.entity.basic.BrooklynConfigKeys;
import brooklyn.event.Sensor;
import brooklyn.location.LocationResolver;
-import brooklyn.rest.domain.EffectorSummary;
-import brooklyn.rest.domain.EntityConfigSummary;
-import brooklyn.rest.domain.SensorSummary;
-import brooklyn.rest.domain.SummaryComparators;
+import org.apache.brooklyn.rest.domain.EffectorSummary;
+import org.apache.brooklyn.rest.domain.EntityConfigSummary;
+import org.apache.brooklyn.rest.domain.SensorSummary;
+import org.apache.brooklyn.rest.domain.SummaryComparators;
import org.apache.brooklyn.rest.transform.EffectorTransformer;
import org.apache.brooklyn.rest.transform.EntityTransformer;
import org.apache.brooklyn.rest.transform.SensorTransformer;
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/AccessApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/AccessApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/AccessApi.java
deleted file mode 100644
index 5794dba..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/AccessApi.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.AccessSummary;
-
-import com.google.common.annotations.Beta;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Beta
-@Path("/v1/access")
-@Apidoc("Access Control")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface AccessApi {
-
- // TODO First access use-case is to disable location-provisioning (for Citrix's Cloud Portal Business Manager (CPBM)).
- // We rely on location implementations calling `managementContext.getAccessController().canProvisionLocation(parent)`,
- // which isn't ideal (because some impls might forget to do this). We can't just do it in the core management-context
- // because things like JcloudsLocation will provision the VM and only then create the JcloudsSshMachineLocation.
-
- @GET
- @ApiOperation(
- value = "Fetch access control summary",
- responseClass = "brooklyn.rest.domain.AccessSummary"
- )
- public AccessSummary get();
-
- @POST
- @Path("/locationProvisioningAllowed")
- @ApiOperation(value = "Sets whether location provisioning is permitted (beta feature)")
- public Response locationProvisioningAllowed(
- @ApiParam(name = "allowed", value = "Whether allowed or not", required = true)
- @QueryParam("allowed") boolean allowed);
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/ActivityApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/ActivityApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/ActivityApi.java
deleted file mode 100644
index 603b940..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/ActivityApi.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import java.util.List;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.TaskSummary;
-
-import com.wordnik.swagger.core.ApiError;
-import com.wordnik.swagger.core.ApiErrors;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-
-@Path("/v1/activities")
-@Apidoc("Activities")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface ActivityApi {
-
- @GET
- @Path("/{task}")
- @ApiOperation(value = "Fetch task details", responseClass = "brooklyn.rest.domain.TaskSummary")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find task")
- })
-// @Produces("text/json")
- public TaskSummary get(
- @ApiParam(value = "Task ID", required = true) @PathParam("task") String taskId
- );
-
- @GET
- @Path("/{task}/children")
- @ApiOperation(value = "Fetch list of children tasks of this task")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find task")
- })
- public List<TaskSummary> children(
- @ApiParam(value = "Task ID", required = true) @PathParam("task") String taskId);
-
- @GET
- @Path("/{task}/stream/{streamId}")
- @ApiOperation(value = "Return the contents of the given stream")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find task or stream")
- })
- public String stream(
- @ApiParam(value = "Task ID", required = true) @PathParam("task") String taskId,
- @ApiParam(value = "Stream ID", required = true) @PathParam("streamId") String streamId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/ApplicationApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/ApplicationApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/ApplicationApi.java
deleted file mode 100644
index 7da543b..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/ApplicationApi.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.validation.Valid;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonNode;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.ApplicationSpec;
-import brooklyn.rest.domain.ApplicationSummary;
-import brooklyn.rest.domain.EntitySummary;
-
-import com.wordnik.swagger.core.ApiError;
-import com.wordnik.swagger.core.ApiErrors;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Path("/v1/applications")
-@Apidoc("Applications")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface ApplicationApi {
-
- @GET
- @Path("/tree")
- @ApiOperation(
- value = "Fetch applications and entities tree hierarchy"
- )
- /** @deprecated since 0.6.0 use {@link #fetch(String)} (with slightly different, but better semantics) */
- @Deprecated
- public JsonNode applicationTree();
-
- @GET
- @Path("/fetch")
- @ApiOperation(
- value = "Fetch display details for all applications and optionally selected additional entities"
- )
- public JsonNode fetch(
- @ApiParam(value="Selected additional entity ID's to include, comma-separated", required=false)
- @DefaultValue("")
- @QueryParam("items") String items);
-
- @GET
- @ApiOperation(
- value = "Fetch list of applications, as ApplicationSummary objects",
- responseClass = "brooklyn.rest.domain.ApplicationSummary"
- )
- public List<ApplicationSummary> list(
- @ApiParam(value = "Regular expression to filter by", required = false)
- @DefaultValue(".*")
- @QueryParam("typeRegex") String typeRegex);
-
- // would be nice to have this on the API so default type regex not needed, but
- // not yet implemented, as per: https://issues.jboss.org/browse/RESTEASY-798
- // (this method was added to this class, but it breaks the rest client)
-// /** As {@link #list(String)}, filtering for <code>.*</code>. */
-// public List<ApplicationSummary> list();
-
- @GET
- @Path("/{application}")
- @ApiOperation(
- value = "Fetch a specific application",
- responseClass = "brooklyn.rest.domain.ApplicationSummary"
- )
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application not found")
- })
- public ApplicationSummary get(
- @ApiParam(
- value = "ID or name of application whose details will be returned",
- required = true)
- @PathParam("application") String application);
-
- @POST
- @Consumes({"application/x-yaml",
- // see http://stackoverflow.com/questions/332129/yaml-mime-type
- "text/yaml", "text/x-yaml", "application/yaml"})
- @ApiOperation(
- value = "Create and start a new application from YAML",
- responseClass = "brooklyn.rest.domain.TaskSummary"
- )
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Undefined entity or location"),
- @ApiError(code = 412, reason = "Application already registered")
- })
- public Response createFromYaml(
- @ApiParam(
- name = "applicationSpec",
- value = "App spec in CAMP YAML format",
- required = true)
- String yaml);
-
- // TODO archives
-// @Consumes({"application/x-tar", "application/x-tgz", "application/x-zip"})
-
- @POST
- @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN})
- @ApiOperation(
- value = "Create and start a new application from miscellaneous types, including JSON either new CAMP format or legacy AppSpec format",
- responseClass = "brooklyn.rest.domain.TaskSummary"
- )
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Undefined entity or location"),
- @ApiError(code = 412, reason = "Application already registered")
- })
- public Response createPoly(
- @ApiParam(
- name = "applicationSpec",
- value = "App spec in JSON, YAML, or other (auto-detected) format",
- required = true)
- byte[] autodetectedInput);
-
- @POST
- @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
- @ApiOperation(
- value = "Create and start a new application from form URL-encoded contents (underlying type autodetected)",
- responseClass = "brooklyn.rest.domain.TaskSummary"
- )
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Undefined entity or location"),
- @ApiError(code = 412, reason = "Application already registered")
- })
- public Response createFromForm(
- @ApiParam(
- name = "applicationSpec",
- value = "App spec in form-encoded YAML, JSON, or other (auto-detected) format",
- required = true)
- @Valid String contents);
-
- @DELETE
- @Path("/{application}")
- @ApiOperation(
- value = "Delete a specified application",
- responseClass = "brooklyn.rest.domain.TaskSummary"
- )
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application not found")
- })
- public Response delete(
- @ApiParam(
- name = "application",
- value = "Application name",
- required = true)
- @PathParam("application") String application);
-
- /** @deprecated since 0.7.0 the {@link ApplicationSpec} is being retired in favour of CAMP YAML/ZIP
- * (however in 0.7.0 you can still pass this object as JSON and it will be autodetected) */
- @POST
- @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.TEXT_PLAIN})
- @ApiOperation(
- value = "Create and start a new application from miscellaneous types, including JSON either new CAMP format or legacy AppSpec format",
- responseClass = "brooklyn.rest.domain.TaskSummary"
- )
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Undefined entity or location"),
- @ApiError(code = 412, reason = "Application already registered")
- })
- @Path("/createLegacy")
- @Deprecated
- public Response create(ApplicationSpec applicationSpec);
-
- @GET
- @Path("/{application}/descendants")
- @ApiOperation(value = "Fetch entity info for all (or filtered) descendants",
- responseClass = "brooklyn.rest.domain.EntitySummary")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application or entity missing")
- })
- public List<EntitySummary> getDescendants(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value="Regular expression for an entity type which must be matched", required=false)
- @DefaultValue(".*")
- @QueryParam("typeRegex") String typeRegex);
-
- @GET
- @Path("/{application}/descendants/sensor/{sensor}")
- @ApiOperation(value = "Fetch values of a given sensor for all (or filtered) descendants")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application or entity missing")
- })
- public Map<String,Object> getDescendantsSensor(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Sensor name", required = true)
- @PathParam("sensor") String sensor,
- @ApiParam(value="Regular expression for an entity type which must be matched", required=false)
- @DefaultValue(".*")
- @QueryParam("typeRegex") String typeRegex);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/CatalogApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/CatalogApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/CatalogApi.java
deleted file mode 100644
index 09e60a9..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/CatalogApi.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import java.io.InputStream;
-import java.util.List;
-
-import javax.validation.Valid;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.CatalogEntitySummary;
-import brooklyn.rest.domain.CatalogItemSummary;
-import brooklyn.rest.domain.CatalogLocationSummary;
-import brooklyn.rest.domain.CatalogPolicySummary;
-
-import com.sun.jersey.core.header.FormDataContentDisposition;
-import com.sun.jersey.multipart.FormDataParam;
-import com.wordnik.swagger.core.ApiError;
-import com.wordnik.swagger.core.ApiErrors;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Path("/v1/catalog")
-@Apidoc("Catalog")
-@Consumes(MediaType.APPLICATION_JSON)
-@Produces(MediaType.APPLICATION_JSON)
-public interface CatalogApi {
-
- @POST
- @ApiOperation(value = "Add a catalog item (e.g. new type of entity, policy or location) by uploading YAML descriptor from browser using multipart/form-data",
- responseClass = "String")
- @Consumes(MediaType.MULTIPART_FORM_DATA)
- public Response createFromMultipart(
- @ApiParam(name = "yaml", value = "multipart/form-data file input field")
- @FormDataParam("yaml") InputStream uploadedInputStream,
- @FormDataParam("yaml") FormDataContentDisposition fileDetail);
-
- @Consumes
- @POST
- @ApiOperation(value = "Add a catalog item (e.g. new type of entity, policy or location) by uploading YAML descriptor "
- + "Return value is map of ID to CatalogItemSummary, with code 201 CREATED.", responseClass = "Response")
- public Response create(
- @ApiParam(name = "yaml", value = "YAML descriptor of catalog item", required = true)
- @Valid String yaml);
-
- @POST
- @Consumes(MediaType.APPLICATION_XML)
- @Path("/reset")
- @ApiOperation(value = "Resets the catalog to the given (XML) format")
- public Response resetXml(
- @ApiParam(name = "xml", value = "XML descriptor of the entire catalog to install", required = true)
- @Valid String xml,
- @ApiParam(name ="ignoreErrors", value ="Don't fail on invalid bundles, log the errors only")
- @QueryParam("ignoreErrors") @DefaultValue("false")
- boolean ignoreErrors);
-
- /** @deprecated since 0.7.0 use {@link #deleteEntity(String, String)} */
- @Deprecated
- @DELETE
- @Path("/entities/{entityId}")
- @ApiOperation(value = "Deletes a specific version of an entity's definition from the catalog")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public void deleteEntity(
- @ApiParam(name = "entityId", value = "The ID of the entity or template to delete", required = true)
- @PathParam("entityId") String entityId) throws Exception;
-
- @DELETE
- @Path("/applications/{symbolicName}/{version}")
- @ApiOperation(value = "Deletes a specific version of an application's definition from the catalog")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public void deleteApplication(
- @ApiParam(name = "symbolicName", value = "The symbolic name of the application or template to delete", required = true)
- @PathParam("symbolicName") String symbolicName,
-
- @ApiParam(name = "version", value = "The version identifier of the application or template to delete", required = true)
- @PathParam("version") String version) throws Exception;
-
- @DELETE
- @Path("/entities/{symbolicName}/{version}")
- @ApiOperation(value = "Deletes a specific version of an entity's definition from the catalog")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public void deleteEntity(
- @ApiParam(name = "symbolicName", value = "The symbolic name of the entity or template to delete", required = true)
- @PathParam("symbolicName") String symbolicName,
-
- @ApiParam(name = "version", value = "The version identifier of the entity or template to delete", required = true)
- @PathParam("version") String version) throws Exception;
-
- @DELETE
- @Path("/policies/{policyId}/{version}")
- @ApiOperation(value = "Deletes a specific version of an policy's definition from the catalog")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Policy not found")
- })
- public void deletePolicy(
- @ApiParam(name = "policyId", value = "The ID of the policy to delete", required = true)
- @PathParam("policyId") String policyId,
-
- @ApiParam(name = "version", value = "The version identifier of the policy to delete", required = true)
- @PathParam("version") String version) throws Exception;
-
- @DELETE
- @Path("/locations/{locationId}/{version}")
- @ApiOperation(value = "Deletes a specific version of an location's definition from the catalog")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Location not found")
- })
- public void deleteLocation(
- @ApiParam(name = "locationId", value = "The ID of the location to delete", required = true)
- @PathParam("locationId") String locationId,
-
- @ApiParam(name = "version", value = "The version identifier of the location to delete", required = true)
- @PathParam("version") String version) throws Exception;
-
- @GET
- @Path("/entities")
- @ApiOperation(value = "List available entity types optionally matching a query", responseClass = "CatalogItemSummary", multiValueResponse = true)
- public List<CatalogEntitySummary> listEntities(
- @ApiParam(name = "regex", value = "Regular expression to search for")
- @QueryParam("regex") @DefaultValue("") String regex,
- @ApiParam(name = "fragment", value = "Substring case-insensitive to search for")
- @QueryParam("fragment") @DefaultValue("") String fragment,
- @ApiParam(name = "allVersions", value = "Include all versions (defaults false, only returning the best version)")
- @QueryParam("allVersions") @DefaultValue("false") boolean includeAllVersions);
-
- @GET
- @Path("/applications")
- @ApiOperation(value = "Fetch a list of application templates optionally matching a query", responseClass = "CatalogItemSummary", multiValueResponse = true)
- public List<CatalogItemSummary> listApplications(
- @ApiParam(name = "regex", value = "Regular expression to search for")
- @QueryParam("regex") @DefaultValue("") String regex,
- @ApiParam(name = "fragment", value = "Substring case-insensitive to search for")
- @QueryParam("fragment") @DefaultValue("") String fragment,
- @ApiParam(name = "allVersions", value = "Include all versions (defaults false, only returning the best version)")
- @QueryParam("allVersions") @DefaultValue("false") boolean includeAllVersions);
-
- /** @deprecated since 0.7.0 use {@link #getEntity(String, String)} */
- @Deprecated
- @GET
- @Path("/entities/{entityId}")
- @ApiOperation(value = "Fetch an entity's definition from the catalog", responseClass = "CatalogEntitySummary", multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public CatalogEntitySummary getEntity(
- @ApiParam(name = "entityId", value = "The ID of the entity or template to retrieve", required = true)
- @PathParam("entityId") String entityId) throws Exception;
-
- @GET
- @Path("/entities/{symbolicName}/{version}")
- @ApiOperation(value = "Fetch a specific version of an entity's definition from the catalog", responseClass = "CatalogEntitySummary", multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public CatalogEntitySummary getEntity(
- @ApiParam(name = "symbolicName", value = "The symbolic name of the entity or template to retrieve", required = true)
- @PathParam("symbolicName") String symbolicName,
-
- @ApiParam(name = "version", value = "The version identifier of the entity or template to retrieve", required = true)
- @PathParam("version") String version) throws Exception;
-
- /** @deprecated since 0.7.0 use {@link #getEntity(String, String)} */
- @Deprecated
- @GET
- @Path("/applications/{applicationId}")
- @ApiOperation(value = "Fetch a specific version of an application's definition from the catalog", responseClass = "CatalogEntitySummary", multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public CatalogEntitySummary getApplication(
- @ApiParam(name = "applicationId", value = "The ID of the application to retrieve", required = true)
- @PathParam("applicationId") String applicationId) throws Exception;
-
- @GET
- @Path("/applications/{symbolicName}/{version}")
- @ApiOperation(value = "Fetch a specific version of an application's definition from the catalog", responseClass = "CatalogEntitySummary", multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public CatalogEntitySummary getApplication(
- @ApiParam(name = "symbolicName", value = "The symbolic name of the application to retrieve", required = true)
- @PathParam("symbolicName") String symbolicName,
-
- @ApiParam(name = "version", value = "The version identifier of the application to retrieve", required = true)
- @PathParam("version") String version) throws Exception;
-
- @GET
- @Path("/policies")
- @ApiOperation(value = "List available policies optionally matching a query", responseClass = "CatalogPolicySummary", multiValueResponse = true)
- public List<CatalogPolicySummary> listPolicies(
- @ApiParam(name = "regex", value = "Regular expression to search for")
- @QueryParam("regex") @DefaultValue("") String regex,
- @ApiParam(name = "fragment", value = "Substring case-insensitive to search for")
- @QueryParam("fragment") @DefaultValue("") String fragment,
- @ApiParam(name = "allVersions", value = "Include all versions (defaults false, only returning the best version)")
- @QueryParam("allVersions") @DefaultValue("false") boolean includeAllVersions);
-
- /** @deprecated since 0.7.0 use {@link #getPolicy(String, String)} */
- @Deprecated
- @GET
- @Path("/policies/{policyId}")
- @ApiOperation(value = "Fetch a policy's definition from the catalog", responseClass = "CatalogItemSummary", multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public CatalogItemSummary getPolicy(
- @ApiParam(name = "policyId", value = "The ID of the policy to retrieve", required = true)
- @PathParam("policyId") String policyId) throws Exception;
-
- @GET
- @Path("/policies/{policyId}/{version}")
- @ApiOperation(value = "Fetch a policy's definition from the catalog", responseClass = "CatalogItemSummary", multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public CatalogItemSummary getPolicy(
- @ApiParam(name = "policyId", value = "The ID of the policy to retrieve", required = true)
- @PathParam("policyId") String policyId,
- @ApiParam(name = "version", value = "The version identifier of the application to retrieve", required = true)
- @PathParam("version") String version) throws Exception;
-
- @GET
- @Path("/locations")
- @ApiOperation(value = "List available locations optionally matching a query", responseClass = "CatalogLocationSummary", multiValueResponse = true)
- public List<CatalogLocationSummary> listLocations(
- @ApiParam(name = "regex", value = "Regular expression to search for")
- @QueryParam("regex") @DefaultValue("") String regex,
- @ApiParam(name = "fragment", value = "Substring case-insensitive to search for")
- @QueryParam("fragment") @DefaultValue("") String fragment,
- @ApiParam(name = "allVersions", value = "Include all versions (defaults false, only returning the best version)")
- @QueryParam("allVersions") @DefaultValue("false") boolean includeAllVersions);
-
- /** @deprecated since 0.7.0 use {@link #getLocation(String, String)} */
- @Deprecated
- @GET
- @Path("/locations/{locationId}")
- @ApiOperation(value = "Fetch a location's definition from the catalog", responseClass = "CatalogItemSummary", multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public CatalogItemSummary getLocation(
- @ApiParam(name = "locationId", value = "The ID of the location to retrieve", required = true)
- @PathParam("locationId") String locationId) throws Exception;
-
- @GET
- @Path("/locations/{locationId}/{version}")
- @ApiOperation(value = "Fetch a location's definition from the catalog", responseClass = "CatalogItemSummary", multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Entity not found")
- })
- public CatalogItemSummary getLocation(
- @ApiParam(name = "locationId", value = "The ID of the location to retrieve", required = true)
- @PathParam("locationId") String locationId,
- @ApiParam(name = "version", value = "The version identifier of the application to retrieve", required = true)
- @PathParam("version") String version) throws Exception;
-
- /** @deprecated since 0.7.0 use {@link #getIcon(String, String)} */
- @Deprecated
- @GET
- @Path("/icon/{itemId}")
- @ApiOperation(value = "Return the icon for a given catalog entry (application/image or HTTP redirect)")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Item not found")
- })
- @Produces("application/image")
- public Response getIcon(
- @ApiParam(name = "itemId", value = "ID of catalog item (application, entity, policy, location)")
- @PathParam("itemId") @DefaultValue("") String itemId);
-
- @GET
- @Path("/icon/{itemId}/{version}")
- @ApiOperation(value = "Return the icon for a given catalog entry (application/image or HTTP redirect)")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Item not found")
- })
- @Produces("application/image")
- public Response getIcon(
- @ApiParam(name = "itemId", value = "ID of catalog item (application, entity, policy, location)", required=true)
- @PathParam("itemId") String itemId,
-
- @ApiParam(name = "version", value = "version identifier of catalog item (application, entity, policy, location)", required=true)
- @PathParam("version") String version);
-
- @POST
- @Path("/entities/{itemId}/deprecated/{deprecated}")
- public void setDeprecated(
- @ApiParam(name = "itemId", value = "The ID of the catalog item to be deprecated", required = true)
- @PathParam("itemId") String itemId,
- @ApiParam(name = "deprecated", value = "Whether or not the catalog item is deprecated", required = true)
- @PathParam("deprecated") boolean deprecated);
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/EffectorApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/EffectorApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/EffectorApi.java
deleted file mode 100644
index fe1f29e..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/EffectorApi.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.EffectorSummary;
-import com.wordnik.swagger.core.ApiError;
-import com.wordnik.swagger.core.ApiErrors;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-import javax.validation.Valid;
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.util.List;
-import java.util.Map;
-
-@Path("/v1/applications/{application}/entities/{entity}/effectors")
-@Apidoc("Entity Effectors")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface EffectorApi {
-
- @GET
- @ApiOperation(value = "Fetch the list of effectors",
- responseClass = "brooklyn.rest.domain.EffectorSummary",
- multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application or entity")
- })
- public List<EffectorSummary> list(
- @ApiParam(name = "application", value = "Application name", required = true)
- @PathParam("application") final String application,
- @ApiParam(name = "entity", value = "Entity name", required = true)
- @PathParam("entity") final String entityToken);
-
- @POST
- @Path("/{effector}")
- @ApiOperation(value = "Trigger an effector",
- notes="Returns the return value (status 200) if it completes, or an activity task ID (status 202) if it times out")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity or effector")
- })
- @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
- public Response invoke(
- @ApiParam(name = "application", value = "Application ID or name", required = true)
- @PathParam("application") String application,
-
- @ApiParam(name = "entity", value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
-
- @ApiParam(name = "effector", value = "Name of the effector to trigger", required = true)
- @PathParam("effector") String effectorName,
-
- // TODO test timeout; and should it be header, form, or what?
- @ApiParam(name = "timeout", value = "Delay before server should respond with activity task ID rather than result (in millis if no unit specified): " +
- "'never' (blocking) is default; " +
- "'0' means 'always' return task activity ID; " +
- "and e.g. '1000' or '1s' will return a result if available within one second otherwise status 202 and the activity task ID",
- required = false, defaultValue = "never")
- @QueryParam("timeout")
- String timeout,
-
- @ApiParam(/* FIXME: giving a `name` in swagger @ApiParam seems wrong as this object is the body, not a named argument */ name = "parameters",
- value = "Effector parameters (as key value pairs)", required = false)
- @Valid
- Map<String, Object> parameters);
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/EntityApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/EntityApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/EntityApi.java
deleted file mode 100644
index feab918..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/EntityApi.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.EntitySummary;
-import brooklyn.rest.domain.LocationSummary;
-import brooklyn.rest.domain.TaskSummary;
-
-import com.wordnik.swagger.core.ApiError;
-import com.wordnik.swagger.core.ApiErrors;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import java.util.List;
-import java.util.Map;
-
-@Path("/v1/applications/{application}/entities")
-@Apidoc("Entities")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface EntityApi {
-
- @GET
- @ApiOperation(value = "Fetch the list of entities for a given application",
- responseClass = "brooklyn.rest.domain.EntitySummary",
- multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application not found")
- })
- public List<EntitySummary> list(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") final String application) ;
-
- @GET
- @Path("/{entity}")
- @ApiOperation(value = "Fetch details about a specific application entity",
- responseClass = "brooklyn.rest.domain.EntitySummary")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application or entity missing")
- })
- public EntitySummary get(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entity);
-
- // TODO rename as "/children" ?
- @GET
- @ApiOperation(value = "Fetch details about a specific application entity's children",
- responseClass = "brooklyn.rest.domain.EntitySummary")
- @Path("/{entity}/children")
- public List<EntitySummary> getChildren(
- @PathParam("application") final String application,
- @PathParam("entity") final String entity);
-
- /** @deprecated since 0.7.0 use /children */
- @Deprecated
- @Path("/{entity}/entities")
- public List<EntitySummary> getChildrenOld(
- @PathParam("application") final String application,
- @PathParam("entity") final String entity);
-
- @POST
- @ApiOperation(value = "Add a child or children to this entity given a YAML spec",
- responseClass = "brooklyn.rest.domain.TaskSummary")
- @Consumes({"application/x-yaml",
- // see http://stackoverflow.com/questions/332129/yaml-mime-type
- "text/yaml", "text/x-yaml", "application/yaml", MediaType.APPLICATION_JSON})
- @Path("/{entity}/children")
- public Response addChildren(
- @PathParam("application") final String application,
- @PathParam("entity") final String entity,
-
- @ApiParam(
- name = "start",
- value = "Whether to automatically start this child; if omitted, true for Startable entities")
- @QueryParam("start") final Boolean start,
-
- @ApiParam(name = "timeout", value = "Delay before server should respond with incomplete activity task, rather than completed task: " +
- "'never' means block until complete; " +
- "'0' means return task immediately; " +
- "and e.g. '20ms' (the default) will wait 20ms for completed task information to be available",
- required = false, defaultValue = "20ms")
- @QueryParam("timeout") final String timeout,
-
- @ApiParam(
- name = "childrenSpec",
- value = "Entity spec in CAMP YAML format (including 'services' root element)",
- required = true)
- String yaml);
-
- @GET
- @Path("/{entity}/activities")
- @ApiOperation(value = "Fetch list of tasks for this entity")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application or entity")
- })
- public List<TaskSummary> listTasks(
- @ApiParam(value = "Entity ID or name", required = true) @PathParam("application") String applicationId,
- @ApiParam(value = "Application ID or name", required = true) @PathParam("entity") String entityId);
-
- @GET
- @Path("/{entity}/activities/{task}")
- @ApiOperation(value = "Fetch task details", responseClass = "brooklyn.rest.domain.TaskSummary")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity or task")
- })
- @Produces("text/json")
- public TaskSummary getTask(
- @ApiParam(value = "Application ID or name", required = true) @PathParam("application") final String application,
- @ApiParam(value = "Entity ID or name", required = true) @PathParam("entity") final String entityToken,
- @ApiParam(value = "Task ID", required = true) @PathParam("task") String taskId);
-
- @GET
- @ApiOperation(value = "Returns an icon for the entity, if defined")
- @Path("/{entity}/icon")
- public Response getIcon(
- @PathParam("application") final String application,
- @PathParam("entity") final String entity);
-
- @GET
- @Path("/{entity}/tags")
- @ApiOperation(value = "Fetch list of tags on this entity")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application or entity")
- })
- public List<Object> listTags(
- @ApiParam(value = "Entity ID or name", required = true) @PathParam("application") String applicationId,
- @ApiParam(value = "Application ID or name", required = true) @PathParam("entity") String entityId);
-
- @POST
- @ApiOperation(
- value = "Rename an entity"
- )
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Undefined application or entity")
- })
- @Path("/{entity}/name")
- public Response rename(
- @ApiParam(value = "Application ID or name", required = true) @PathParam("application") final String applicationId,
- @ApiParam(value = "Entity ID or name", required = true) @PathParam("entity") final String entityId,
- @ApiParam(value = "New name for this entity", required = true) @QueryParam("name") final String name);
-
- @POST
- @ApiOperation(
- value = "Expunge an entity",
- responseClass = "brooklyn.rest.domain.TaskSummary"
- )
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Undefined application or entity")
- })
- @Path("/{entity}/expunge")
- public Response expunge(
- @ApiParam(value = "Application ID or name", required = true) @PathParam("application") final String applicationId,
- @ApiParam(value = "Entity ID or name", required = true) @PathParam("entity") final String entityId,
- @ApiParam(value = "Whether to gracefully release all resources", required = true) @QueryParam("release") final boolean release);
-
- @GET
- @Path("/{entity}/descendants")
- @ApiOperation(value = "Fetch entity info for all (or filtered) descendants",
- responseClass = "brooklyn.rest.domain.EntitySummary")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application or entity missing")
- })
- public List<EntitySummary> getDescendants(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entity,
- @ApiParam(value="Regular expression for an entity type which must be matched", required=false)
- @DefaultValue(".*")
- @QueryParam("typeRegex") String typeRegex);
-
- @GET
- @Path("/{entity}/descendants/sensor/{sensor}")
- @ApiOperation(value = "Fetch values of a given sensor for all (or filtered) descendants")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application or entity missing")
- })
- public Map<String,Object> getDescendantsSensor(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entity,
- @ApiParam(value = "Sensor name", required = true)
- @PathParam("sensor") String sensor,
- @ApiParam(value="Regular expression applied to filter descendant entities based on their type", required=false)
- @DefaultValue(".*")
- @QueryParam("typeRegex") String typeRegex);
-
- @GET
- @Path("/{entity}/locations")
- @ApiOperation(value = "List the locations set on the entity")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application or entity missing")
- })
- public List<LocationSummary> getLocations(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entity);
-
- @GET
- @Path("/{entity}/spec")
- @ApiOperation(value = "Get the YAML spec used to create the entity, if available")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Application or entity missing")
- })
- public String getSpec(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entity);
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/EntityConfigApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/EntityConfigApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/EntityConfigApi.java
deleted file mode 100644
index 6452a48..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/EntityConfigApi.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.EntityConfigSummary;
-
-import com.wordnik.swagger.core.ApiError;
-import com.wordnik.swagger.core.ApiErrors;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@Path("/v1/applications/{application}/entities/{entity}/config")
-@Apidoc("Entity Config")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface EntityConfigApi {
-
- @GET
- @ApiOperation(value = "Fetch the config keys for a specific application entity",
- responseClass = "brooklyn.rest.domain.ConfigSummary",
- multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application or entity")
- })
- public List<EntityConfigSummary> list(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") final String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") final String entityToken);
-
- // TODO support parameters ?show=value,summary&name=xxx &format={string,json,xml}
- // (and in sensors class)
- @GET
- @Path("/current-state")
- @ApiOperation(value = "Fetch config key values in batch", notes="Returns a map of config name to value")
- public Map<String, Object> batchConfigRead(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
- @ApiParam(value = "Return raw config data instead of display values", required = false)
- @QueryParam("raw") @DefaultValue("false") final Boolean raw);
-
- //To call this endpoint set the Accept request field e.g curl -H "Accept: application/json" ...
- @GET
- @Path("/{config}")
- @ApiOperation(value = "Fetch config value (json)", responseClass = "Object")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity or config key")
- })
- @Produces(MediaType.APPLICATION_JSON)
- public Object get(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
- @ApiParam(value = "Config key ID", required = true)
- @PathParam("config") String configKeyName,
- @ApiParam(value = "Return raw config data instead of display values", required = false)
- @QueryParam("raw") @DefaultValue("false") final Boolean raw);
-
- // if user requests plain value we skip some json post-processing
- @GET
- @Path("/{config}")
- @ApiOperation(value = "Fetch config value (text/plain)", responseClass = "Object")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity or config key")
- })
- @Produces(MediaType.TEXT_PLAIN)
- public String getPlain(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
- @ApiParam(value = "Config key ID", required = true)
- @PathParam("config") String configKeyName,
- @ApiParam(value = "Return raw config data instead of display values", required = false)
- @QueryParam("raw") @DefaultValue("false") final Boolean raw);
-
- @POST
- @ApiOperation(value = "Manually set multiple config values")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application or entity")
- })
- @SuppressWarnings("rawtypes")
- public void setFromMap(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") final String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") final String entityToken,
- @ApiParam(value = "Apply the config to all pre-existing descendants", required = false)
- @QueryParam("recurse") @DefaultValue("false") final Boolean recurse,
- @ApiParam(value = "Map of config key names to values", required = true)
- Map newValues);
-
- @POST
- @Path("/{config}")
- @ApiOperation(value = "Manually set a config value")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity or config key")
- })
- public void set(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") final String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") final String entityToken,
- @ApiParam(value = "Config key name", required = true)
- @PathParam("config") String configName,
- @ApiParam(value = "Apply the config to all pre-existing descendants", required = false)
- @QueryParam("recurse") @DefaultValue("false") final Boolean recurse,
- @ApiParam(value = "Value to set")
- Object newValue);
-
- // deletion of config is not supported; you can set it null
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/LocationApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/LocationApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/LocationApi.java
deleted file mode 100644
index 5035c19..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/LocationApi.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.validation.Valid;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.LocationSpec;
-import brooklyn.rest.domain.LocationSummary;
-
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-@SuppressWarnings("deprecation")
-@Path("/v1/locations")
-@Apidoc("Locations")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface LocationApi {
-
- /**
- * @deprecated since 0.7.0; use {@link CatalogApi#listLocations(String, String)}
- */
- @GET
- @ApiOperation(value = "Fetch the list of location definitions",
- responseClass = "brooklyn.rest.domain.LocationSummary",
- multiValueResponse = true)
- @Deprecated
- public List<LocationSummary> list();
-
- // this is here to support the web GUI's circles
- @GET
- @Path("/usage/LocatedLocations")
- @ApiOperation(value = "Return a summary of all usage", notes="interim API, expected to change")
- public Map<String,Map<String,Object>> getLocatedLocations();
-
- /**
- * WARNING: behaviour will change in a future release; this will only return location instances.
- * See {@link CatalogApi#getLocation(String, String)} for retrieving location definitions.
- */
- @GET
- @Path("/{locationId}")
- @ApiOperation(value = "Fetch details about a location instance, or a location definition",
- responseClass = "brooklyn.rest.domain.LocationSummary",
- multiValueResponse = true)
- public LocationSummary get(
- @ApiParam(value = "Location id to fetch", required = true)
- @PathParam("locationId") String locationId,
- @ApiParam(value = "Whether full (inherited) config should be compiled", required = false)
- @DefaultValue("false")
- @QueryParam("full") String fullConfig);
-
- /** @deprecated since 0.7.0 use {@link CatalogApi#create(String)} with a location definition */
- @POST
- @ApiOperation(value = "Create a new location definition", responseClass = "String")
- @Deprecated
- public Response create(
- @ApiParam(name = "locationSpec", value = "Location specification object", required = true)
- @Valid LocationSpec locationSpec);
-
- /**
- * @deprecated since 0.7.0; use {@link CatalogApi#deleteLocation(String, String)}
- */
- @DELETE
- @Path("/{locationId}")
- @ApiOperation(value = "Deletes a location definition by id")
- @Deprecated
- public void delete(
- @ApiParam(value = "Location id to delete", required = true)
- @PathParam("locationId") String locationId);
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/PolicyApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/PolicyApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/PolicyApi.java
deleted file mode 100644
index 72a91f5..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/PolicyApi.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.PolicySummary;
-import brooklyn.rest.domain.Status;
-import com.wordnik.swagger.core.ApiError;
-import com.wordnik.swagger.core.ApiErrors;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.util.List;
-import java.util.Map;
-
-@Path("/v1/applications/{application}/entities/{entity}/policies")
-@Apidoc("Entity Policies")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface PolicyApi {
-
- @GET
- @ApiOperation(value = "Fetch the policies attached to a specific application entity",
- responseClass = "brooklyn.rest.domain.PolicySummary",
- multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application or entity")
- })
- public List<PolicySummary> list(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") final String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") final String entityToken);
-
- // TODO support parameters ?show=value,summary&name=xxx
- // (and in sensors class)
- @GET
- @Path("/current-state")
- @ApiOperation(value = "Fetch policy states in batch", notes="Returns a map of policy ID to whether it is active")
- // FIXME method name -- this is nothing to do with config!
- public Map<String, Boolean> batchConfigRead(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken) ;
-
- @POST
- @ApiOperation(value = "Add a policy", notes = "Returns a summary of the new policy")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application or entity"),
- @ApiError(code = 400, reason = "Type is not a class implementing Policy")
- })
- public PolicySummary addPolicy(
- @ApiParam(name = "application", value = "Application ID or name", required = true)
- @PathParam("application") String application,
-
- @ApiParam(name = "entity", value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
-
- @ApiParam(name = "policyType", value = "Class of policy to add", required = true)
- @QueryParam("type")
- String policyTypeName,
-
- // TODO would like to make this optional but jersey complains if we do
- @ApiParam(name = "config", value = "Configuration for the policy (as key value pairs)", required = true)
- Map<String, String> config);
-
- @GET
- @Path("/{policy}")
- @ApiOperation(value = "Gets status of a policy (RUNNING / SUSPENDED)")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity or policy")
- })
- public Status getStatus(
- @ApiParam(name = "application", value = "Application ID or name", required = true)
- @PathParam("application") String application,
-
- @ApiParam(name = "entity", value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
-
- @ApiParam(name = "policy", value = "Policy ID or name", required = true)
- @PathParam("policy") String policyId);
-
- @POST
- @Path("/{policy}/start")
- @ApiOperation(value = "Start or resume a policy")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity or policy")
- })
- public Response start(
- @ApiParam(name = "application", value = "Application ID or name", required = true)
- @PathParam("application") String application,
-
- @ApiParam(name = "entity", value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
-
- @ApiParam(name = "policy", value = "Policy ID or name", required = true)
- @PathParam("policy") String policyId);
-
- @POST
- @Path("/{policy}/stop")
- @ApiOperation(value = "Suspends a policy")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity or policy")
- })
- public Response stop(
- @ApiParam(name = "application", value = "Application ID or name", required = true)
- @PathParam("application") String application,
-
- @ApiParam(name = "entity", value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
-
- @ApiParam(name = "policy", value = "Policy ID or name", required = true)
- @PathParam("policy") String policyId);
-
- // TODO: Should be DELETE /policy, not POST /policy/destroy
- @POST
- @Path("/{policy}/destroy")
- @ApiOperation(value = "Destroy a policy", notes="Removes a policy from being associated with the entity and destroys it (stopping first if running)")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity or policy")
- })
- public Response destroy(
- @ApiParam(name = "application", value = "Application ID or name", required = true)
- @PathParam("application") String application,
-
- @ApiParam(name = "entity", value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
-
- @ApiParam(name = "policy", value = "Policy ID or name", required = true)
- @PathParam("policy") String policyToken);
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/PolicyConfigApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/PolicyConfigApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/PolicyConfigApi.java
deleted file mode 100644
index 79e1614..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/PolicyConfigApi.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.PolicyConfigSummary;
-import com.wordnik.swagger.core.ApiError;
-import com.wordnik.swagger.core.ApiErrors;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.util.List;
-import java.util.Map;
-
-@Path("/v1/applications/{application}/entities/{entity}/policies/{policy}/config")
-@Apidoc("Entity Policy Config")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface PolicyConfigApi {
-
- @GET
- @ApiOperation(value = "Fetch the config keys for a specific policy",
- responseClass = "brooklyn.rest.domain.ConfigSummary",
- multiValueResponse = true)
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application or entity or policy")
- })
- public List<PolicyConfigSummary> list(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") final String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") final String entityToken,
- @ApiParam(value = "Policy ID or name", required = true)
- @PathParam("policy") final String policyToken);
-
- // TODO support parameters ?show=value,summary&name=xxx &format={string,json,xml}
- // (and in sensors class)
- @GET
- @Path("/current-state")
- @ApiOperation(value = "Fetch config key values in batch", notes="Returns a map of config name to value")
- public Map<String, Object> batchConfigRead(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
- @ApiParam(value = "Policy ID or name", required = true)
- @PathParam("policy") String policyToken) ;
-
- @GET
- @Path("/{config}")
- @ApiOperation(value = "Fetch config value", responseClass = "Object")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity, policy or config key")
- })
- public String get(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
- @ApiParam(value = "Policy ID or name", required = true)
- @PathParam("policy") String policyToken,
- @ApiParam(value = "Config key ID", required = true)
- @PathParam("config") String configKeyName);
-
- /** @deprecated since 0.7.0 use set with object*/ @Deprecated
- @POST
- @Path("/{config}/set")
- @ApiOperation(value = "Sets the given config on this policy")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity, policy or config key")
- })
- public Response set(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
- @ApiParam(value = "Policy ID or name", required = true)
- @PathParam("policy") String policyToken,
- @ApiParam(value = "Config key ID", required = true)
- @PathParam("config") String configKeyName,
- @ApiParam(name = "value", value = "New value for the configuration", required = true)
- @QueryParam("value") String value);
-
- @POST
- @Path("/{config}")
- @ApiOperation(value = "Sets the given config on this policy")
- @ApiErrors(value = {
- @ApiError(code = 404, reason = "Could not find application, entity, policy or config key")
- })
- public Response set(
- @ApiParam(value = "Application ID or name", required = true)
- @PathParam("application") String application,
- @ApiParam(value = "Entity ID or name", required = true)
- @PathParam("entity") String entityToken,
- @ApiParam(value = "Policy ID or name", required = true)
- @PathParam("policy") String policyToken,
- @ApiParam(value = "Config key ID", required = true)
- @PathParam("config") String configKeyName,
- @ApiParam(name = "value", value = "New value for the configuration", required = true)
- Object value);
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/4c98f111/usage/rest-api/src/main/java/brooklyn/rest/api/ScriptApi.java
----------------------------------------------------------------------
diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/ScriptApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/ScriptApi.java
deleted file mode 100644
index 23e172f..0000000
--- a/usage/rest-api/src/main/java/brooklyn/rest/api/ScriptApi.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 brooklyn.rest.api;
-
-import brooklyn.rest.apidoc.Apidoc;
-import brooklyn.rest.domain.ScriptExecutionSummary;
-import com.wordnik.swagger.core.ApiOperation;
-import com.wordnik.swagger.core.ApiParam;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-
-@Path("/v1/script")
-@Apidoc(value="Scripting")
-@Produces(MediaType.APPLICATION_JSON)
-@Consumes(MediaType.APPLICATION_JSON)
-public interface ScriptApi {
-
- public static final String USER_DATA_MAP_SESSION_ATTRIBUTE = "brooklyn.script.groovy.user.data";
- public static final String USER_LAST_VALUE_SESSION_ATTRIBUTE = "brooklyn.script.groovy.user.last";
-
- @POST
- @Path("/groovy")
- @Consumes("application/text")
- @ApiOperation(value = "Execute a groovy script",
- responseClass = "brooklyn.rest.domain.SensorSummary")
- public ScriptExecutionSummary groovy(
- @Context HttpServletRequest request,
- @ApiParam(name = "script", value = "Groovy script to execute", required = true)
- String script);
-}