Skip to content

Commit

Permalink
linting and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alhumaw authored and jshcodes committed Jul 24, 2024
1 parent 99c9683 commit 8809e69
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 428 deletions.
3 changes: 1 addition & 2 deletions src/falconpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
from .cspm_registration import CSPMRegistration
from .custom_ioa import CustomIOA
from .custom_storage import CustomStorage
from .datascanner import DataScanner
from .d4c_registration import D4CRegistration
from .detects import Detects
from .device_control_policies import DeviceControlPolicies
Expand Down Expand Up @@ -203,7 +202,7 @@
"ContainerAlerts", "ContainerDetections", "ContainerImages", "ContainerPackages",
"ContainerVulnerabilities", "DriftIndicators", "UnidentifiedContainers",
"ImageAssessmentPolicies", "APIIntegrations", "ThreatGraph", "ExposureManagement",
"DataScanner", "CertificateBasedExclusions", "ComplianceAssessments", "HostMigration"
"CertificateBasedExclusions", "ComplianceAssessments", "HostMigration"
]
"""
This is free and unencumbered software released into the public domain.
Expand Down
4 changes: 0 additions & 4 deletions src/falconpy/_endpoint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from .deprecated import _scheduled_reports_deprecated
from .deprecated import _zero_trust_assessment_deprecated
from .deprecated import _certificate_based_exclusions_deprecated
from .deprecated import _datascanner_deprecated
from .deprecated import _deprecated_operation_mapping
from .deprecated import _deprecated_class_mapping

Expand Down Expand Up @@ -109,7 +108,6 @@
from ._spotlight_vulnerabilities import _spotlight_vulnerabilities_endpoints
from ._tailored_intelligence import _tailored_intelligence_endpoints
from ._threatgraph import _threatgraph_endpoints
from ._datascanner import _datascanner_endpoints
from ._unidentified_containers import _unidentified_containers_endpoints
from ._user_management import _user_management_endpoints
from ._workflows import _workflows_endpoints
Expand All @@ -132,7 +130,6 @@
api_endpoints.extend(_cspm_registration_endpoints)
api_endpoints.extend(_custom_ioa_endpoints)
api_endpoints.extend(_custom_storage_endpoints)
api_endpoints.extend(_datascanner_endpoints)
api_endpoints.extend(_d4c_registration_endpoints)
api_endpoints.extend(_detects_endpoints)
api_endpoints.extend(_device_control_policies_endpoints)
Expand Down Expand Up @@ -194,7 +191,6 @@
deprecated_endpoints = []
deprecated_endpoints.extend(_certificate_based_exclusions_deprecated)
deprecated_endpoints.extend(_custom_ioa_deprecated)
deprecated_endpoints.extend(_datascanner_deprecated)
deprecated_endpoints.extend(_d4c_registration_deprecated)
deprecated_endpoints.extend(_discover_deprecated)
deprecated_endpoints.extend(_fdr_deprecated)
Expand Down
80 changes: 0 additions & 80 deletions src/falconpy/_endpoint/_datascanner.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/falconpy/_endpoint/deprecated/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
from ._zero_trust_assessment import _zero_trust_assessment_endpoints
from ._mapping import _deprecated_op_mapping, _deprecated_cls_mapping
from ._certificate_based_exclusions import _certificate_based_exclusions_endpoints
from ._datascanner import _datascanner_endpoints

_custom_ioa_deprecated = _custom_ioa_endpoints
_d4c_registration_deprecated = _d4c_registration_endpoints
Expand All @@ -70,6 +69,5 @@
_scheduled_reports_deprecated = _scheduled_reports_endpoints
_zero_trust_assessment_deprecated = _zero_trust_assessment_endpoints
_certificate_based_exclusions_deprecated = _certificate_based_exclusions_endpoints
_datascanner_deprecated = _datascanner_endpoints
_deprecated_operation_mapping = _deprecated_op_mapping
_deprecated_class_mapping = _deprecated_cls_mapping
80 changes: 0 additions & 80 deletions src/falconpy/_endpoint/deprecated/_datascanner.py

This file was deleted.

62 changes: 32 additions & 30 deletions src/falconpy/_payload/_certificate_based_exclusions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,40 +35,42 @@
For more information, please refer to <https://unlicense.org>
"""

from typing import Dict, List, Union


def certificate_based_exclusions_payload(passed_keywords: dict) -> Dict[str, List[Dict[str, Union[str, int]]]]:
"""Create a properly formatted payload for exclusion creatio
{
"resources": [
{
"applied_globally": true,
"certificate": {
"issuer": "string",
"serial": "string",
"subject": "string",
"thumbprint": "string",
"valid_from": "2024-07-17T16:55:01.502Z",
"valid_to": "2024-07-17T16:55:01.502Z"
},
"children_cids": [
"string"
],
"comment": "string",
"created_by": "string",
"created_on": "2024-07-17T16:55:01.502Z",
"description": "string",
"host_groups": [
"string"
],
"modified_by": "string",
"modified_on": "2024-07-17T16:55:01.502Z",
"name": "string",
"status": "string"
}
]
}
"""Create a properly formatted payload for exclusion creation.
{
"resources": [
{
"applied_globally": true,
"certificate": {
"issuer": "string",
"serial": "string",
"subject": "string",
"thumbprint": "string",
"valid_from": "2024-07-17T16:55:01.502Z",
"valid_to": "2024-07-17T16:55:01.502Z"
},
"children_cids": [
"string"
],
"comment": "string",
"created_by": "string",
"created_on": "2024-07-17T16:55:01.502Z",
"description": "string",
"host_groups": [
"string"
],
"modified_by": "string",
"modified_on": "2024-07-17T16:55:01.502Z",
"name": "string",
"status": "string"
}
]
}
"""
returned = {
"resources": []
Expand Down
11 changes: 7 additions & 4 deletions src/falconpy/certificate_based_exclusions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
For more information, please refer to <https://unlicense.org>
"""

from typing import Dict, Union
from ._util import force_default, process_service_request, handle_single_argument
from ._service_class import ServiceClass
Expand All @@ -54,9 +55,10 @@ class CertificateBasedExclusions(ServiceClass):
- a previously-authenticated instance of the authentication service class (oauth2.py)
- a valid token provided by the authentication service class (oauth2.py)
"""

@force_default(defaults=["parameters"], default_types=["dict"])
def get_exclusions(self: object, *args, parameters: dict = None, **kwargs) -> Dict[str, Union[int, dict]]:
"""Find all exclusion IDs matching the query with filter
"""Find all exclusion IDs matching the query with filter.
Keyword arguments:
ids -- One or more exclusion IDs . String or list of strings.
Expand Down Expand Up @@ -130,7 +132,8 @@ def create_exclusions(self: object, body: dict = None, **kwargs) -> Dict[str, Un
calling_object=self,
endpoints=Endpoints,
operation_id="cb_exclusions_create_v1",
body=body
body=body,
keywords=kwargs
)

@force_default(defaults=["parameters"], default_types=["dict"])
Expand Down Expand Up @@ -159,7 +162,7 @@ def delete_exclusions(self: object, *args, parameters: dict = None, **kwargs) ->
keywords=kwargs,
params=handle_single_argument(args, parameters, "ids")
)

@force_default(defaults=["body"], default_types=["dict"])
def update_exclusions(self: object, body: dict = None, **kwargs) -> Dict[str, Union[int, dict]]:
"""Update Certificate Based Exclusions.
Expand Down Expand Up @@ -267,7 +270,7 @@ def query_certificates(self: object, parameters: dict = None, **kwargs) -> Dict[
keywords=kwargs,
params=parameters
)

# These method names align to the operation IDs in the API but
# do not conform to snake_case / PEP8 and are defined here for
# backwards compatibility / ease of use purposes
Expand Down
Loading

0 comments on commit 8809e69

Please sign in to comment.