Skip to content

Commit 40521d1

Browse files
author
Sheetal Shah
committed
ATLAS-4797: Implement custom audit filters in Atlas
1 parent ff8e083 commit 40521d1

File tree

31 files changed

+2427
-24
lines changed

31 files changed

+2427
-24
lines changed

addons/hbase-bridge/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@
111111
<artifactId>hadoop-hdfs</artifactId>
112112
<version>${hadoop.version}</version>
113113
<exclusions>
114+
<exclusion>
115+
<groupId>com.google.code.gson</groupId>
116+
<artifactId>gson</artifactId>
117+
</exclusion>
114118
<exclusion>
115119
<groupId>javax.servlet</groupId>
116120
<artifactId>servlet-api</artifactId>

addons/hbase-testing-util/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@
100100
<version>${hadoop.version}</version>
101101
<scope>compile</scope>
102102
<exclusions>
103+
<exclusion>
104+
<groupId>com.google.code.gson</groupId>
105+
<artifactId>gson</artifactId>
106+
</exclusion>
103107
<exclusion>
104108
<groupId>org.apache.commons</groupId>
105109
<artifactId>commons-configuration2</artifactId>

addons/hive-bridge-shim/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
<version>${hive.version}</version>
4545
<scope>provided</scope>
4646
<exclusions>
47+
<exclusion>
48+
<groupId>com.google.code.gson</groupId>
49+
<artifactId>gson</artifactId>
50+
</exclusion>
4751
<exclusion>
4852
<groupId>org.apache.commons</groupId>
4953
<artifactId>commons-text</artifactId>

addons/hive-bridge/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@
113113
<version>${hive.version}</version>
114114
<scope>provided</scope>
115115
<exclusions>
116+
<exclusion>
117+
<groupId>com.google.code.gson</groupId>
118+
<artifactId>gson</artifactId>
119+
</exclusion>
116120
<exclusion>
117121
<groupId>javax.servlet</groupId>
118122
<artifactId>*</artifactId>

addons/kafka-bridge/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
<version>${hadoop.version}</version>
7171
<scope>compile</scope>
7272
<exclusions>
73+
<exclusion>
74+
<groupId>com.google.code.gson</groupId>
75+
<artifactId>gson</artifactId>
76+
</exclusion>
7377
<exclusion>
7478
<groupId>javax.servlet</groupId>
7579
<artifactId>servlet-api</artifactId>

addons/models/0000-Area0/0010-base_model.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,64 @@
568568
"serviceType": "atlas_core",
569569
"typeVersion": "1.0",
570570
"attributeDefs": []
571+
},
572+
{
573+
"name": "__AtlasRule",
574+
"superTypes": [
575+
"__internal"
576+
],
577+
"serviceType": "atlas_core",
578+
"typeVersion": "1.0",
579+
"attributeDefs": [
580+
{
581+
"name": "ruleName",
582+
"typeName": "string",
583+
"cardinality": "SINGLE",
584+
"isIndexable": true,
585+
"isOptional": false,
586+
"isUnique": true
587+
},
588+
{
589+
"name": "desc",
590+
"typeName": "string",
591+
"cardinality": "SINGLE",
592+
"isIndexable": false,
593+
"isOptional": true,
594+
"isUnique": false
595+
},
596+
{
597+
"name": "action",
598+
"typeName": "string",
599+
"cardinality": "SINGLE",
600+
"isIndexable": true,
601+
"isOptional": false,
602+
"isUnique": false
603+
},
604+
{
605+
"name": "ruleExpr",
606+
"typeName": "string",
607+
"cardinality": "SINGLE",
608+
"isIndexable": false,
609+
"isOptional": false,
610+
"isUnique": true
611+
},
612+
{
613+
"name": "createdTime",
614+
"typeName": "date",
615+
"cardinality": "SINGLE",
616+
"isIndexable": false,
617+
"isOptional": false,
618+
"isUnique": false
619+
},
620+
{
621+
"name": "updatedTime",
622+
"typeName": "date",
623+
"cardinality": "SINGLE",
624+
"isIndexable": false,
625+
"isOptional": true,
626+
"isUnique": false
627+
}
628+
]
571629
}
572630
],
573631
"relationshipDefs": [

addons/sqoop-bridge/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@
110110
<artifactId>hive-exec</artifactId>
111111
<version>${hive.version}</version>
112112
<scope>provided</scope>
113+
<exclusions>
114+
<exclusion>
115+
<groupId>com.google.code.gson</groupId>
116+
<artifactId>gson</artifactId>
117+
</exclusion>
118+
</exclusions>
113119
</dependency>
114120

115121
<dependency>

client/client-v2/src/main/java/org/apache/atlas/AtlasClientV2.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import org.apache.atlas.model.instance.AtlasRelatedObjectId;
5353
import org.apache.atlas.model.instance.AtlasRelationship;
5454
import org.apache.atlas.model.instance.AtlasRelationship.AtlasRelationshipWithExtInfo;
55+
import org.apache.atlas.model.instance.AtlasRule;
5556
import org.apache.atlas.model.instance.ClassificationAssociateRequest;
5657
import org.apache.atlas.model.instance.EntityMutationResponse;
5758
import org.apache.atlas.model.lineage.AtlasLineageInfo;
@@ -108,6 +109,7 @@ public class AtlasClientV2 extends AtlasBaseClient {
108109
private static final String ADMIN_API = BASE_URI + "admin/";
109110
private static final String ENTITY_PURGE_API = ADMIN_API + "purge/";
110111
private static final String ATLAS_AUDIT_API = ADMIN_API + "audits/";
112+
private static final String ATLAS_RULES_API = ATLAS_AUDIT_API + "rules/";
111113

112114
// Lineage APIs
113115
private static final String LINEAGE_URI = BASE_URI + "v2/lineage/";
@@ -560,6 +562,22 @@ public String getTemplateForBulkUpdateBusinessAttributes() throws AtlasServiceEx
560562
return readStreamContents(inputStream);
561563
}
562564

565+
public AtlasRule createRule(AtlasRule atlasRule) throws AtlasServiceException {
566+
return callAPI(API_V2.CREATE_RULE, AtlasRule.class, atlasRule);
567+
}
568+
569+
public List<AtlasRule> getAllRules() throws AtlasServiceException {
570+
return callAPI(API_V2.GET_RULES, List.class, null);
571+
}
572+
573+
public EntityMutationResponse deleteRuleByGuid(String guid) throws AtlasServiceException {
574+
return callAPI(formatPathParameters(API_V2.DELETE_RULE_BY_GUID, guid), EntityMutationResponse.class, null, guid);
575+
}
576+
577+
public EntityMutationResponse deleteRulesByGuid(List<String> guidList) throws AtlasServiceException {
578+
return callAPI(API_V2.DELETE_RULES_BY_GUID, EntityMutationResponse.class, null, guidList);
579+
}
580+
563581
public BulkImportResponse bulkUpdateBusinessAttributes(String fileName) throws AtlasServiceException {
564582
MultiPart multipartEntity = getMultiPartData(fileName);
565583

@@ -1281,6 +1299,10 @@ public static class API_V2 extends API {
12811299
public static final API_V2 DISASSOCIATE_TERM_FROM_ENTITIES = new API_V2(GLOSSARY_TERMS + "/%s/assignedEntities", HttpMethod.PUT, Response.Status.NO_CONTENT);
12821300
public static final API_V2 GET_IMPORT_GLOSSARY_TEMPLATE = new API_V2(GLOSSARY_URI + "/import/template", HttpMethod.GET, Response.Status.OK, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM);
12831301
public static final API_V2 IMPORT_GLOSSARY = new API_V2(GLOSSARY_URI + "/import", HttpMethod.POST, Response.Status.OK, MediaType.MULTIPART_FORM_DATA, MediaType.APPLICATION_JSON);
1302+
public static final API_V2 CREATE_RULE = new API_V2(ATLAS_RULES_API, HttpMethod.POST, Response.Status.OK);
1303+
public static final API_V2 GET_RULES = new API_V2(ATLAS_RULES_API, HttpMethod.GET, Response.Status.OK);
1304+
public static final API_V2 DELETE_RULE_BY_GUID = new API_V2(ATLAS_RULES_API + "guid/", HttpMethod.DELETE, Response.Status.OK);
1305+
public static final API_V2 DELETE_RULES_BY_GUID = new API_V2(ATLAS_RULES_API, HttpMethod.DELETE, Response.Status.OK);
12841306

12851307
private API_V2(String path, String method, Response.Status status) {
12861308
super(path, method, status);

distro/src/conf/atlas-application.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,7 @@ atlas.search.gremlin.enable=false
281281

282282
######### Skip check for the same attribute name in Parent type and Child type #########
283283

284-
#atlas.skip.check.for.parent.child.attribute.name=true
284+
#atlas.skip.check.for.parent.child.attribute.name=true
285+
286+
atlas.entity.audit.filter.enabled=false
287+
atlas.entity.audit.filter.default.action=ACCEPT

graphdb/api/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
</properties>
3838

3939
<dependencies>
40+
<dependency>
41+
<groupId>com.google.code.gson</groupId>
42+
<artifactId>gson</artifactId>
43+
<version>${gson.version}</version>
44+
</dependency>
4045
<dependency>
4146
<groupId>org.apache.atlas</groupId>
4247
<artifactId>atlas-common</artifactId>

0 commit comments

Comments
 (0)