|
52 | 52 | import org.apache.atlas.model.instance.AtlasRelatedObjectId; |
53 | 53 | import org.apache.atlas.model.instance.AtlasRelationship; |
54 | 54 | import org.apache.atlas.model.instance.AtlasRelationship.AtlasRelationshipWithExtInfo; |
| 55 | +import org.apache.atlas.model.instance.AtlasRule; |
55 | 56 | import org.apache.atlas.model.instance.ClassificationAssociateRequest; |
56 | 57 | import org.apache.atlas.model.instance.EntityMutationResponse; |
57 | 58 | import org.apache.atlas.model.lineage.AtlasLineageInfo; |
@@ -108,6 +109,7 @@ public class AtlasClientV2 extends AtlasBaseClient { |
108 | 109 | private static final String ADMIN_API = BASE_URI + "admin/"; |
109 | 110 | private static final String ENTITY_PURGE_API = ADMIN_API + "purge/"; |
110 | 111 | private static final String ATLAS_AUDIT_API = ADMIN_API + "audits/"; |
| 112 | + private static final String ATLAS_RULES_API = ATLAS_AUDIT_API + "rules/"; |
111 | 113 |
|
112 | 114 | // Lineage APIs |
113 | 115 | private static final String LINEAGE_URI = BASE_URI + "v2/lineage/"; |
@@ -560,6 +562,22 @@ public String getTemplateForBulkUpdateBusinessAttributes() throws AtlasServiceEx |
560 | 562 | return readStreamContents(inputStream); |
561 | 563 | } |
562 | 564 |
|
| 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 | + |
563 | 581 | public BulkImportResponse bulkUpdateBusinessAttributes(String fileName) throws AtlasServiceException { |
564 | 582 | MultiPart multipartEntity = getMultiPartData(fileName); |
565 | 583 |
|
@@ -1281,6 +1299,10 @@ public static class API_V2 extends API { |
1281 | 1299 | public static final API_V2 DISASSOCIATE_TERM_FROM_ENTITIES = new API_V2(GLOSSARY_TERMS + "/%s/assignedEntities", HttpMethod.PUT, Response.Status.NO_CONTENT); |
1282 | 1300 | 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); |
1283 | 1301 | 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); |
1284 | 1306 |
|
1285 | 1307 | private API_V2(String path, String method, Response.Status status) { |
1286 | 1308 | super(path, method, status); |
|
0 commit comments