Anand Nadar created RANGER-4749:
-----------------------------------

             Summary: Tag: Create an api to check if a resource is already 
available in database by resource input. And send tag list along with the 
resource list in response of GET /service/tags/resources/paginated API
                 Key: RANGER-4749
                 URL: https://issues.apache.org/jira/browse/RANGER-4749
             Project: Ranger
          Issue Type: Task
          Components: admin
            Reporter: Anand Nadar


*1. Need an api to get the resource by resource if it exists in database.*
Case:
Suppose there already exists below tag and resource association.
PII_NAME tag is associated with (database:HR-DB, table:EMPLOYEE, column:NAME)

Now we dont know about the above resource already existing, so we are now 
trying to create a new tag resource association as below
PII_EMP_NAME associated with (database:HR-DB, table:EMPLOYEE, column:NAME)

This is done using PUT /service/tags/importservicetags -> op: add_or_update
So this will result in the deletion of PII_NAME association with the resource,  
and creation of PII_EMP_NAME tag associated with the resource.

So if we have this GET service/tags/resource/service/\{serviceName}/resource 
api which will have the payload as
{code:java}
{
   "database": {
       "values": [
           "HR-DB"
       ],
       "isRecursive": true
   },
   "table": {
       "values": [
           "EMPLOYEE"
       ],
       "isRecursive": true
   },
   "column": {
       "values": [
           "NAME"
       ],
       "isRecursive": true
   }
} {code}
we can check if this resource already exists or not.

If the resource exists, we can get all the tags associated with that 
resource(in our case PII_NAME), and include the new tag PII_EMP_NAME as well 
and send this in 
PUT /service/tags/importservicetags -> op: add_or_update
then both PII_NAME and PII_EMP_NAME will be associated with the resource.

*2. Need the list of associated tag names for a resource in  
/service/tags/resources/paginated api.*
This will get the service resources with all its associated tags in a single 
api which is also paginated.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to