use of com.hortonworks.streamline.streams.catalog.TopologySink in project streamline by hortonworks.
the class TopologySinkCatalogResource method getTopologySinkById.
/**
* <p>
* Gets the 'CURRENT' version of specific topology sink by Id. For example,
* </p>
* <b>GET /api/v1/catalog/topologies/:TOPOLOGY_ID/sources/:SINK_ID</b>
* <pre>
* {
* "responseCode": 1000,
* "responseMessage": "Success",
* "entity": {
* "id": 1,
* "topologyId": 1,
* "name": "hbasesink",
* "config": {
* "properties": {
* "fsUrl": "hdfs://localhost:9000"
* }
* },
* "type": "HBASE"
* }
* }
* </pre>
*/
@GET
@Path("/topologies/{topologyId}/sinks/{id}")
@Timed
public Response getTopologySinkById(@PathParam("topologyId") Long topologyId, @PathParam("id") Long sinkId, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ);
TopologySink sink = catalogService.getTopologySink(topologyId, sinkId);
if (sink != null) {
return WSUtils.respondEntity(sink, OK);
}
throw EntityNotFoundException.byId(buildMessageForCompositeId(topologyId, sinkId));
}
use of com.hortonworks.streamline.streams.catalog.TopologySink in project streamline by hortonworks.
the class TopologySinkCatalogResource method getTopologySinkByIdAndVersion.
@GET
@Path("/topologies/{topologyId}/versions/{versionId}/sinks/{id}")
@Timed
public Response getTopologySinkByIdAndVersion(@PathParam("topologyId") Long topologyId, @PathParam("id") Long sourceId, @PathParam("versionId") Long versionId, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ);
TopologySink sink = catalogService.getTopologySink(topologyId, sourceId, versionId);
if (sink != null) {
return WSUtils.respondEntity(sink, OK);
}
throw EntityNotFoundException.byVersion(buildMessageForCompositeId(topologyId, sourceId), versionId.toString());
}
use of com.hortonworks.streamline.streams.catalog.TopologySink in project streamline by hortonworks.
the class TopologySinkCatalogResource method addTopologySink.
/**
* <p>
* Creates a topology sink. For example,
* </p>
* <b>POST /api/v1/catalog/topologies/:TOPOLOGY_ID/sinks</b>
* <pre>
* {
* "name": "hbasesink",
* "config": {
* "properties": {
* "fsUrl": "hdfs://localhost:9000"
* }
* },
* "type": "HBASE"
* }
* </pre>
* <i>Sample success response: </i>
* <pre>
* {
* "responseCode": 1000,
* "responseMessage": "Success",
* "entity": {
* "id": 1,
* "topologyId": 1,
* "name": "hbasesink",
* "config": {
* "properties": {
* "fsUrl": "hdfs://localhost:9000"
* }
* },
* "type": "HBASE"
* }
* }
* </pre>
*/
@POST
@Path("/topologies/{topologyId}/sinks")
@Timed
public Response addTopologySink(@PathParam("topologyId") Long topologyId, TopologySink topologySink, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyId, WRITE);
TopologySink createdSink = catalogService.addTopologySink(topologyId, topologySink);
return WSUtils.respondEntity(createdSink, CREATED);
}
use of com.hortonworks.streamline.streams.catalog.TopologySink in project streamline by hortonworks.
the class TopologyTestRunResource method addTestRunCaseSink.
@POST
@Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks")
public Response addTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, TopologyTestRunCaseSink testRunCaseSink, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE);
TopologySink topologySink = getAssociatedTopologySink(topologyId, testCaseId, testRunCaseSink.getSinkId());
testRunCaseSink.setVersionId(topologySink.getVersionId());
TopologyTestRunCaseSink addedCaseSink = catalogService.addTopologyTestRunCaseSink(testRunCaseSink);
return WSUtils.respondEntity(addedCaseSink, CREATED);
}
use of com.hortonworks.streamline.streams.catalog.TopologySink in project streamline by hortonworks.
the class TopologyTestRunResource method addOrUpdateTestRunCaseSink.
@PUT
@Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks/{id}")
public Response addOrUpdateTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @PathParam("id") Long id, TopologyTestRunCaseSink testRunCaseSink, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE);
testRunCaseSink.setId(id);
testRunCaseSink.setTestCaseId(testCaseId);
TopologySink topologySink = getAssociatedTopologySink(topologyId, testCaseId, testRunCaseSink.getSinkId());
testRunCaseSink.setVersionId(topologySink.getVersionId());
TopologyTestRunCaseSink updatedCase = catalogService.addOrUpdateTopologyTestRunCaseSink(testRunCaseSink.getId(), testRunCaseSink);
return WSUtils.respondEntity(updatedCase, OK);
}
Aggregations