Skip to main content

Privacera Documentation

Hive

  1. Create privacera_tags in the Ranger Tag Based Policy.

  2. Associate the privacera_tags to Hive service.

  3. Create a JSON file where you can add tags.

    vi hive_tag.json
    
  4. Edit the JSON file shown below based on your specific table/tag information.

        {
          "op": "add_or_update",
          "serviceName": "${Hive_Service_Name}",
          "tagVersion": 0,
          "tagDefinitions": {
            "0": {
              "name": "${Tag_Name}",
              "source": "Atlas",
              "attributeDefs": [],
              "id": 0,
              "isEnabled": true
            }
          },
          "tags": {
            "0": {
              "type": "${Tag_Type}",
              "owner": 0,
              "attributes": {},
              "id": 0,
              "isEnabled": true
            }
          },
          "serviceResources": [
            {
              "serviceName": "${Hive_Service_Name}",
              "resourceElements": {
                "database": {
                  "values": [
                    "${Database}"
                  ],
                  "isExcludes": false,
                  "isRecursive": false
                },
                "table": {
                  "values": [
                    "${Table}"
                  ],
                  "isExcludes": false,
                  "isRecursive": false
                },
                "column": {
                  "values": [
                    "${Column}"
                  ],
                  "isExcludes": false,
                  "isRecursive": false
                }
              },
              "id": 0,
              "isEnabled": true
            }
          ],
          "resourceToTagIds": {
            "0": [
              0
            ]
          }
        }
    

    Sample hive_tag.json

         {
          "op": "add_or_update",
          "serviceName": "privacera_hive",
          "tagVersion": 0,
          "tagDefinitions": {
            "0": {
              "name": "SSN",
              "source": "Atlas",
              "attributeDefs": [],
              "id": 0,
              "isEnabled": true
            }
          },
          "tags": {
            "0": {
              "type": "SSN",
              "owner": 0,
              "attributes": {},
              "id": 0,
              "isEnabled": true
            }
          },
          "serviceResources": [
            {
              "serviceName": "privacera_hive",
              "resourceElements": {
                "database": {
                  "values": [
                    "finance"
                  ],
                  "isExcludes": false,
                  "isRecursive": false
                },
                "table": {
                  "values": [
                    "ssn_finance_us"
                  ],
                  "isExcludes": false,
                  "isRecursive": false
                },
                "column": {
                  "values": [
                    "SocialSecurity"
                  ],
                  "isExcludes": false,
                  "isRecursive": false
                }
              },
              "id": 0,
              "isEnabled": true
            }
          ],
          "resourceToTagIds": {
            "0": [
              0
            ]
          }
        }
    
  5. Push the tag to Ranger.

Add Tag

curl -i -L -k -u admin:<RANGER_ADMIN_PASSWORD> -H "Content-type: application/json" -d @hive_tag.json -X PUT http://<RANGER_HOST>:6080/service/tags/importservicetags

Get Tagged Resource

curl -i -L -k -u admin:<RANGER_ADMIN_PASSWORD> -H "Content-type: application/json" -X GET http://<RANGER_HOST>:6080/service/tags/resources