Skip to content

Instantly share code, notes, and snippets.

@nsabharwal
Created June 14, 2020 00:49
Show Gist options
  • Save nsabharwal/61ec14720dfea20725d7302bc14e5e51 to your computer and use it in GitHub Desktop.
Save nsabharwal/61ec14720dfea20725d7302bc14e5e51 to your computer and use it in GitHub Desktop.
service def test
[ec2-user@ip-172-31-3-208 nifi]$ cat privacera_nifi.json
{
"isEnabled": "true",
"type": "nifi",
"configs": {
"username": "nifi"
},
"name": "privacera_nifi",
"description": "nifi repo"
}
[ec2-user@ip-172-31-3-208 nifi]$
[ec2-user@ip-172-31-3-208 nifi]$ cat nifiservicedef.json
{
"id":10,
"name":"nifi",
"implClass":"org.apache.ranger.services.nifi.RangerServiceNiFi",
"label":"privacera_nifi",
"description":"NiFi",
"resources":[
{
"itemId":100,
"name":"nifi-resource",
"type":"string",
"level":10,
"parent":"",
"mandatory":true,
"lookupSupported":true,
"recursiveSupported":false,
"excludesSupported":true,
"matcher":"org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher",
"matcherOptions":{
"wildCard":true,
"ignoreCase":true
},
"validationRegEx":"",
"validationMessage":"",
"uiHint":"",
"label":"NiFi Resource Identifier",
"description":"NiFi Resource"
}
],
"accessTypes":[
{
"itemId":100,
"name":"READ",
"label":"Read"
},
{
"itemId":200,
"name":"WRITE",
"label":"Write"
}
],
"configs":[
{
"itemId":400,
"name":"nifi.url",
"type":"string",
"mandatory":true,
"defaultValue":"https://localhost:9443/nifi-api/resources",
"validationRegEx":"",
"validationMessage":"",
"uiHint":"The URL of the NiFi REST API that provides the available resources.",
"label":"NiFi URL"
},
{
"itemId": 410,
"name": "nifi.authentication",
"type": "enum",
"subType": "authType",
"mandatory": true,
"validationRegEx":"",
"validationMessage": "",
"uiHint":"",
"label": "Authentication Type",
"defaultValue": "NONE"
},
{
"itemId":500,
"name":"nifi.ssl.keystore",
"type":"string",
"mandatory":false,
"defaultValue":"",
"validationRegEx":"",
"validationMessage":"",
"uiHint":"",
"label":"Keystore"
},
{
"itemId":510,
"name":"nifi.ssl.keystoreType",
"type":"string",
"mandatory":false,
"defaultValue":"",
"validationRegEx":"",
"validationMessage":"",
"uiHint":"",
"label":"Keystore Type"
},
{
"itemId":520,
"name":"nifi.ssl.keystorePassword",
"type":"password",
"mandatory":false,
"defaultValue":"",
"validationRegEx":"",
"validationMessage":"",
"uiHint":"",
"label":"Keystore Password"
},
{
"itemId":530,
"name":"nifi.ssl.truststore",
"type":"string",
"mandatory":false,
"defaultValue":"",
"validationRegEx":"",
"validationMessage":"",
"uiHint":"",
"label":"Truststore"
},
{
"itemId":540,
"name":"nifi.ssl.truststoreType",
"type":"string",
"mandatory":false,
"defaultValue":"",
"validationRegEx":"",
"validationMessage":"",
"uiHint":"",
"label":"Truststore Type"
},
{
"itemId":550,
"name":"nifi.ssl.truststorePassword",
"type":"password",
"mandatory":false,
"defaultValue":"",
"validationRegEx":"",
"validationMessage":"",
"uiHint":"",
"label":"Truststore Password"
}
],
"enums":
[
{
"itemId": 1,
"name": "authType",
"elements":
[
{
"itemId": 1,
"name": "NONE",
"label": "None"
},
{
"itemId": 2,
"name": "SSL",
"label": "SSL"
}
],
"defaultIndex": 0
}
],
"contextEnrichers":[
],
"policyConditions":[
]
}
[ec2-user@ip-172-31-3-208 nifi]$
[ec2-user@ip-172-31-3-208 nifi]$ curl -i -L -k -u admin:${RANGER_ADMIN_PASSWORD} -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d@${SERVICE_NAME}servicedef.json $RANGER_URL/service/public/v2/api/servicedef
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Set-Cookie: RANGERADMINSESSIONID=F70E86042F28FBAB39F48AFE119F8B60; Path=/; HttpOnly
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy: default-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline';font-src 'self'
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Content-Type-Options: nosniff
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sun, 14 Jun 2020 00:44:07 GMT
Server: Apache Ranger
{"id":115,"guid":"d030f8bd-ce16-439c-9633-ed8f3470bc01","isEnabled":true,"createdBy":"Admin","updatedBy":"Admin","createTime":1592095447177,"updateTime":1592095447177,"version":1,"name":"nifi","displayName":"nifi","implClass":"org.apache.ranger.services.nifi.RangerServiceNiFi","label":"privacera_nifi","description":"NiFi","options":{"enableDenyAndExceptionsInPolicies":"true"},"configs":[{"itemId":400,"name":"nifi.url","type":"string","mandatory":true,"defaultValue":"https://localhost:9443/nifi-api/resources","validationRegEx":"","validationMessage":"","uiHint":"The URL of the NiFi REST API that provides the available resources.","label":"NiFi URL"},{"itemId":410,"name":"nifi.authentication","type":"enum","subType":"authType","mandatory":true,"defaultValue":"NONE","validationRegEx":"","validationMessage":"","uiHint":"","label":"Authentication Type"},{"itemId":500,"name":"nifi.ssl.keystore","type":"string","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Keystore"},{"itemId":510,"name":"nifi.ssl.keystoreType","type":"string","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Keystore Type"},{"itemId":520,"name":"nifi.ssl.keystorePassword","type":"password","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Keystore Password"},{"itemId":530,"name":"nifi.ssl.truststore","type":"string","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Truststore"},{"itemId":540,"name":"nifi.ssl.truststoreType","type":"string","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Truststore Type"},{"itemId":550,"name":"nifi.ssl.truststorePassword","type":"password","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Truststore Password"}],"resources":[{"itemId":100,"name":"nifi-resource","type":"string","level":10,"mandatory":true,"lookupSupported":true,"recursiveSupported":false,"excludesSupported":true,"matcher":"org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher","matcherOptions":{"wildCard":"true","ignoreCase":"true"},"validationRegEx":"","validationMessage":"","uiHint":"","label":"NiFi Resource Identifier","description":"NiFi Resource","accessTypeRestrictions":[],"isValidLeaf":true}],"accessTypes":[{"itemId":100,"name":"READ","label":"Read","impliedGrants":[]},{"itemId":200,"name":"WRITE","label":"Write","impliedGrants":[]}],"policyConditions":[],"contextEnrichers":[],"enums":[{"itemId":1,"name":"authType","elements":[{"itemId":1,"name":"NONE","label":"None"},{"itemId":2,"name":"SSL","label":"SSL"}],"defaultIndex":0}],"dataMaskDef":{"maskTypes":[],"accessTypes":[],"resources":[]},"rowFilterDef":{"accessTypes":[],"resources":[]}}[ec2-user@ip-172-31-3-208 nifi]$
[ec2-user@ip-172-31-3-208 nifi]$
[ec2-user@ip-172-31-3-208 nifi]$
[ec2-user@ip-172-31-3-208 nifi]$ curl -i -L -k -u admin:welcome1 -X PUT -H "Accept: application/json" -H "Content-Type: application/json" -d@/home/ec2-user/privacera/downloads/nifi/${SERVICE_NAME}servicedef.json http://localhost:6080/service/public/v2/api/servicedef/name/nifi
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Set-Cookie: RANGERADMINSESSIONID=78312064A13C1CC98FC7DDE0A44B94FA; Path=/; HttpOnly
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy: default-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline';font-src 'self'
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Content-Type-Options: nosniff
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sun, 14 Jun 2020 00:45:24 GMT
Server: Apache Ranger
{"id":115,"guid":"d030f8bd-ce16-439c-9633-ed8f3470bc01","isEnabled":true,"createdBy":"Admin","updatedBy":"Admin","createTime":1592095447000,"updateTime":1592095524325,"version":2,"name":"nifi","displayName":"nifi","implClass":"org.apache.ranger.services.nifi.RangerServiceNiFi","label":"privacera_nifi","description":"NiFi","options":{"enableDenyAndExceptionsInPolicies":"true"},"configs":[{"itemId":400,"name":"nifi.url","type":"string","mandatory":true,"defaultValue":"https://localhost:9443/nifi-api/resources","validationRegEx":"","validationMessage":"","uiHint":"The URL of the NiFi REST API that provides the available resources.","label":"NiFi URL"},{"itemId":410,"name":"nifi.authentication","type":"enum","subType":"authType","mandatory":true,"defaultValue":"NONE","validationRegEx":"","validationMessage":"","uiHint":"","label":"Authentication Type"},{"itemId":500,"name":"nifi.ssl.keystore","type":"string","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Keystore"},{"itemId":510,"name":"nifi.ssl.keystoreType","type":"string","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Keystore Type"},{"itemId":520,"name":"nifi.ssl.keystorePassword","type":"password","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Keystore Password"},{"itemId":530,"name":"nifi.ssl.truststore","type":"string","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Truststore"},{"itemId":540,"name":"nifi.ssl.truststoreType","type":"string","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Truststore Type"},{"itemId":550,"name":"nifi.ssl.truststorePassword","type":"password","mandatory":false,"defaultValue":"","validationRegEx":"","validationMessage":"","uiHint":"","label":"Truststore Password"}],"resources":[{"itemId":100,"name":"nifi-resource","type":"string","level":10,"mandatory":true,"lookupSupported":true,"recursiveSupported":false,"excludesSupported":true,"matcher":"org.apache.ranger.plugin.resourcematcher.RangerDefaultResourceMatcher","matcherOptions":{"wildCard":"true","ignoreCase":"true"},"validationRegEx":"","validationMessage":"","uiHint":"","label":"NiFi Resource Identifier","description":"NiFi Resource","accessTypeRestrictions":[],"isValidLeaf":true}],"accessTypes":[{"itemId":100,"name":"READ","label":"Read","impliedGrants":[]},{"itemId":200,"name":"WRITE","label":"Write","impliedGrants":[]}],"policyConditions":[],"contextEnrichers":[],"enums":[{"itemId":1,"name":"authType","elements":[{"itemId":1,"name":"NONE","label":"None"},{"itemId":2,"name":"SSL","label":"SSL"}],"defaultIndex":0}],"dataMaskDef":{"maskTypes":[],"accessTypes":[],"resources":[]},"rowFilterDef":{"accessTypes":[],"resources":[]}}[ec2-user@ip-172-31-3-208 nifi]$
[ec2-user@ip-172-31-3-208 nifi]$
[ec2-user@ip-172-31-3-208 nifi]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment