From ffe7b3dd0124e1bf52bec53b225602d965444875 Mon Sep 17 00:00:00 2001 From: Cecilia Stevens <63068179+ceciliastevens@users.noreply.github.com> Date: Tue, 18 Mar 2025 13:27:19 -0400 Subject: [PATCH 1/4] deprecate incydr functionality --- docs/methoddocs/alertrules.md | 6 +- docs/methoddocs/alerts.md | 6 +- docs/methoddocs/auditlogs.md | 6 +- docs/methoddocs/cases.md | 6 +- docs/methoddocs/fileeventqueries.md | 2 +- docs/methoddocs/fileeventqueriesv2.md | 6 +- docs/methoddocs/securitydata.md | 4 +- docs/methoddocs/sharedqueryfilters.md | 6 +- docs/methoddocs/trustedactivities.md | 6 +- docs/methoddocs/userriskprofile.md | 6 +- docs/methoddocs/watchlists.md | 6 +- docs/methods.md | 21 ++++--- src/py42/clients/alertrules.py | 39 ++++++++++++ src/py42/clients/alerts.py | 54 +++++++++++++++++ src/py42/clients/auditlogs.py | 15 +++++ src/py42/clients/cases.py | 33 +++++++++++ src/py42/clients/securitydata.py | 24 ++++++++ src/py42/clients/trustedactivities.py | 29 +++++++++ src/py42/clients/userriskprofile.py | 39 ++++++++++++ src/py42/clients/watchlists.py | 59 +++++++++++++++++++ src/py42/sdk/queries/alerts/alert_query.py | 10 ++++ .../queries/fileevents/file_event_query.py | 3 + src/py42/services/alertrules.py | 2 + src/py42/services/alerts.py | 2 + src/py42/services/auditlogs.py | 2 + src/py42/services/fileevent.py | 19 +++--- src/py42/services/savedsearch.py | 42 +++++++------ 27 files changed, 405 insertions(+), 48 deletions(-) diff --git a/docs/methoddocs/alertrules.md b/docs/methoddocs/alertrules.md index 58d8702a3..7132aa8a6 100644 --- a/docs/methoddocs/alertrules.md +++ b/docs/methoddocs/alertrules.md @@ -1,4 +1,8 @@ -# Alert Rules +# Alert Rules (DEPRECATED) + +```{eval-rst} +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. +``` ```{eval-rst} .. autoclass:: py42.clients.alertrules.AlertRulesClient diff --git a/docs/methoddocs/alerts.md b/docs/methoddocs/alerts.md index d46b8b809..4fa7fbdc3 100644 --- a/docs/methoddocs/alerts.md +++ b/docs/methoddocs/alerts.md @@ -1,4 +1,8 @@ -# Alerts +# Alerts (DEPRECATED) + +```{eval-rst} +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. +``` ```{eval-rst} .. autoclass:: py42.clients.alerts.AlertsClient diff --git a/docs/methoddocs/auditlogs.md b/docs/methoddocs/auditlogs.md index 968421f82..27b66a2a8 100644 --- a/docs/methoddocs/auditlogs.md +++ b/docs/methoddocs/auditlogs.md @@ -1,4 +1,8 @@ -# Audit Logs +# Audit Logs (DEPRECATED) + +```{eval-rst} +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. +``` ```{eval-rst} .. autoclass:: py42.clients.auditlogs.AuditLogsClient diff --git a/docs/methoddocs/cases.md b/docs/methoddocs/cases.md index 617d02541..abd1e4b40 100644 --- a/docs/methoddocs/cases.md +++ b/docs/methoddocs/cases.md @@ -1,4 +1,8 @@ -# Cases +# Cases (DEPRECATED) + +```{eval-rst} +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. +``` ```{eval-rst} .. autoclass:: py42.clients.cases.CaseStatus diff --git a/docs/methoddocs/fileeventqueries.md b/docs/methoddocs/fileeventqueries.md index 148483888..bff415d17 100644 --- a/docs/methoddocs/fileeventqueries.md +++ b/docs/methoddocs/fileeventqueries.md @@ -1,7 +1,7 @@ # File Event Queries - V1 (DEPRECATED) ```{eval-rst} -.. warning:: V1 file events, saved searches, and queries are **deprecated**. +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. ``` ```{eval-rst} diff --git a/docs/methoddocs/fileeventqueriesv2.md b/docs/methoddocs/fileeventqueriesv2.md index b81ccb9ec..21a0d4f5c 100644 --- a/docs/methoddocs/fileeventqueriesv2.md +++ b/docs/methoddocs/fileeventqueriesv2.md @@ -1,4 +1,8 @@ -# File Event Queries - V2 +# File Event Queries - V2 (DEPRECATED) + +```{eval-rst} +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. +``` ```{eval-rst} .. autoclass:: py42.sdk.queries.fileevents.v2.file_event_query.FileEventQuery diff --git a/docs/methoddocs/securitydata.md b/docs/methoddocs/securitydata.md index afb9f9a59..074dd2488 100644 --- a/docs/methoddocs/securitydata.md +++ b/docs/methoddocs/securitydata.md @@ -1,7 +1,7 @@ -# Security Data +# Security Data (DEPRECATED) ```{eval-rst} -.. warning:: V1 file events, saved searches, and queries are **deprecated**. +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. ``` ```{eval-rst} diff --git a/docs/methoddocs/sharedqueryfilters.md b/docs/methoddocs/sharedqueryfilters.md index e7e028d47..77e566d73 100644 --- a/docs/methoddocs/sharedqueryfilters.md +++ b/docs/methoddocs/sharedqueryfilters.md @@ -1,4 +1,8 @@ -# Shared Query Filters +# Shared Query Filters (DEPRECATED) + +```{eval-rst} +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. +``` ```{eval-rst} .. automodule:: py42.sdk.queries.query_filter diff --git a/docs/methoddocs/trustedactivities.md b/docs/methoddocs/trustedactivities.md index cf2595f14..7c206bcf3 100644 --- a/docs/methoddocs/trustedactivities.md +++ b/docs/methoddocs/trustedactivities.md @@ -1,4 +1,8 @@ -# Trusted Activities +# Trusted Activities (DEPRECATED) + +```{eval-rst} +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. +``` ```{eval-rst} .. autoclass:: py42.clients.trustedactivities.TrustedActivityType diff --git a/docs/methoddocs/userriskprofile.md b/docs/methoddocs/userriskprofile.md index 54e6dff95..ee437eee5 100644 --- a/docs/methoddocs/userriskprofile.md +++ b/docs/methoddocs/userriskprofile.md @@ -1,4 +1,8 @@ -# User Risk Profiles +# User Risk Profiles (DEPRECATED) + +```{eval-rst} +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. +``` ```{eval-rst} .. autoclass:: py42.clients.userriskprofile.UserRiskProfileClient diff --git a/docs/methoddocs/watchlists.md b/docs/methoddocs/watchlists.md index 9f4085071..5bb13735c 100644 --- a/docs/methoddocs/watchlists.md +++ b/docs/methoddocs/watchlists.md @@ -1,4 +1,8 @@ -# Watchlists +# Watchlists (DEPRECATED) + +```{eval-rst} +.. warning:: Incydr functionality is **deprecated**. Use the resources at https://developer.code42.com/ instead. +``` ```{eval-rst} .. autoclass:: py42.clients.watchlists.WatchlistType diff --git a/docs/methods.md b/docs/methods.md index 0ae6a51d2..8c5d19a25 100644 --- a/docs/methods.md +++ b/docs/methods.md @@ -27,30 +27,29 @@ sdk = py42.sdk.from_local_account("console.us.code42.com", "john.doe@example.com Explore the complete public documentation for `py42` below. -* [Alerts](methoddocs/alerts.md) -* [Alert Rules](methoddocs/alertrules.md) * [Archive](methoddocs/archive.md) -* [Audit Logs](methoddocs/auditlogs.md) * [Backup Sets](methoddocs/backupset.md) -* [Cases](methoddocs/cases.md) * [Constants](methoddocs/constants.md) * [Devices](methoddocs/devices.md) * [Device Settings](methoddocs/devicesettings.md) * [Exceptions](methoddocs/exceptions.md) -* [(DEPRECATED) File Event Queries - V1](methoddocs/fileeventqueries.md) -* [File Event Queries - V2](methoddocs/fileeventqueriesv2.md) * [Legal Hold](methoddocs/legalhold.md) * [Legal Hold - API Clients](methoddocs/legalholdapiclient.md) * [Orgs](methoddocs/orgs.md) * [Org Settings](methoddocs/orgsettings.md) * [Response](methoddocs/response.md) -* [Security Data](methoddocs/securitydata.md) -* [Shared Query Filters](methoddocs/sharedqueryfilters.md) -* [Trusted Activities](methoddocs/trustedactivities.md) * [Users](methoddocs/users.md) -* [User Risk Profiles](methoddocs/userriskprofile.md) * [Util](methoddocs/util.md) -* [Watchlists](methoddocs/watchlists.md) +* [(DEPRECATED) Alerts](methoddocs/alerts.md) +* [(DEPRECATED) Alert Rules](methoddocs/alertrules.md) +* [(DEPRECATED) Audit Logs](methoddocs/auditlogs.md) +* [(DEPRECATED) File Event Queries - V1](methoddocs/fileeventqueries.md) +* [(DEPRECATED) File Event Queries - V2](methoddocs/fileeventqueriesv2.md) +* [(DEPRECATED) Security Data](methoddocs/securitydata.md) +* [(DEPRECATED) Shared Query Filters](methoddocs/sharedqueryfilters.md) +* [(DEPRECATED) Trusted Activities](methoddocs/trustedactivities.md) +* [(DEPRECATED) User Risk Profiles](methoddocs/userriskprofile.md) +* [(DEPRECATED) Watchlists](methoddocs/watchlists.md) ```{eval-rst} .. automodule:: py42.sdk diff --git a/src/py42/clients/alertrules.py b/src/py42/clients/alertrules.py index ab87b70f8..0d6aca103 100644 --- a/src/py42/clients/alertrules.py +++ b/src/py42/clients/alertrules.py @@ -1,7 +1,11 @@ +from warnings import warn + from py42 import settings from py42.exceptions import Py42InternalServerError from py42.exceptions import Py42InvalidRuleOperationError +# Incydr functionality is deprecated as of 2025-03. + class AlertRulesClient: """`Rest Documentation `__""" @@ -52,6 +56,11 @@ def add_user(self, rule_id, user_id): Returns :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) try: return self._alert_rules_service.add_user(rule_id, user_id) except Py42InternalServerError as err: @@ -74,6 +83,11 @@ def remove_user(self, rule_id, user_id): Returns :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) try: return self._alert_rules_service.remove_user(rule_id, user_id) except Py42InternalServerError as err: @@ -92,6 +106,11 @@ def remove_all_users(self, rule_id): Returns :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) try: return self._alert_rules_service.remove_all_users(rule_id) except Py42InternalServerError as err: @@ -118,6 +137,11 @@ def get_page( Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) page_size = page_size or settings.items_per_page return self._alerts_service.get_rules_page( sort_key=sort_key, @@ -138,6 +162,11 @@ def get_all(self, sort_key="CreatedAt", sort_direction="DESC"): generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of rules. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alerts_service.get_all_rules( sort_key=sort_key, sort_direction=sort_direction ) @@ -152,6 +181,11 @@ def get_all_by_name(self, rule_name): generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of rules with the given name. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alerts_service.get_all_rules_by_name(rule_name) def get_by_observer_id(self, observer_id): @@ -163,6 +197,11 @@ def get_by_observer_id(self, observer_id): Returns :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alerts_service.get_rule_by_observer_id(observer_id) diff --git a/src/py42/clients/alerts.py b/src/py42/clients/alerts.py index 914961563..0ef134ef1 100644 --- a/src/py42/clients/alerts.py +++ b/src/py42/clients/alerts.py @@ -1,5 +1,9 @@ +from warnings import warn + from py42.sdk.queries.alerts.filters import AlertState +# Incydr functionality is deprecated as of 2025-03. + class AlertsClient: """A client to expose alert API. @@ -18,6 +22,11 @@ def rules(self): Returns: :class:`py42.services.alertrules.AlertRulesClient` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alert_rules_client def search(self, query, page_num=1, page_size=None): @@ -35,6 +44,11 @@ def search(self, query, page_num=1, page_size=None): :class:`py42.response.Py42Response`: A response containing the alerts that match the given query. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alert_service.search(query, page_num, page_size) def search_all_pages(self, query): @@ -49,6 +63,11 @@ def search_all_pages(self, query): generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of alerts that match the given query. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alert_service.search_all_pages(query) def get_details(self, alert_ids): @@ -64,6 +83,11 @@ def get_details(self, alert_ids): Returns: :class:`py42.response.Py42Response`: A response containing the alert details. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alert_service.get_details(alert_ids) def resolve(self, alert_ids, reason=None): @@ -77,6 +101,11 @@ def resolve(self, alert_ids, reason=None): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alert_service.update_state( AlertState.DISMISSED, alert_ids, note=reason ) @@ -92,6 +121,11 @@ def reopen(self, alert_ids, reason=None): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alert_service.update_state(AlertState.OPEN, alert_ids, note=reason) def update_state(self, status, alert_ids, note=None): @@ -107,6 +141,11 @@ def update_state(self, status, alert_ids, note=None): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alert_service.update_state(status, alert_ids, note=note) def update_note(self, alert_id, note): @@ -120,6 +159,11 @@ def update_note(self, alert_id, note): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alert_service.update_note(alert_id, note) def get_aggregate_data(self, alert_id): @@ -131,6 +175,11 @@ def get_aggregate_data(self, alert_id): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._alert_service.get_aggregate_data(alert_id) def get_all_alert_details(self, query): @@ -149,6 +198,11 @@ def get_all_alert_details(self, query): Returns: generator: An object that iterates over alert detail items. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) query.page_size = 25 sort_key = query.sort_key[0].lower() + query.sort_key[1:] if sort_key == "alertId": diff --git a/src/py42/clients/auditlogs.py b/src/py42/clients/auditlogs.py index 560b69019..6ed42a21a 100644 --- a/src/py42/clients/auditlogs.py +++ b/src/py42/clients/auditlogs.py @@ -1,3 +1,8 @@ +from warnings import warn + +# Incydr functionality is deprecated as of 2025-03. + + class AuditLogsClient: """`Rest documentation `__""" @@ -43,6 +48,11 @@ def get_page( Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._audit_log_service.get_page( page_num=page_num, page_size=page_size, @@ -88,6 +98,11 @@ def get_all( generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of audit logs. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._audit_log_service.get_all( begin_time=begin_time, end_time=end_time, diff --git a/src/py42/clients/cases.py b/src/py42/clients/cases.py index 625997877..b19e75319 100644 --- a/src/py42/clients/cases.py +++ b/src/py42/clients/cases.py @@ -1,8 +1,11 @@ from datetime import datetime +from warnings import warn from py42.choices import Choices from py42.util import parse_timestamp_to_milliseconds_precision +# Incydr functionality is deprecated as of 2025-03. + class CaseStatus(Choices): """Constants available for setting the status of a case. @@ -50,6 +53,11 @@ def create( Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._cases_service.create( name, subject=subject, @@ -100,6 +108,11 @@ def get_page( Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) created_at = _make_range(min_create_time, max_create_time) updated_at = _make_range(min_update_time, max_update_time) @@ -159,6 +172,11 @@ def get_all( generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of cases. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) created_at = _make_range(min_create_time, max_create_time) updated_at = _make_range(min_update_time, max_update_time) @@ -186,6 +204,11 @@ def get(self, case_number): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._cases_service.get(case_number) def export_summary(self, case_number): @@ -199,6 +222,11 @@ def export_summary(self, case_number): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._cases_service.export_summary(case_number) def update( @@ -227,6 +255,11 @@ def update( Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._cases_service.update( case_number, name=name, diff --git a/src/py42/clients/securitydata.py b/src/py42/clients/securitydata.py index d7ab1ffb7..4c98fc03d 100644 --- a/src/py42/clients/securitydata.py +++ b/src/py42/clients/securitydata.py @@ -1,3 +1,5 @@ +from warnings import warn + from py42.exceptions import Py42ChecksumNotFoundError from py42.exceptions import Py42Error from py42.sdk.queries.fileevents.v2.file_event_query import FileEventQuery @@ -5,6 +7,8 @@ from py42.sdk.queries.fileevents.v2.filters.file import SHA256 from py42.services.util import escape_quote_chars +# Incydr functionality is deprecated as of 2025-03. + class SecurityDataClient: def __init__( @@ -40,6 +44,11 @@ def search_file_events(self, query): :class:`py42.response.Py42Response`: A response containing the first 10,000 events. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._file_event_service.search(query) def search_all_file_events(self, query, page_token=""): @@ -57,6 +66,11 @@ def search_all_file_events(self, query, page_token=""): Returns: :class:`py42.response.Py42Response`: A response containing a page of events. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) query.page_token = escape_quote_chars(page_token) response = self._file_event_service.search(query) @@ -71,6 +85,11 @@ def stream_file_by_sha256(self, checksum): Returns: Returns a stream of the requested file. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) response = self._search_by_hash(checksum, SHA256) events = response["fileEvents"] info = _get_version_lookup_info(events) @@ -87,6 +106,11 @@ def stream_file_by_md5(self, checksum): Returns: Returns a stream of the requested file. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) response = self._search_by_hash(checksum, MD5) events = response["fileEvents"] info = _get_version_lookup_info(events) diff --git a/src/py42/clients/trustedactivities.py b/src/py42/clients/trustedactivities.py index 5a5dc3982..37d088255 100644 --- a/src/py42/clients/trustedactivities.py +++ b/src/py42/clients/trustedactivities.py @@ -1,5 +1,9 @@ +from warnings import warn + from py42.choices import Choices +# Incydr functionality is deprecated as of 2025-03. + class TrustedActivityType(Choices): """Constants available for setting the type of a trusted activity. @@ -33,6 +37,11 @@ def get_all(self, type=None, page_size=None): generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of cases. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._trusted_activities_service.get_all(type, page_size) def create(self, type, value, description=None): @@ -47,6 +56,11 @@ def create(self, type, value, description=None): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._trusted_activities_service.create(type, value, description) def get(self, id): @@ -59,6 +73,11 @@ def get(self, id): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._trusted_activities_service.get(id) def update(self, id, value=None, description=None): @@ -73,6 +92,11 @@ def update(self, id, value=None, description=None): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._trusted_activities_service.update( id=id, value=value, description=description ) @@ -87,4 +111,9 @@ def delete(self, id): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._trusted_activities_service.delete(id) diff --git a/src/py42/clients/userriskprofile.py b/src/py42/clients/userriskprofile.py index dc7d5b34d..140121fc9 100644 --- a/src/py42/clients/userriskprofile.py +++ b/src/py42/clients/userriskprofile.py @@ -1,6 +1,10 @@ +from warnings import warn + from py42.exceptions import Py42Error from py42.exceptions import Py42NotFoundError +# Incydr functionality is deprecated as of 2025-03. + class UserRiskProfileClient: """A client to expose the user risk profile API. @@ -21,6 +25,11 @@ def get_by_id(self, user_id): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._user_risk_profile_service.get_by_id(user_id) def get_by_username(self, username): @@ -32,6 +41,11 @@ def get_by_username(self, username): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) user_response = self._user_service.get_by_username(username) if len(user_response.data["users"]) == 0: err = Py42Error() @@ -54,6 +68,11 @@ def update(self, user_id, start_date=None, end_date=None, notes=None): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._user_risk_profile_service.update( user_id, start_date, end_date, notes ) @@ -94,6 +113,11 @@ def get_page( Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._user_risk_profile_service.get_page( page_num, page_size, @@ -142,6 +166,11 @@ def get_all( Returns: generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of user risk profiles. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._user_risk_profile_service.get_all( manager_id, title, @@ -166,6 +195,11 @@ def add_cloud_aliases(self, user_id, cloud_alias): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._user_risk_profile_service.add_cloud_aliases(user_id, cloud_alias) def delete_cloud_aliases(self, user_id, cloud_aliases): @@ -178,6 +212,11 @@ def delete_cloud_aliases(self, user_id, cloud_aliases): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._user_risk_profile_service.delete_cloud_aliases( user_id, cloud_aliases ) diff --git a/src/py42/clients/watchlists.py b/src/py42/clients/watchlists.py index 7af7f741c..0843bfe35 100644 --- a/src/py42/clients/watchlists.py +++ b/src/py42/clients/watchlists.py @@ -1,5 +1,9 @@ +from warnings import warn + from py42.choices import Choices +# Incydr functionality is deprecated as of 2025-03. + class WatchlistType(Choices): """Constants available for setting the type of watchlist. @@ -46,6 +50,11 @@ def get(self, watchlist_id): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._watchlists_service.get(watchlist_id) def delete(self, watchlist_id): @@ -57,6 +66,11 @@ def delete(self, watchlist_id): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._watchlists_service.delete(watchlist_id) def get_all(self): @@ -65,6 +79,11 @@ def get_all(self): Returns: generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of watchlists. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._watchlists_service.get_all() def create(self, watchlist_type, title=None, description=None): @@ -78,6 +97,11 @@ def create(self, watchlist_type, title=None, description=None): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) if watchlist_type == "CUSTOM" and not title: raise ValueError("`title` value is required for custom watchlists.") return self._watchlists_service.create( @@ -93,6 +117,11 @@ def get_all_included_users(self, watchlist_id): Returns: generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of included users that match the given query. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._watchlists_service.get_all_included_users(watchlist_id) def add_included_users_by_watchlist_id(self, user_ids, watchlist_id): @@ -105,6 +134,11 @@ def add_included_users_by_watchlist_id(self, user_ids, watchlist_id): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._watchlists_service.add_included_users_by_watchlist_id( user_ids, watchlist_id ) @@ -119,6 +153,11 @@ def add_included_users_by_watchlist_type(self, user_ids, watchlist_type): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) if watchlist_type == "CUSTOM": raise ValueError( "Users can only be added to CUSTOM watchlists by watchlist ID." @@ -137,6 +176,11 @@ def remove_included_users_by_watchlist_id(self, user_ids, watchlist_id): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._watchlists_service.delete_included_users_by_watchlist_id( user_ids, watchlist_id ) @@ -151,6 +195,11 @@ def remove_included_users_by_watchlist_type(self, user_ids, watchlist_type): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) if watchlist_type == "CUSTOM": raise ValueError( "Users can only be removed from CUSTOM watchlists by watchlist ID." @@ -168,6 +217,11 @@ def get_all_watchlist_members(self, watchlist_id): Returns: generator: An object that iterates over :class:`py42.response.Py42Response` objects that each contain a page of watchlist members. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._watchlists_service.get_all_watchlist_members(watchlist_id) def get_watchlist_member(self, watchlist_id, user_id): @@ -180,4 +234,9 @@ def get_watchlist_member(self, watchlist_id, user_id): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self._watchlists_service.get_watchlist_member(watchlist_id, user_id) diff --git a/src/py42/sdk/queries/alerts/alert_query.py b/src/py42/sdk/queries/alerts/alert_query.py index 567e5111f..d422bad44 100644 --- a/src/py42/sdk/queries/alerts/alert_query.py +++ b/src/py42/sdk/queries/alerts/alert_query.py @@ -1,5 +1,9 @@ +from warnings import warn + from py42.sdk.queries import BaseQuery +# Incydr functionality is deprecated as of 2025-03. + class AlertQuery(BaseQuery): """Helper class for building Code42 Alert queries. @@ -19,6 +23,12 @@ class AlertQuery(BaseQuery): query = AlertQuery.all(state_filter, rule_name_filter) """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.sort_key = "CreatedAt" diff --git a/src/py42/sdk/queries/fileevents/file_event_query.py b/src/py42/sdk/queries/fileevents/file_event_query.py index b4465c5f0..db459053a 100644 --- a/src/py42/sdk/queries/fileevents/file_event_query.py +++ b/src/py42/sdk/queries/fileevents/file_event_query.py @@ -5,6 +5,9 @@ from py42.sdk.queries.fileevents.util import FileEventFilterStringField from py42.sdk.queries.fileevents.util import FileEventFilterTimestampField +# Incydr functionality is deprecated as of 2025-03. + + # import from util for backwards-compatibility diff --git a/src/py42/services/alertrules.py b/src/py42/services/alertrules.py index 0af3944f9..2ed001be7 100644 --- a/src/py42/services/alertrules.py +++ b/src/py42/services/alertrules.py @@ -2,6 +2,8 @@ from py42.exceptions import Py42NotFoundError from py42.services import BaseService +# Incydr functionality is deprecated as of 2025-03. + class AlertRulesService(BaseService): """A service to manage Alert Rules.""" diff --git a/src/py42/services/alerts.py b/src/py42/services/alerts.py index d8fc0540b..a0326b591 100644 --- a/src/py42/services/alerts.py +++ b/src/py42/services/alerts.py @@ -5,6 +5,8 @@ from py42.services import BaseService from py42.services.util import get_all_pages +# Incydr functionality is deprecated as of 2025-03. + class AlertService(BaseService): _uri_prefix = "/svc/api" diff --git a/src/py42/services/auditlogs.py b/src/py42/services/auditlogs.py index afe84b5e0..417c2e75d 100644 --- a/src/py42/services/auditlogs.py +++ b/src/py42/services/auditlogs.py @@ -17,6 +17,8 @@ HEADER_MAP = {"CSV": {"Accept": "text/csv"}, "CEF": {"Accept": "text/x-cef"}} +# Incydr functionality is deprecated as of 2025-03. + class AuditLogsService(BaseService): """https://support.code42.com/Administrator/Cloud/Monitoring_and_managing/Search_Audit_Log_events_with_the_Code42_API""" diff --git a/src/py42/services/fileevent.py b/src/py42/services/fileevent.py index 98ddaedd1..e3e0c682c 100644 --- a/src/py42/services/fileevent.py +++ b/src/py42/services/fileevent.py @@ -58,6 +58,11 @@ def search(self, query): Returns: :class:`py42.response.Py42Response`: A response containing the query results. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) self._mount_retry_adapter() # if string query @@ -68,14 +73,6 @@ def search(self, query): uri = f"/forensic-search/queryservice/api/{version}/fileevent" # else query object else: - # deprecation warning for v1 file events - if query.version == "v1": - warn( - "V1 file events are deprecated. Use V2 queries instead.", - DeprecationWarning, - stacklevel=2, - ) - uri = f"/forensic-search/queryservice/api/{query.version}/fileevent" query = dict(query) @@ -97,6 +94,12 @@ def get_file_location_detail_by_sha256(self, checksum): Returns: :class:`py42.response.Py42Response`: A response containing file details. """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) + self._mount_retry_adapter() uri = "/forensic-search/queryservice/api/v1/filelocations" diff --git a/src/py42/services/savedsearch.py b/src/py42/services/savedsearch.py index 4e73d130d..78061f058 100644 --- a/src/py42/services/savedsearch.py +++ b/src/py42/services/savedsearch.py @@ -36,15 +36,11 @@ def get(self, use_v2=False): Returns: :class:`py42.response.Py42Response` """ - - # deprecation warning for v1 file events - if not use_v2: - warn( - "V1 file events and saved searches are deprecated. Use v2 apis by passing in the optional use_v2=True arg.", - DeprecationWarning, - stacklevel=2, - ) - + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) self._version = "v2" if use_v2 else "v1" return self._connection.get(self.uri) @@ -61,14 +57,11 @@ def get_by_id(self, search_id, use_v2=False): Returns: :class:`py42.response.Py42Response` """ - - # deprecation warning for v1 file events - if not use_v2: - warn( - "V1 file events and saved searches are deprecated. Use v2 apis by passing in the optional use_v2=True arg.", - DeprecationWarning, - stacklevel=2, - ) + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) self._version = "v2" if use_v2 else "v1" return self._connection.get(f"{self.uri}/{search_id}") @@ -83,6 +76,11 @@ def get_query(self, search_id, page_number=None, page_size=None, use_v2=False): Returns: :class:`py42.sdk.queries.fileevents.v2.file_event_query.FileEventQuery` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) response = self.get_by_id(search_id, use_v2=use_v2) search = response["searches"][0] @@ -106,6 +104,11 @@ def execute(self, search_id, page_number=None, page_size=None, use_v2=False): Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) query = self.get_query( search_id, page_number=page_number, page_size=page_size, use_v2=use_v2 ) @@ -129,6 +132,11 @@ def search_file_events( Returns: :class:`py42.response.Py42Response` """ + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) return self.execute( search_id, page_number=page_number, page_size=page_size, use_v2=use_v2 ) From a2ca3e3fc2954616f00a1187203e5268f2790543 Mon Sep 17 00:00:00 2001 From: Cecilia Stevens <63068179+ceciliastevens@users.noreply.github.com> Date: Thu, 20 Mar 2025 10:49:28 -0400 Subject: [PATCH 2/4] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39d151c39..c81082529 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The intended audience of this file is for py42 consumers -- as such, changes that don't affect how a consumer would use the library (e.g. adding unit tests, updating documentation, etc) are not captured here. +## Unreleased + +### Deprecated + +- All Incydr functionality is deprecated. Use the Incydr SDK instead: https://developer.code42.com/ + ## 1.27.3 - 2024-12-18 ## Removed From fb9be8bfd706944564bb4d44a8cb00f0c2d887b4 Mon Sep 17 00:00:00 2001 From: Cecilia Stevens <63068179+ceciliastevens@users.noreply.github.com> Date: Thu, 20 Mar 2025 12:34:51 -0400 Subject: [PATCH 3/4] remove warning from alert query import --- src/py42/sdk/queries/alerts/alert_query.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/py42/sdk/queries/alerts/alert_query.py b/src/py42/sdk/queries/alerts/alert_query.py index d422bad44..ca6447a69 100644 --- a/src/py42/sdk/queries/alerts/alert_query.py +++ b/src/py42/sdk/queries/alerts/alert_query.py @@ -23,12 +23,6 @@ class AlertQuery(BaseQuery): query = AlertQuery.all(state_filter, rule_name_filter) """ - warn( - "Incydr functionality is deprecated. Use the Incydr SDK instead.", - DeprecationWarning, - stacklevel=2, - ) - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.sort_key = "CreatedAt" From 1fdf9ee07d461f5e749595a356297eb544bece5a Mon Sep 17 00:00:00 2001 From: Cecilia Stevens <63068179+ceciliastevens@users.noreply.github.com> Date: Thu, 20 Mar 2025 12:37:36 -0400 Subject: [PATCH 4/4] query warnings --- src/py42/sdk/queries/alerts/alert_query.py | 5 +++++ src/py42/sdk/queries/fileevents/v2/file_event_query.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/py42/sdk/queries/alerts/alert_query.py b/src/py42/sdk/queries/alerts/alert_query.py index ca6447a69..378777144 100644 --- a/src/py42/sdk/queries/alerts/alert_query.py +++ b/src/py42/sdk/queries/alerts/alert_query.py @@ -24,6 +24,11 @@ class AlertQuery(BaseQuery): """ def __init__(self, *args, **kwargs): + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) super().__init__(*args, **kwargs) self.sort_key = "CreatedAt" self.page_number = 0 diff --git a/src/py42/sdk/queries/fileevents/v2/file_event_query.py b/src/py42/sdk/queries/fileevents/v2/file_event_query.py index ff550437c..adce28e66 100644 --- a/src/py42/sdk/queries/fileevents/v2/file_event_query.py +++ b/src/py42/sdk/queries/fileevents/v2/file_event_query.py @@ -1,3 +1,5 @@ +from warnings import warn + from py42.sdk.queries import BaseQuery @@ -21,6 +23,11 @@ class FileEventQuery(BaseQuery): """ def __init__(self, *args, **kwargs): + warn( + "Incydr functionality is deprecated. Use the Incydr SDK instead.", + DeprecationWarning, + stacklevel=2, + ) super().__init__(*args, **kwargs) self.sort_key = "event.id"