Skip to content

Commit 215a1f0

Browse files
ATLAS-4797: Implement custom audit filters in Atlas
1 parent 7502cec commit 215a1f0

File tree

31 files changed

+2427
-25
lines changed

31 files changed

+2427
-25
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
@@ -586,6 +586,64 @@
586586
{ "name": "processingStartTime", "typeName": "string", "isOptional": false, "cardinality": "SINGLE", "isUnique": false, "isIndexable": false },
587587
{ "name": "completedTime", "typeName": "string", "isOptional": false, "cardinality": "SINGLE", "isUnique": false, "isIndexable": false }
588588
]
589+
},
590+
{
591+
"name": "__AtlasRule",
592+
"superTypes": [
593+
"__internal"
594+
],
595+
"serviceType": "atlas_core",
596+
"typeVersion": "1.0",
597+
"attributeDefs": [
598+
{
599+
"name": "ruleName",
600+
"typeName": "string",
601+
"cardinality": "SINGLE",
602+
"isIndexable": true,
603+
"isOptional": false,
604+
"isUnique": true
605+
},
606+
{
607+
"name": "desc",
608+
"typeName": "string",
609+
"cardinality": "SINGLE",
610+
"isIndexable": false,
611+
"isOptional": true,
612+
"isUnique": false
613+
},
614+
{
615+
"name": "action",
616+
"typeName": "string",
617+
"cardinality": "SINGLE",
618+
"isIndexable": true,
619+
"isOptional": false,
620+
"isUnique": false
621+
},
622+
{
623+
"name": "ruleExpr",
624+
"typeName": "string",
625+
"cardinality": "SINGLE",
626+
"isIndexable": false,
627+
"isOptional": false,
628+
"isUnique": true
629+
},
630+
{
631+
"name": "createdTime",
632+
"typeName": "date",
633+
"cardinality": "SINGLE",
634+
"isIndexable": false,
635+
"isOptional": false,
636+
"isUnique": false
637+
},
638+
{
639+
"name": "updatedTime",
640+
"typeName": "date",
641+
"cardinality": "SINGLE",
642+
"isIndexable": false,
643+
"isOptional": true,
644+
"isUnique": false
645+
}
646+
]
589647
}
590648
],
591649
"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
@@ -58,6 +58,7 @@
5858
import org.apache.atlas.model.instance.AtlasRelatedObjectId;
5959
import org.apache.atlas.model.instance.AtlasRelationship;
6060
import org.apache.atlas.model.instance.AtlasRelationship.AtlasRelationshipWithExtInfo;
61+
import org.apache.atlas.model.instance.AtlasRule;
6162
import org.apache.atlas.model.instance.ClassificationAssociateRequest;
6263
import org.apache.atlas.model.instance.EntityMutationResponse;
6364
import org.apache.atlas.model.lineage.AtlasLineageInfo;
@@ -115,6 +116,7 @@ public class AtlasClientV2 extends AtlasBaseClient {
115116
private static final String ADMIN_API = BASE_URI + "admin/";
116117
private static final String ENTITY_PURGE_API = ADMIN_API + "purge/";
117118
private static final String ATLAS_AUDIT_API = ADMIN_API + "audits/";
119+
private static final String ATLAS_RULES_API = ATLAS_AUDIT_API + "rules/";
118120

119121
// Lineage APIs
120122
private static final String LINEAGE_URI = BASE_URI + "v2/lineage/";
@@ -574,6 +576,22 @@ public String getTemplateForBulkUpdateBusinessAttributes() throws AtlasServiceEx
574576
return readStreamContents(inputStream);
575577
}
576578

579+
public AtlasRule createRule(AtlasRule atlasRule) throws AtlasServiceException {
580+
return callAPI(API_V2.CREATE_RULE, AtlasRule.class, atlasRule);
581+
}
582+
583+
public List<AtlasRule> getAllRules() throws AtlasServiceException {
584+
return callAPI(API_V2.GET_RULES, List.class, null);
585+
}
586+
587+
public EntityMutationResponse deleteRuleByGuid(String guid) throws AtlasServiceException {
588+
return callAPI(formatPathParameters(API_V2.DELETE_RULE_BY_GUID, guid), EntityMutationResponse.class, null, guid);
589+
}
590+
591+
public EntityMutationResponse deleteRulesByGuid(List<String> guidList) throws AtlasServiceException {
592+
return callAPI(API_V2.DELETE_RULES_BY_GUID, EntityMutationResponse.class, null, guidList);
593+
}
594+
577595
public BulkImportResponse bulkUpdateBusinessAttributes(String fileName) throws AtlasServiceException {
578596
MultiPart multipartEntity = getMultiPartData(fileName);
579597

@@ -1347,6 +1365,10 @@ public static class API_V2 extends API {
13471365
public static final API_V2 DISASSOCIATE_TERM_FROM_ENTITIES = new API_V2(GLOSSARY_TERMS + "/%s/assignedEntities", HttpMethod.PUT, Response.Status.NO_CONTENT);
13481366
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);
13491367
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);
1368+
public static final API_V2 CREATE_RULE = new API_V2(ATLAS_RULES_API, HttpMethod.POST, Response.Status.OK);
1369+
public static final API_V2 GET_RULES = new API_V2(ATLAS_RULES_API, HttpMethod.GET, Response.Status.OK);
1370+
public static final API_V2 DELETE_RULE_BY_GUID = new API_V2(ATLAS_RULES_API + "guid/", HttpMethod.DELETE, Response.Status.OK);
1371+
public static final API_V2 DELETE_RULES_BY_GUID = new API_V2(ATLAS_RULES_API, HttpMethod.DELETE, Response.Status.OK);
13501372

13511373
private API_V2(String path, String method, Response.Status status) {
13521374
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)