use of io.cdap.cdap.proto.id.ProfileId in project cdap by caskdata.
the class ProfileHttpHandler method enableSystemProfile.
@POST
@Path("/profiles/{profile-name}/enable")
public void enableSystemProfile(HttpRequest request, HttpResponder responder, @PathParam("profile-name") String profileName) throws Exception {
ProfileId profileId = getValidatedProfile(NamespaceId.SYSTEM, profileName);
accessEnforcer.enforce(profileId, authenticationContext.getPrincipal(), StandardPermission.UPDATE);
profileService.enableProfile(profileId);
responder.sendStatus(HttpResponseStatus.OK);
}
use of io.cdap.cdap.proto.id.ProfileId in project cdap by caskdata.
the class ProfileHttpHandler method getProfile.
/**
* Get the information about a specific profile.
*/
@GET
@Path("/namespaces/{namespace-id}/profiles/{profile-name}")
public void getProfile(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("profile-name") String profileName) throws Exception {
ProfileId profileId = getValidatedProfile(namespaceId, profileName);
accessEnforcer.enforce(profileId, authenticationContext.getPrincipal(), StandardPermission.GET);
responder.sendJson(HttpResponseStatus.OK, GSON.toJson(verifyCpuLabelsProfile(profileService.getProfile(profileId), profileId)));
}
use of io.cdap.cdap.proto.id.ProfileId in project cdap by caskdata.
the class ProfileHttpHandler method deleteSystemProfile.
@DELETE
@Path("/profiles/{profile-name}")
public void deleteSystemProfile(HttpRequest request, HttpResponder responder, @PathParam("profile-name") String profileName) throws Exception {
ProfileId profileId = getValidatedProfile(NamespaceId.SYSTEM, profileName);
accessEnforcer.enforce(profileId, authenticationContext.getPrincipal(), StandardPermission.DELETE);
profileService.deleteProfile(getValidatedProfile(NamespaceId.SYSTEM, profileName));
responder.sendStatus(HttpResponseStatus.OK);
}
use of io.cdap.cdap.proto.id.ProfileId in project cdap by caskdata.
the class ProfileHttpHandler method disableSystemProfile.
@POST
@Path("/profiles/{profile-name}/disable")
public void disableSystemProfile(HttpRequest request, HttpResponder responder, @PathParam("profile-name") String profileName) throws Exception {
ProfileId profileId = getValidatedProfile(NamespaceId.SYSTEM, profileName);
accessEnforcer.enforce(profileId, authenticationContext.getPrincipal(), StandardPermission.UPDATE);
profileService.disableProfile(getValidatedProfile(NamespaceId.SYSTEM, profileName));
responder.sendStatus(HttpResponseStatus.OK);
}
use of io.cdap.cdap.proto.id.ProfileId in project cdap by caskdata.
the class ProfileHttpHandler method getProfileStatus.
@GET
@Path("/namespaces/{namespace-id}/profiles/{profile-name}/status")
public void getProfileStatus(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("profile-name") String profileName) throws Exception {
ProfileId profileId = getValidatedProfile(namespaceId, profileName);
accessEnforcer.enforce(profileId, authenticationContext.getPrincipal(), StandardPermission.GET);
responder.sendJson(HttpResponseStatus.OK, GSON.toJson(profileService.getProfile(profileId).getStatus()));
}
Aggregations