Search in sources :

Example 11 with TopologySink

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));
}
Also used : TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET)

Example 12 with TopologySink

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());
}
Also used : TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET)

Example 13 with TopologySink

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);
}
Also used : TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Timed(com.codahale.metrics.annotation.Timed)

Example 14 with TopologySink

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);
}
Also used : TopologyTestRunCaseSink(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink) TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 15 with TopologySink

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);
}
Also used : TopologyTestRunCaseSink(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink) TopologySink(com.hortonworks.streamline.streams.catalog.TopologySink) Path(javax.ws.rs.Path) PUT(javax.ws.rs.PUT)

Aggregations

TopologySink (com.hortonworks.streamline.streams.catalog.TopologySink)16 Path (javax.ws.rs.Path)7 Timed (com.codahale.metrics.annotation.Timed)5 TopologyProcessor (com.hortonworks.streamline.streams.catalog.TopologyProcessor)5 TopologyTestRunCaseSink (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSink)5 TopologyTestRunCase (com.hortonworks.streamline.streams.catalog.TopologyTestRunCase)4 QueryParam (com.hortonworks.registries.common.QueryParam)3 StorableKey (com.hortonworks.registries.storage.StorableKey)3 WSUtils.buildEdgesFromQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam)3 WSUtils.buildEdgesToQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)3 WSUtils.currentVersionQueryParam (com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam)3 WSUtils.versionIdQueryParam (com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam)3 BaseTopologyRule (com.hortonworks.streamline.streams.catalog.BaseTopologyRule)2 TopologyBranchRule (com.hortonworks.streamline.streams.catalog.TopologyBranchRule)2 TopologyEdge (com.hortonworks.streamline.streams.catalog.TopologyEdge)2 TopologyRule (com.hortonworks.streamline.streams.catalog.TopologyRule)2 TopologySource (com.hortonworks.streamline.streams.catalog.TopologySource)2 TopologyTestRunCaseSource (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)2 TopologyWindow (com.hortonworks.streamline.streams.catalog.TopologyWindow)2 GET (javax.ws.rs.GET)2