Search in sources :

Example 6 with MethodArgument

use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.

the class RemoteLineageWriterHandler method addDatasetAccess.

@POST
@Path("/addDatasetAccess")
public void addDatasetAccess(HttpRequest request, HttpResponder responder) throws Exception {
    Iterator<MethodArgument> arguments = parseArguments(request);
    ProgramRunId run = deserializeNext(arguments);
    DatasetId datasetInstance = deserializeNext(arguments);
    AccessType accessType = deserializeNext(arguments);
    NamespacedEntityId component = deserializeNext(arguments);
    lineageWriter.addAccess(run, datasetInstance, accessType, component);
    responder.sendStatus(HttpResponseStatus.OK);
}
Also used : NamespacedEntityId(co.cask.cdap.proto.id.NamespacedEntityId) MethodArgument(co.cask.cdap.common.internal.remote.MethodArgument) ProgramRunId(co.cask.cdap.proto.id.ProgramRunId) AccessType(co.cask.cdap.data2.metadata.lineage.AccessType) DatasetId(co.cask.cdap.proto.id.DatasetId) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 7 with MethodArgument

use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.

the class RemotePrivilegesHandler method grant.

@POST
@Path("/grant")
public void grant(HttpRequest request, HttpResponder responder) throws Exception {
    Iterator<MethodArgument> arguments = parseArguments(request);
    EntityId entityId = deserializeNext(arguments);
    Principal principal = deserializeNext(arguments);
    Set<Action> actions = deserializeNext(arguments, SET_OF_ACTIONS);
    LOG.trace("Granting {} on {} to {}", actions, entityId, principal);
    privilegesManager.grant(entityId, principal, actions);
    LOG.info("Granted {} on {} to {} successfully", actions, entityId, principal);
    responder.sendStatus(HttpResponseStatus.OK);
}
Also used : EntityId(co.cask.cdap.proto.id.EntityId) Action(co.cask.cdap.proto.security.Action) MethodArgument(co.cask.cdap.common.internal.remote.MethodArgument) Principal(co.cask.cdap.proto.security.Principal) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 8 with MethodArgument

use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.

the class RemotePrivilegesHandler method revoke.

@POST
@Path("/revoke")
public void revoke(HttpRequest request, HttpResponder responder) throws Exception {
    Iterator<MethodArgument> arguments = parseArguments(request);
    EntityId entityId = deserializeNext(arguments);
    Principal principal = deserializeNext(arguments);
    Set<Action> actions = deserializeNext(arguments, SET_OF_ACTIONS);
    LOG.trace("Revoking {} on {} from {}", actions, entityId, principal);
    privilegesManager.revoke(entityId, principal, actions);
    LOG.info("Revoked {} on {} from {} successfully", actions, entityId, principal);
    responder.sendStatus(HttpResponseStatus.OK);
}
Also used : EntityId(co.cask.cdap.proto.id.EntityId) Action(co.cask.cdap.proto.security.Action) MethodArgument(co.cask.cdap.common.internal.remote.MethodArgument) Principal(co.cask.cdap.proto.security.Principal) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 9 with MethodArgument

use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.

the class RemotePrivilegesHandler method revokeAll.

@POST
@Path("/revokeAll")
public void revokeAll(HttpRequest request, HttpResponder responder) throws Exception {
    Iterator<MethodArgument> arguments = parseArguments(request);
    EntityId entityId = deserializeNext(arguments);
    LOG.trace("Revoking all actions on {}", entityId);
    privilegesManager.revoke(entityId);
    LOG.info("Revoked all actions on {} successfully", entityId);
    responder.sendStatus(HttpResponseStatus.OK);
}
Also used : EntityId(co.cask.cdap.proto.id.EntityId) MethodArgument(co.cask.cdap.common.internal.remote.MethodArgument) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 10 with MethodArgument

use of co.cask.cdap.common.internal.remote.MethodArgument in project cdap by caskdata.

the class RemoteUsageRegistryHandler method registerDataset.

@POST
@Path("/registerDataset")
public void registerDataset(HttpRequest request, HttpResponder responder) throws Exception {
    Iterator<MethodArgument> arguments = parseArguments(request);
    ProgramId programId = deserializeNext(arguments);
    DatasetId datasetInstance = deserializeNext(arguments);
    usageRegistry.register(programId, datasetInstance);
    responder.sendStatus(HttpResponseStatus.OK);
}
Also used : MethodArgument(co.cask.cdap.common.internal.remote.MethodArgument) ProgramId(co.cask.cdap.proto.id.ProgramId) DatasetId(co.cask.cdap.proto.id.DatasetId) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Aggregations

MethodArgument (co.cask.cdap.common.internal.remote.MethodArgument)25 POST (javax.ws.rs.POST)24 Path (javax.ws.rs.Path)24 ProgramId (co.cask.cdap.proto.id.ProgramId)8 ProgramRunId (co.cask.cdap.proto.id.ProgramRunId)8 EntityId (co.cask.cdap.proto.id.EntityId)6 Principal (co.cask.cdap.proto.security.Principal)6 AccessType (co.cask.cdap.data2.metadata.lineage.AccessType)4 DatasetId (co.cask.cdap.proto.id.DatasetId)4 NamespacedEntityId (co.cask.cdap.proto.id.NamespacedEntityId)4 StreamId (co.cask.cdap.proto.id.StreamId)4 Action (co.cask.cdap.proto.security.Action)4 WorkflowToken (co.cask.cdap.api.workflow.WorkflowToken)2 WorkflowNodeStateDetail (co.cask.cdap.proto.WorkflowNodeStateDetail)2 AuthorizationPrivilege (co.cask.cdap.proto.security.AuthorizationPrivilege)2 Privilege (co.cask.cdap.proto.security.Privilege)2 BadRequestException (co.cask.cdap.common.BadRequestException)1 BasicThrowable (co.cask.cdap.proto.BasicThrowable)1 ProgramRunStatus (co.cask.cdap.proto.ProgramRunStatus)1 JsonElement (com.google.gson.JsonElement)1