private Resource toResource(ViewPermissionResponse viewPermissionResponse, Set<String> requestedIds) {

    Resource resource = new ResourceImpl(Resource.Type.ViewPermission);
    ViewPermissionResponse.ViewPermissionInfo viewPermissionInfo  = viewPermissionResponse.getViewPermissionInfo();
    setResourceProperty(resource, VIEW_NAME, viewPermissionInfo.getViewName(), requestedIds);
    setResourceProperty(resource, VERSION, viewPermissionInfo.getVersion(), requestedIds);

    setResourceProperty(resource, PERMISSION_ID, viewPermissionInfo.getPermissionId(), requestedIds);
    setResourceProperty(resource, PERMISSION_NAME, viewPermissionInfo.getPermissionName(), requestedIds);
    setResourceProperty(resource, RESOURCE_NAME, viewPermissionInfo.getResourceName(), requestedIds);

    return resource;
  }
Returns response schema instance for REST endpoint /views/{viewName}/versions/{version}/permissions
@param entity         permission entity {@link PermissionEntity}
@param resourceType   resource type {@link ResourceTypeEntity}
@param viewEntity     view entity {@link ViewEntity}
@return {@link ViewPermissionResponse}
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProvider.java