diff --git a/Sekoia.io/main.py b/Sekoia.io/main.py index 3eee926f..594a03a4 100644 --- a/Sekoia.io/main.py +++ b/Sekoia.io/main.py @@ -19,8 +19,10 @@ AddsKeyToAsset, AssociateNewAlertsOnCase, CreatesNewAsset, + CreatesNewAssetV2, CreateRule, DeletesAsset, + DeletesAssetV2, DeleteRule, DenyCountermeasure, DisableRule, @@ -64,6 +66,7 @@ module.register(AddsKeyToAsset, "post-assets/{uuid}/keys") module.register(AssociateNewAlertsOnCase, "patch-cases/{case_uuid}/alerts") module.register(CreatesNewAsset, "post-assets") + module.register(CreatesNewAssetV2, "post-assets-v2") module.register(CreateRule, "post-rules") module.register(DeleteRule, "delete-rules/{uuid}") module.register(DenyCountermeasure, "patch-alerts/countermeasures/{cm_uuid}/deny") @@ -90,9 +93,10 @@ module.register(UpdateAlertStatus, "patch-alerts-v2/{uuid}/workflow") module.register(PushEventToIntake, "push-events-to-intake") module.register(ListAssets, "get-assets-v2") - module.register(DeletesAsset, "delete-assets-v2/{uuid}") - module.register(GetAsset, "get-assets/{uuid}") - module.register(ReturnsAsset, "get-assets-v2/{uuid}") + module.register(DeletesAsset, "delete-assets/{uuid}") + module.register(DeletesAssetV2, "delete-assets-v2/{uuid}") + module.register(GetAsset, "get-assets-v2/{uuid}") + module.register(ReturnsAsset, "get-assets/{uuid}") module.register(UpdateRule, "put-rules/{uuid}") module.register(GetAggregationQuery, "get-aggregation-query") module.register(AddIOCtoIOCCollectionAction, "add_ioc_to_ioc_collection") diff --git a/Sekoia.io/sekoiaio/operation_center/__init__.py b/Sekoia.io/sekoiaio/operation_center/__init__.py index e218c93c..8d6b7da8 100644 --- a/Sekoia.io/sekoiaio/operation_center/__init__.py +++ b/Sekoia.io/sekoiaio/operation_center/__init__.py @@ -307,14 +307,15 @@ }, ) -assets_base_url = "api/v2/asset-management/" +assets_v1_base_url = "api/v1/asset-management/" +assets_v2_base_url = "api/v2/asset-management/" ListTypesForAssets = type( "ListTypesForAssets", (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "asset-types", + "endpoint": assets_v1_base_url + "asset-types", "query_parameters": [ "match[uuid]", "match[name]", @@ -331,7 +332,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "asset-types/{uuid}", + "endpoint": assets_v1_base_url + "asset-types/{uuid}", "query_parameters": [], }, ) @@ -341,21 +342,20 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "assets", + "endpoint": assets_v2_base_url + "assets", "query_parameters": [ "limit", "offset", - "extended", - "match[community_uuid]", - "match[uuid]", - "match[name]", - "match[category_name]", - "match[category_uuid]", - "match[type_name]", - "match[type_uuid]", - "range[criticality]", - "date[created_at]", - "date[updated_at]", + "search", + "uuids", + "community_uuids", + "type", + "category", + "source", + "reviewed", + "rule_uuid", + "criticality", + "rule_version", "sort", "direction", ], @@ -367,7 +367,17 @@ (GenericAPIAction,), { "verb": "post", - "endpoint": assets_base_url + "assets", + "endpoint": assets_v1_base_url + "assets", + "query_parameters": [], + }, +) + +CreatesNewAssetV2 = type( + "CreatesNewAssetV2", + (GenericAPIAction,), + { + "verb": "post", + "endpoint": assets_v2_base_url + "assets", "query_parameters": [], }, ) @@ -377,7 +387,17 @@ (GenericAPIAction,), { "verb": "delete", - "endpoint": assets_base_url + "assets/{uuid}", + "endpoint": assets_v1_base_url + "assets/{uuid}", + "query_parameters": [], + }, +) + +DeletesAssetV2 = type( + "DeletesAsset", + (GenericAPIAction,), + { + "verb": "delete", + "endpoint": assets_v2_base_url + "assets/{uuid}", "query_parameters": [], }, ) @@ -387,7 +407,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "assets/{uuid}", + "endpoint": assets_v1_base_url + "assets/{uuid}", "query_parameters": [], }, ) @@ -397,7 +417,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "assets/{uuid}/attr", + "endpoint": assets_v1_base_url + "assets/{uuid}/attr", "query_parameters": ["limit", "offset"], }, ) @@ -407,7 +427,7 @@ (GenericAPIAction,), { "verb": "post", - "endpoint": assets_base_url + "assets/{uuid}/attr", + "endpoint": assets_v1_base_url + "assets/{uuid}/attr", "query_parameters": ["name", "value"], }, ) @@ -417,7 +437,7 @@ (GenericAPIAction,), { "verb": "delete", - "endpoint": assets_base_url + "assets/{uuid}/attr/{attribute_uuid}", + "endpoint": assets_v1_base_url + "assets/{uuid}/attr/{attribute_uuid}", "query_parameters": [], }, ) @@ -427,7 +447,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "assets/{uuid}/attr/{attribute_uuid}", + "endpoint": assets_v1_base_url + "assets/{uuid}/attr/{attribute_uuid}", "query_parameters": [], }, ) @@ -437,7 +457,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "assets/{uuid}/keys", + "endpoint": assets_v1_base_url + "assets/{uuid}/keys", "query_parameters": ["limit", "offset"], }, ) @@ -447,7 +467,7 @@ (GenericAPIAction,), { "verb": "post", - "endpoint": assets_base_url + "assets/{uuid}/keys", + "endpoint": assets_v1_base_url + "assets/{uuid}/keys", "query_parameters": ["name", "value"], }, ) @@ -457,7 +477,7 @@ (GenericAPIAction,), { "verb": "delete", - "endpoint": assets_base_url + "assets/{uuid}/keys/{key_uuid}", + "endpoint": assets_v1_base_url + "assets/{uuid}/keys/{key_uuid}", "query_parameters": [], }, ) @@ -467,7 +487,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "assets/{uuid}/keys/{key_uuid}", + "endpoint": assets_v1_base_url + "assets/{uuid}/keys/{key_uuid}", "query_parameters": [], }, ) @@ -477,7 +497,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "assets/{uuid}/owners", + "endpoint": assets_v1_base_url + "assets/{uuid}/owners", "query_parameters": ["limit", "offset"], }, ) @@ -487,7 +507,7 @@ (GenericAPIAction,), { "verb": "post", - "endpoint": assets_base_url + "assets/{uuid}/owners", + "endpoint": assets_v1_base_url + "assets/{uuid}/owners", "query_parameters": ["owners"], }, ) @@ -497,7 +517,7 @@ (GenericAPIAction,), { "verb": "delete", - "endpoint": assets_base_url + "assets/{uuid}/owners/{owner_uuid}", + "endpoint": assets_v1_base_url + "assets/{uuid}/owners/{owner_uuid}", "query_parameters": [], }, ) @@ -507,7 +527,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "attribute-names", + "endpoint": assets_v1_base_url + "attribute-names", "query_parameters": ["category", "type", "limit", "offset"], }, ) @@ -517,7 +537,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "attribute-names/{uuid}", + "endpoint": assets_v1_base_url + "attribute-names/{uuid}", "query_parameters": [], }, ) @@ -527,7 +547,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "categories", + "endpoint": assets_v1_base_url + "categories", "query_parameters": ["limit", "offset"], }, ) @@ -537,7 +557,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "categories/{uuid}", + "endpoint": assets_v1_base_url + "categories/{uuid}", "query_parameters": [], }, ) @@ -547,7 +567,7 @@ (GenericAPIAction,), { "verb": "get", - "endpoint": assets_base_url + "categories/{uuid}/types", + "endpoint": assets_v1_base_url + "categories/{uuid}/types", "query_parameters": ["limit", "offset"], }, )