use of io.cdap.cdap.api.metadata.MetadataEntity in project cdap by caskdata.
the class MetadataHttpHandler method removeProperties.
@DELETE
@Path("/**/metadata/properties")
public void removeProperties(HttpRequest request, HttpResponder responder, @QueryParam("type") String type, @QueryParam("async") @DefaultValue("false") Boolean async) throws Exception {
MetadataEntity metadataEntity = getMetadataEntityFromPath(request.uri(), type, "/metadata/properties");
enforce(metadataEntity, StandardPermission.UPDATE);
metadataAdmin.removeProperties(metadataEntity, async ? ASYNC : SYNC);
responder.sendString(HttpResponseStatus.OK, String.format("Metadata properties for %s deleted successfully.", metadataEntity));
}
use of io.cdap.cdap.api.metadata.MetadataEntity in project cdap by caskdata.
the class MetadataHttpHandler method removeTags.
@DELETE
@Path("/**/metadata/tags")
public void removeTags(HttpRequest request, HttpResponder responder, @QueryParam("type") String type, @QueryParam("async") @DefaultValue("false") Boolean async) throws Exception {
MetadataEntity metadataEntity = getMetadataEntityFromPath(request.uri(), type, "/metadata/tags");
enforce(metadataEntity, StandardPermission.UPDATE);
metadataAdmin.removeTags(metadataEntity, async ? ASYNC : SYNC);
responder.sendString(HttpResponseStatus.OK, String.format("Metadata tags for %s deleted successfully.", metadataEntity));
}
use of io.cdap.cdap.api.metadata.MetadataEntity in project cdap by caskdata.
the class MetadataHttpHandler method getTags.
@GET
@Path("/**/metadata/tags")
public void getTags(HttpRequest request, HttpResponder responder, @QueryParam("scope") String scope, @QueryParam("type") String type, @Nullable @QueryParam("responseFormat") @DefaultValue("v5") String responseFormat) throws Exception {
MetadataEntity entity = getMetadataEntityFromPath(request.uri(), type, "/metadata/tags");
if (isEntityType(entity)) {
accessEnforcer.enforce(EntityId.<EntityId>fromMetadataEntity(entity), authenticationContext.getPrincipal(), StandardPermission.GET);
}
MetadataScope theScope = validateScope(scope);
responder.sendJson(HttpResponseStatus.OK, GSON.toJson("v5".equals(responseFormat) ? (scope == null ? metadataAdmin.getTags(entity) : metadataAdmin.getTags(theScope, entity)) : metadataAdmin.getMetadata(entity, theScope, MetadataKind.TAG)));
}
use of io.cdap.cdap.api.metadata.MetadataEntity in project cdap by caskdata.
the class MetadataHttpHandler method addProperties.
@POST
@Path("/**/metadata/properties")
@AuditPolicy(AuditDetail.REQUEST_BODY)
public void addProperties(FullHttpRequest request, HttpResponder responder, @QueryParam("type") String type, @QueryParam("async") @DefaultValue("false") Boolean async) throws Exception {
MetadataEntity metadataEntity = getMetadataEntityFromPath(request.uri(), type, "/metadata/properties");
enforce(metadataEntity, StandardPermission.UPDATE);
metadataAdmin.addProperties(metadataEntity, readProperties(request), async ? ASYNC : SYNC);
responder.sendString(HttpResponseStatus.OK, String.format("Metadata properties for %s added successfully.", metadataEntity));
}
use of io.cdap.cdap.api.metadata.MetadataEntity in project cdap by caskdata.
the class MetadataHttpHandler method removeMetadata.
@DELETE
@Path("/**/metadata")
public void removeMetadata(HttpRequest request, HttpResponder responder, @QueryParam("type") String type, @QueryParam("async") @DefaultValue("false") Boolean async) throws Exception {
MetadataEntity metadataEntity = getMetadataEntityFromPath(request.uri(), type, "/metadata");
enforce(metadataEntity, StandardPermission.DELETE);
metadataAdmin.removeMetadata(metadataEntity, async ? ASYNC : SYNC);
responder.sendString(HttpResponseStatus.OK, String.format("Metadata for %s deleted successfully.", metadataEntity));
}
Aggregations