|
52 | 52 | import urllib3 |
53 | 53 | from urllib3.exceptions import InsecureRequestWarning |
54 | 54 | from .._api_request import APIRequest |
55 | | -from .._endpoint import operation_deprecation_mapping |
| 55 | +from .._endpoint import operation_deprecation_mapping, decommissioned_operations |
56 | 56 | from .._enum import BaseURL, ContainerBaseURL |
57 | 57 | from .._constant import ( |
58 | 58 | PREFER_NONETYPE, |
@@ -203,6 +203,8 @@ def factory(*args, **kwargs): |
203 | 203 | # Should only receive this in pythonic mode |
204 | 204 | raise api_error |
205 | 205 | except (SDKError, InvalidMethod) as bad_sdk_command: |
| 206 | + if getattr(bad_sdk_command, 'code', None) == 410: |
| 207 | + raise bad_sdk_command |
206 | 208 | created = bad_sdk_command.result |
207 | 209 | return created |
208 | 210 | return factory |
@@ -689,6 +691,13 @@ def process_service_request(calling_object: ServiceClass, # pylint: disable=R09 |
689 | 691 | # Log the operation ID if we have logging enabled. |
690 | 692 | if calling_object.log: |
691 | 693 | calling_object.log.debug("OPERATION: %s", operation_id) |
| 694 | + # Intercept decommissioned operations before making any API call. |
| 695 | + if operation_id in decommissioned_operations: |
| 696 | + _msg = (f"The {operation_id} operation has been decommissioned " |
| 697 | + f"by CrowdStrike and is no longer available.") |
| 698 | + if calling_object.log: |
| 699 | + calling_object.log.warning(_msg) |
| 700 | + return generate_error_result(message=_msg, code=410, caller=calling_object) |
692 | 701 | # We have to create our headers dictionary first, as authentication happens here. |
693 | 702 | # For scenarios where cloud region autodiscovery is leveraged, we cannot create |
694 | 703 | # the target URL for our call to requests until we know our correct base_url. |
|
0 commit comments