Added rules for resource-registry

This commit is contained in:
Luca Frosini 2020-03-12 19:47:10 +01:00
parent e151b63f09
commit 1deed3256b
7 changed files with 721 additions and 17 deletions

1
allRules-min.json Normal file

File diff suppressed because one or more lines are too long

717
allRules.json Normal file
View File

@ -0,0 +1,717 @@
[{
"match": {
"serviceClassRegex": "Common",
"serviceNameRegex": "AuthorizationService",
"calledMethodRegex": "^/{0,1}gcube/service/generate.*"
},
"replace": {
"serviceClass": "Common",
"serviceName": "AuthorizationService",
"calledMethod": "generate"
}
},{
"match": {
"serviceClassRegex": "Common",
"serviceNameRegex": "AuthorizationService",
"calledMethodRegex": "^/{0,1}gcube/service/retrieve.*"
},
"replace": {
"serviceClass": "Common",
"serviceName": "AuthorizationService",
"calledMethod": "retrieve"
}
},{
"match": {
"serviceClassRegex": "Common",
"serviceNameRegex": "AuthorizationService",
"calledMethodRegex": "^((e\/)|\/){0,1}gcube\/resource\/scopes"
},
"replace": {
"serviceClass": "Common",
"serviceName": "AuthorizationService",
"calledMethod": "scopes"
}
},{
"match": {
"serviceClassRegex": "Data-Catalogue",
"serviceNameRegex": "Catalogue-WS",
"calledMethodRegex": "^\/rest\/(api\/){0,1}licenses\/list"
},
"replace": {
"serviceClass": "Data-Catalogue",
"serviceName": "Catalogue-WS",
"calledMethod": "/rest/api/licenses/list"
}
},{
"match": {
"serviceClassRegex": "Data-Catalogue",
"serviceNameRegex": "Catalogue-WS",
"calledMethodRegex": "^\/rest\/api\/organi(s|z)ation(s){0,1}\/list"
},
"replace": {
"serviceClass": "Data-Catalogue",
"serviceName": "Catalogue-WS",
"calledMethod": "/rest/api/organizations/list"
}
},{
"match": {
"serviceClassRegex": "Data-Catalogue",
"serviceNameRegex": "Catalogue-WS",
"calledMethodRegex": "^\/rest$|^UNKNOWN|^OTHER$"
},
"replace": {
"serviceClass": "Data-Catalogue",
"serviceName": "Catalogue-WS",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "DataAccess",
"serviceNameRegex": "CkanConnector",
"calledMethodRegex": "^\/{0,1}gcube\/service\/connect.*"
},
"replace": {
"serviceClass": "DataAccess",
"serviceName": "CkanConnector",
"calledMethod": "connect"
}
},{
"match": {
"serviceClassRegex": "DataAccess",
"serviceNameRegex": "CkanConnector",
"calledMethodRegex": "^\/{0,1}gcube\/service\/disconnect.*"
},
"replace": {
"serviceClass": "DataAccess",
"serviceName": "CkanConnector",
"calledMethod": "disconnect"
}
},{
"match": {
"serviceClassRegex": "WPS",
"serviceNameRegex": "DataMiner",
"calledMethodRegex": "^/{0,1}DescribeProcess.*"
},
"replace": {
"serviceClass": "WPS",
"serviceName": "DataMiner",
"calledMethod": "describeProcess"
}
},{
"match": {
"serviceClassRegex": "WPS",
"serviceNameRegex": "DataMiner",
"calledMethodRegex": "^/{0,1}GetCapabilities.*"
},
"replace": {
"serviceClass": "WPS",
"serviceName": "DataMiner",
"calledMethod": "getCapabilities"
}
},{
"match": {
"serviceClassRegex": "WPS",
"serviceNameRegex": "DataMiner",
"calledMethodRegex": "^/{0,1}RetrieveResult.*"
},
"replace": {
"serviceClass": "WPS",
"serviceName": "DataMiner",
"calledMethod": "getResult"
}
},{
"match": {
"serviceClassRegex": "WPS",
"serviceNameRegex": "DataMiner",
"calledMethodRegex": "^/{0,1}(WebProcessingService|UNKNOWN|OTHER|gcube\/resource\/scopes).*"
},
"replace": {
"serviceClass": "WPS",
"serviceName": "DataMiner",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "WPS",
"serviceNameRegex": "DataMiner",
"calledMethodRegex": "^/{0,1}CancelComputation.*"
},
"replace": {
"serviceClass": "WPS",
"serviceName": "DataMiner",
"calledMethod": "stop"
}
},{
"match": {
"serviceClassRegex": "DataTransfer",
"serviceNameRegex": "data-transfer-service",
"calledMethodRegex": ".*Capabilities.*"
},
"replace": {
"serviceClass": "DataTransfer",
"serviceName": "data-transfer-service",
"calledMethod": "getCapabilities"
}
},{
"match": {
"serviceClassRegex": "DataTransfer",
"serviceNameRegex": "data-transfer-service",
"calledMethodRegex": ".*FileUpload.*"
},
"replace": {
"serviceClass": "DataTransfer",
"serviceName": "data-transfer-service",
"calledMethod": "upload"
}
},{
"match": {
"serviceClassRegex": "Index",
"serviceNameRegex": "FullTextIndexNode",
"calledMethodRegex": "^\/{0,1}delete.*"
},
"replace": {
"serviceClass": "Index",
"serviceName": "FullTextIndexNode",
"calledMethod": "delete"
}
},{
"match": {
"serviceClassRegex": "Index",
"serviceNameRegex": "FullTextIndexNode",
"calledMethodRegex": "^\/{0,1}dropCollection.*"
},
"replace": {
"serviceClass": "Index",
"serviceName": "FullTextIndexNode",
"calledMethod": "dropCollection"
}
},{
"match": {
"serviceClassRegex": "Index",
"serviceNameRegex": "FullTextIndexNode",
"calledMethodRegex": "^\/{0,1}insert.*"
},
"replace": {
"serviceClass": "Index",
"serviceName": "FullTextIndexNode",
"calledMethod": "insert"
}
},{
"match": {
"serviceClassRegex": "Index",
"serviceNameRegex": "FullTextIndexNode",
"calledMethodRegex": "^\/{0,1}listCollections.*"
},
"replace": {
"serviceClass": "Index",
"serviceName": "FullTextIndexNode",
"calledMethod": "listCollections"
}
},{
"match": {
"serviceClassRegex": "Index",
"serviceNameRegex": "FullTextIndexNode",
"calledMethodRegex": "^\/{0,1}search.*"
},
"replace": {
"serviceClass": "Index",
"serviceName": "FullTextIndexNode",
"calledMethod": "search"
}
},{
"match": {
"serviceClassRegex": "geoanalytics",
"serviceNameRegex": "geoanalytics-gos",
"calledMethodRegex": ".*GeoserverManagement.*"
},
"replace": {
"serviceClass": "geoanalytics",
"serviceName": "geoanalytics-gos",
"calledMethod": "GeoserverManagement"
}
},{
"match": {
"serviceClassRegex": "geoanalytics",
"serviceNameRegex": "geoanalytics-gos",
"calledMethodRegex": ".*ShapeManagement.*"
},
"replace": {
"serviceClass": "geoanalytics",
"serviceName": "geoanalytics-gos",
"calledMethod": "ShapeManagement"
}
},{
"match": {
"serviceClassRegex": "geoanalytics",
"serviceNameRegex": "geoanalytics-main-service",
"calledMethodRegex": ".*"
},
"replace": {
"serviceClass": "geoanalytics",
"serviceName": "geoanalytics-main-service",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "GeoNetwork",
"calledMethodRegex": ".*(\\.create(\\.form){0,1}|\\.insert|\\.xmlinsert\\.form)$"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "GeoNetwork",
"calledMethod": "create"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "GeoNetwork",
"calledMethodRegex": ".*(\\.delete(\\.batch|@json|$))"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "GeoNetwork",
"calledMethod": "delete"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "GeoNetwork",
"calledMethodRegex": ".*(\\.list(@json|$))"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "GeoNetwork",
"calledMethod": "list"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "GeoNetwork",
"calledMethodRegex": "^(?!.*(read|create|insert|delete|list|get|show|info|search|update|edit)).*$|^(.*(updated|editors|pwupdate|(systeminfo.*)|forget-password|getmap.png|(GetCapabilities.*)|(\/codelists\/.*)))$"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "GeoNetwork",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "GeoNetwork",
"calledMethodRegex": ".*(\\.get(\\..*|\/.*|$)|\\.show(\\..*|$)|((\\.|/)info(\\..*|\\.*|@json|$)))"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "GeoNetwork",
"calledMethod": "read"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "GeoNetwork",
"calledMethodRegex": ".*(\\.|-|/|package_|open)search(\/.*|unused(.form){0,1}|\\..*|;jsessionid=.*|-.*|$)"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "GeoNetwork",
"calledMethod": "search"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "GeoNetwork",
"calledMethodRegex": ".*(\\.update($|\\.finish)|\\.edit(!{0,1}|\\.save(only){0,1}|\\.commit)$|\\.infoedit$|\\.pwedit$)"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "GeoNetwork",
"calledMethod": "update"
}
},{
"match": {
"serviceClassRegex": "(GeoServer)|(geoserver)|(SpatialData)",
"serviceNameRegex": "(GeoServer)|(geoserver)",
"calledMethodRegex": "^(?!.*\/(wfs|wms|wcs|wmts)).*$"
},
"replace": {
"serviceClass": "GeoServer",
"serviceName": "GeoServer",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "(GeoServer)|(geoserver)|(SpatialData)",
"serviceNameRegex": "(GeoServer)|(geoserver)",
"calledMethodRegex": "^.*\/(?<Protocol>(wfs|wms|wcs|wmts)).*$"
},
"replace": {
"serviceClass": "GeoServer",
"serviceName": "GeoServer",
"calledMethod": "/${Protocol}",
"_comment" : "Do not remove the initial / to avoid that wms is replaced with OTHER"
}
},{
"match": {
"serviceClassRegex": "Data-Catalogue",
"serviceNameRegex": "GRSFPublisher",
"calledMethodRegex": ".*publish-product.*"
},
"replace": {
"serviceClass": "Data-Catalogue",
"serviceName": "GRSFPublisher",
"calledMethod": "create"
}
},{
"match": {
"serviceClassRegex": "Data-Catalogue",
"serviceNameRegex": "GRSFPublisher",
"calledMethodRegex": ".*delete-product.*"
},
"replace": {
"serviceClass": "Data-Catalogue",
"serviceName": "GRSFPublisher",
"calledMethod": "delete"
}
},{
"match": {
"serviceClassRegex": "Data-Catalogue",
"serviceNameRegex": "GRSFPublisher",
"calledMethodRegex": ".*get-catalogue-id-(and-url-){0,1}from-name.*"
},
"replace": {
"serviceClass": "Data-Catalogue",
"serviceName": "GRSFPublisher",
"calledMethod": "getURLandIdFromName"
}
},{
"match": {
"serviceClassRegex": "Data-Catalogue",
"serviceNameRegex": "GRSFPublisher",
"calledMethodRegex": ".*(hello)|(UNKNOWN)|(OTHER).*"
},
"replace": {
"serviceClass": "Data-Catalogue",
"serviceName": "GRSFPublisher",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "Data-Catalogue",
"serviceNameRegex": "GRSFPublisher",
"calledMethodRegex": ".*update-product.*"
},
"replace": {
"serviceClass": "Data-Catalogue",
"serviceName": "GRSFPublisher",
"calledMethod": "update"
}
},{
"match": {
"serviceClassRegex": "DataAnalysis",
"serviceNameRegex": "RConnector",
"calledMethodRegex": "^\/{0,1}gcube\/service\/connect.*"
},
"replace": {
"serviceClass": "DataAnalysis",
"serviceName": "RConnector",
"calledMethod": "connect"
}
},{
"match": {
"serviceClassRegex": "DataAnalysis",
"serviceNameRegex": "RConnector",
"calledMethodRegex": "UNKNOWN|OTHER|^\/{0,1}gcube\/resource\/scopes"
},
"replace": {
"serviceClass": "DataAnalysis",
"serviceName": "RConnector",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "InformationSystem",
"serviceNameRegex": "resource-registry",
"calledMethodRegex": "^(?!(GET|HEAD|POST|PUT|DELETE|PURGE|OPTIONS|TRACE|CONNECT))\/.*"
},
"replace": {
"serviceClass": "InformationSystem",
"serviceName": "resource-registry",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "DataAccess",
"serviceNameRegex": "ShareLatex",
"calledMethodRegex": "^\/{0,1}gcube\/service\/connect.*"
},
"replace": {
"serviceClass": "DataAccess",
"serviceName": "ShareLatex",
"calledMethod": "connect"
}
},{
"match": {
"serviceClassRegex": "DataAccess",
"serviceNameRegex": "ShareLatex",
"calledMethodRegex": "^\/{0,1}gcube\/service\/disconnect.*"
},
"replace": {
"serviceClass": "DataAccess",
"serviceName": "ShareLatex",
"calledMethod": "disconnect"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*BroodstockQuality.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "BroodstockQuality"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*CurrentRating.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "CurrentRating"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*FeedQuality.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "FeedQuality"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*Modeler.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "Modeler"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*Called Method.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*OxygenRating.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "OxygenRating"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*Region.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "Region"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*Scenario.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "Scenario"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*Site.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "Site"
}
},{
"match": {
"serviceClassRegex": "Search",
"serviceNameRegex": "SimulFishGrowthData",
"calledMethodRegex": ".*Species.*"
},
"replace": {
"serviceClass": "Search",
"serviceName": "SimulFishGrowthData",
"calledMethod": "Species"
}
},{
"match": {
"serviceClassRegex": "VREManagement",
"serviceNameRegex": "(SmartExecutor)|(smart-executor)",
"calledMethodRegex": ".*((launch)|(execute)|(POST .*executions)).*"
},
"replace": {
"serviceClass": "VREManagement",
"serviceName": "smart-executor",
"calledMethod": "execute"
}
},{
"match": {
"serviceClassRegex": "VREManagement",
"serviceNameRegex": "(SmartExecutor)|(smart-executor)",
"calledMethodRegex": ".*((getAvailablePlugins.*)|(GET \/plugins(\/){0,1}$))"
},
"replace": {
"serviceClass": "VREManagement",
"serviceName": "smart-executor",
"calledMethod": "getAvailablePlugins"
}
},{
"match": {
"serviceClassRegex": "VREManagement",
"serviceNameRegex": "(SmartExecutor)|(smart-executor)",
"calledMethodRegex": ".*((getScheduledExecution.*)|(GET .*executions(\/){0,1}$))"
},
"replace": {
"serviceClass": "VREManagement",
"serviceName": "smart-executor",
"calledMethod": "getScheduledExecution"
}
},{
"match": {
"serviceClassRegex": "VREManagement",
"serviceNameRegex": "(SmartExecutor)|(smart-executor)",
"calledMethodRegex": ".*((getStateEvolution)|(getState)|(GET .*executions\/.{1,})).*"
},
"replace": {
"serviceClass": "VREManagement",
"serviceName": "smart-executor",
"calledMethod": "getState"
}
},{
"match": {
"serviceClassRegex": "VREManagement",
"serviceNameRegex": "(SmartExecutor)|(smart-executor)",
"calledMethodRegex": ".*(UNKNOWN)|(OTHER).*"
},
"replace": {
"serviceClass": "VREManagement",
"serviceName": "smart-executor",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "VREManagement",
"serviceNameRegex": "(SmartExecutor)|(smart-executor)",
"calledMethodRegex": ".*((stop)|(unSchedule)|(DELETE)|(PURGE)).*"
},
"replace": {
"serviceClass": "VREManagement",
"serviceName": "smart-executor",
"calledMethod": "stop"
}
},{
"match": {
"serviceClassRegex": "content-management",
"serviceNameRegex": "storage",
"calledMethodRegex": ".*"
},
"replace": {
"serviceClass": "content-management",
"serviceName": "storage",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "Application|DataAnalysis",
"serviceNameRegex": "TagMe",
"calledMethodRegex": "^((e\/)|\/){0,1}tag"
},
"replace": {
"serviceClass": "Application",
"serviceName": "TagMe",
"calledMethod": "tag"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "Thredds",
"calledMethodRegex": "^(\/){1}(?<Protocol>[a-zA-Z0-9]*){1}(\/public\/netcdf\/){1}(?<Collection>[a-zA-Z0-9_-]*(?<!(..\\.nc)))(\/){1}.*(?<!(..\\.nc|.\\.asc|\\.tiff))$"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "Thredds",
"calledMethod": "METADATA::${Collection}"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "Thredds",
"calledMethodRegex": "^(\/){1}(?<Protocol>[a-zA-Z0-9]*){1}(\/public\/netcdf\/){1}[^\/]*((?<!(..\\.nc|.\\.asc|\\.tiff))|\/wfs)$"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "Thredds",
"calledMethod": "METADATA::OTHER"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "Thredds",
"calledMethodRegex": "^(?!.*((\/public\/netcdf\/)|(::))).*$"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "Thredds",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "Thredds",
"calledMethodRegex": "^(\/){1}(?<Protocol>[a-zA-Z0-9]*){1}(\/public\/netcdf\/){1}(?<Collection>[a-zA-Z0-9_-]*)(\/){1}(.*\\.(nc|asc|tiff))$"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "Thredds",
"calledMethod": "${Protocol}::${Collection}"
}
},{
"match": {
"serviceClassRegex": "SDI",
"serviceNameRegex": "Thredds",
"calledMethodRegex": "^(\/){1}(?<Protocol>[a-zA-Z0-9]*){1}(\/public\/netcdf\/){1}[^\/]*(\\.(nc|asc|tiff))$"
},
"replace": {
"serviceClass": "SDI",
"serviceName": "Thredds",
"calledMethod": "${Protocol}::OTHER"
}
}]

View File

@ -211,8 +211,8 @@ public class TestRules extends ContextTest {
public void testSingleRule() throws Exception {
allRules();
File rulesDirectory = getRulesDirectory();
File rulesDirFile = new File(rulesDirectory, "GeoNetwork");
File rulesFile = new File(rulesDirFile, "GeoNetwork-read.json");
File rulesDirFile = new File(rulesDirectory, "resource-registry");
File rulesFile = new File(rulesDirFile, "resource-registry-OTHER.json");
testRule(rulesFile);
}

View File

@ -1,13 +0,0 @@
{
"match" : {
"serviceClassRegex": "Common",
"serviceNameRegex": "AuthorizationService",
"calledMethodRegex": "^\/{0,1}gcube\/service\/generate.*"
},
"replace": {
"calledMethod": "generate",
"serviceClass": "Common",
"serviceName": "AuthorizationService"
}
}

View File

@ -9,4 +9,4 @@
"serviceName": "Catalogue-WS",
"calledMethod": "/rest/api/organizations/list"
}
}
}

View File

@ -1 +0,0 @@
{"recordType":"StorageUsageRecord","operationCount":1,"creationTime":1568579864273,"consumerId":"gCubeSocialFramework","resourceOwner":"gCubeSocialFramework","dataType":"STORAGE","providerURI":"data.d4science.org","resourceURI":"5d7ea11702cadc2c31b17af0","aggregated":true,"resourceScope":"/d4science.research-infrastructures.eu/D4Research/RAKIP_portal","dataVolume":2328,"scope":"/d4science.research-infrastructures.eu/D4Research/RAKIP_portal","operationType":"CREATE","startTime":1568579864272,"id":"999eb4ca-1f6c-43d1-879a-d91855e3a1c8","endTime":1568579864272,"operationResult":"SUCCESS"}