Search in sources :

Example 6 with Topology

use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.

the class TopologyActionResource method validateTopology.

@POST
@Path("/topologies/{topologyId}/actions/validate")
@Timed
public Response validateTopology(@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
    Topology result = catalogService.getTopology(topologyId);
    if (result != null) {
        // catalogService.validateTopology(SCHEMA, topologyId);
        return WSUtils.respondEntity(result, OK);
    }
    throw EntityNotFoundException.byId(topologyId.toString());
}
Also used : Topology(com.hortonworks.streamline.streams.catalog.Topology) Timed(com.codahale.metrics.annotation.Timed)

Example 7 with Topology

use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.

the class TopologyActionResource method deployTopologyVersion.

@POST
@Path("/topologies/{topologyId}/versions/{versionId}/actions/deploy")
@Timed
public Response deployTopologyVersion(@PathParam("topologyId") Long topologyId, @PathParam("versionId") Long versionId, @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
    Topology topology = catalogService.getTopology(topologyId, versionId);
    if (topology != null) {
        return deploy(topology, securityContext);
    }
    throw EntityNotFoundException.byVersion(topologyId.toString(), versionId.toString());
}
Also used : Topology(com.hortonworks.streamline.streams.catalog.Topology) Timed(com.codahale.metrics.annotation.Timed)

Example 8 with Topology

use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.

the class TopologyActionResource method resumeTopology.

@POST
@Path("/topologies/{topologyId}/actions/resume")
@Timed
public Response resumeTopology(@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
    Topology result = catalogService.getTopology(topologyId);
    if (result != null) {
        actionsService.resumeTopology(result, WSUtils.getUserFromSecurityContext(securityContext));
        return WSUtils.respondEntity(result, OK);
    }
    throw EntityNotFoundException.byId(topologyId.toString());
}
Also used : Topology(com.hortonworks.streamline.streams.catalog.Topology) Timed(com.codahale.metrics.annotation.Timed)

Example 9 with Topology

use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.

the class TopologyActionResource method deployTopology.

@POST
@Path("/topologies/{topologyId}/actions/deploy")
@Timed
public Response deployTopology(@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
    Topology topology = catalogService.getTopology(topologyId);
    if (topology != null) {
        return deploy(topology, securityContext);
    }
    throw EntityNotFoundException.byId(topologyId.toString());
}
Also used : Topology(com.hortonworks.streamline.streams.catalog.Topology) Timed(com.codahale.metrics.annotation.Timed)

Example 10 with Topology

use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.

the class TopologyActionResource method suspendTopologyVersion.

@POST
@Path("/topologies/{topologyId}/versions/{versionId}/actions/suspend")
@Timed
public Response suspendTopologyVersion(@PathParam("topologyId") Long topologyId, @PathParam("versionId") Long versionId, @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
    Topology result = catalogService.getTopology(topologyId, versionId);
    if (result != null) {
        actionsService.suspendTopology(result, WSUtils.getUserFromSecurityContext(securityContext));
        return WSUtils.respondEntity(result, OK);
    }
    throw EntityNotFoundException.byVersion(topologyId.toString(), versionId.toString());
}
Also used : Topology(com.hortonworks.streamline.streams.catalog.Topology) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

Topology (com.hortonworks.streamline.streams.catalog.Topology)67 Timed (com.codahale.metrics.annotation.Timed)39 Path (javax.ws.rs.Path)27 GET (javax.ws.rs.GET)17 IOException (java.io.IOException)12 TopologyActions (com.hortonworks.streamline.streams.actions.TopologyActions)9 TopologyTestRunHistory (com.hortonworks.streamline.streams.catalog.TopologyTestRunHistory)9 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)8 TopologyTestRunCase (com.hortonworks.streamline.streams.catalog.TopologyTestRunCase)8 List (java.util.List)8 Map (java.util.Map)8 POST (javax.ws.rs.POST)8 Expectations (mockit.Expectations)8 Test (org.junit.Test)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 TopologyComponent (com.hortonworks.streamline.streams.catalog.TopologyComponent)6 TopologyTestRunCaseSource (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)6 ArrayList (java.util.ArrayList)6 StreamCatalogService (com.hortonworks.streamline.streams.catalog.service.StreamCatalogService)5 Collections (java.util.Collections)5