use of co.cask.cdap.common.security.AuditPolicy in project cdap by caskdata.
the class MetadataHttpHandler method addAppProperties.
@POST
@Path("/namespaces/{namespace-id}/apps/{app-id}/metadata/properties")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void addAppProperties(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId) throws BadRequestException, NotFoundException {
ApplicationId app = new ApplicationId(namespaceId, appId);
metadataAdmin.addProperties(app, readMetadata(request));
responder.sendString(HttpResponseStatus.OK, "Metadata added successfully to " + app);
}
use of co.cask.cdap.common.security.AuditPolicy in project cdap by caskdata.
the class MetadataHttpHandler method addStreamProperties.
@POST
@Path("/namespaces/{namespace-id}/streams/{stream-id}/metadata/properties")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void addStreamProperties(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("stream-id") String streamId) throws BadRequestException, NotFoundException {
StreamId stream = new StreamId(namespaceId, streamId);
metadataAdmin.addProperties(stream, readMetadata(request));
responder.sendString(HttpResponseStatus.OK, "Metadata added successfully to " + stream);
}
use of co.cask.cdap.common.security.AuditPolicy in project cdap by caskdata.
the class MetadataHttpHandler method addViewProperties.
@POST
@Path("/namespaces/{namespace-id}/streams/{stream-id}/views/{view-id}/metadata/properties")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void addViewProperties(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("stream-id") String streamId, @PathParam("view-id") String viewId) throws NotFoundException, BadRequestException {
StreamViewId view = new StreamViewId(namespaceId, streamId, viewId);
metadataAdmin.addProperties(view, readMetadata(request));
responder.sendString(HttpResponseStatus.OK, "Metadata added successfully to " + view);
}
use of co.cask.cdap.common.security.AuditPolicy in project cdap by caskdata.
the class DatasetInstanceHandler method update.
/**
* Updates an existing dataset specification properties.
*
* @param namespaceId namespace of the dataset instance
* @param name name of the dataset instance
* @throws Exception
*/
@PUT
@Path("/data/datasets/{name}/properties")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void update(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("name") String name) throws Exception {
DatasetId instance = ConversionHelpers.toDatasetInstanceId(namespaceId, name);
Map<String, String> properties = ConversionHelpers.getProperties(request);
instanceService.update(instance, properties);
responder.sendStatus(HttpResponseStatus.OK);
}
use of co.cask.cdap.common.security.AuditPolicy in project cdap by caskdata.
the class DatasetInstanceHandler method create.
/**
* Creates a new dataset instance.
*
* @param namespaceId namespace of the new dataset instance
* @param name name of the new dataset instance
*/
@PUT
@Path("/data/datasets/{name}")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void create(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("name") String name) throws Exception {
DatasetInstanceConfiguration creationProperties = ConversionHelpers.getInstanceConfiguration(request);
try {
instanceService.create(namespaceId, name, creationProperties);
responder.sendStatus(HttpResponseStatus.OK);
} catch (DatasetAlreadyExistsException e) {
responder.sendString(HttpResponseStatus.CONFLICT, e.getMessage());
} catch (DatasetTypeNotFoundException e) {
responder.sendString(HttpResponseStatus.NOT_FOUND, e.getMessage());
} catch (HandlerException e) {
responder.sendString(e.getFailureStatus(), e.getMessage());
}
}
Aggregations