|
58 | 58 | import org.apache.atlas.model.instance.AtlasRelatedObjectId; |
59 | 59 | import org.apache.atlas.model.instance.AtlasRelationship; |
60 | 60 | import org.apache.atlas.model.instance.AtlasRelationship.AtlasRelationshipWithExtInfo; |
| 61 | +import org.apache.atlas.model.instance.AtlasRule; |
61 | 62 | import org.apache.atlas.model.instance.ClassificationAssociateRequest; |
62 | 63 | import org.apache.atlas.model.instance.EntityMutationResponse; |
63 | 64 | import org.apache.atlas.model.lineage.AtlasLineageInfo; |
@@ -115,6 +116,7 @@ public class AtlasClientV2 extends AtlasBaseClient { |
115 | 116 | private static final String ADMIN_API = BASE_URI + "admin/"; |
116 | 117 | private static final String ENTITY_PURGE_API = ADMIN_API + "purge/"; |
117 | 118 | private static final String ATLAS_AUDIT_API = ADMIN_API + "audits/"; |
| 119 | + private static final String ATLAS_RULES_API = ATLAS_AUDIT_API + "rules/"; |
118 | 120 |
|
119 | 121 | // Lineage APIs |
120 | 122 | private static final String LINEAGE_URI = BASE_URI + "v2/lineage/"; |
@@ -574,6 +576,22 @@ public String getTemplateForBulkUpdateBusinessAttributes() throws AtlasServiceEx |
574 | 576 | return readStreamContents(inputStream); |
575 | 577 | } |
576 | 578 |
|
| 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 | + |
577 | 595 | public BulkImportResponse bulkUpdateBusinessAttributes(String fileName) throws AtlasServiceException { |
578 | 596 | MultiPart multipartEntity = getMultiPartData(fileName); |
579 | 597 |
|
@@ -1347,6 +1365,10 @@ public static class API_V2 extends API { |
1347 | 1365 | public static final API_V2 DISASSOCIATE_TERM_FROM_ENTITIES = new API_V2(GLOSSARY_TERMS + "/%s/assignedEntities", HttpMethod.PUT, Response.Status.NO_CONTENT); |
1348 | 1366 | 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); |
1349 | 1367 | 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); |
1350 | 1372 |
|
1351 | 1373 | private API_V2(String path, String method, Response.Status status) { |
1352 | 1374 | super(path, method, status); |
|
0 commit comments