mirror of
https://github.com/brygphilomena/pyhuntress.git
synced 2025-11-04 16:27:30 +00:00
Fix the parse_one when passed the id number to agents, billing_reports, incident_reports, organizations, reports, and signals endpoints
This commit is contained in:
parent
bcf940e5ff
commit
2aa21e8044
@ -1,4 +1,5 @@
|
|||||||
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.endpoints.siem.AgentsIdEndpoint import AgentsIdEndpoint
|
||||||
from pyhuntress.interfaces import (
|
from pyhuntress.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
IPaginateable,
|
IPaginateable,
|
||||||
@ -21,16 +22,16 @@ class AgentsEndpoint(
|
|||||||
IGettable.__init__(self, SIEMAgents)
|
IGettable.__init__(self, SIEMAgents)
|
||||||
IPaginateable.__init__(self, SIEMAgents)
|
IPaginateable.__init__(self, SIEMAgents)
|
||||||
|
|
||||||
def id(self, id: int) -> HuntressEndpoint:
|
def id(self, id: int) -> AgentsIdEndpoint:
|
||||||
"""
|
"""
|
||||||
Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain.
|
Sets the ID for this endpoint and returns an initialized AgentsIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
id (int): The ID to set.
|
id (int): The ID to set.
|
||||||
Returns:
|
Returns:
|
||||||
HuntressEndpoint: The initialized HuntressEndpoint object.
|
AgentsIdEndpoint: The initialized AgentsIdEndpoint object.
|
||||||
"""
|
"""
|
||||||
child = HuntressEndpoint(self.client, parent_endpoint=self)
|
child = AgentsIdEndpoint(self.client, parent_endpoint=self)
|
||||||
child._id = id
|
child._id = id
|
||||||
return child
|
return child
|
||||||
|
|
||||||
|
|||||||
72
src/pyhuntress/endpoints/siem/AgentsIdEndpoint.py
Normal file
72
src/pyhuntress/endpoints/siem/AgentsIdEndpoint.py
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyhuntress.models.siem import SIEMAgents
|
||||||
|
from pyhuntress.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyhuntress.types import (
|
||||||
|
JSON,
|
||||||
|
HuntressSIEMRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class AgentsIdEndpoint(
|
||||||
|
HuntressEndpoint,
|
||||||
|
IGettable[SIEMAgents, HuntressSIEMRequestParams],
|
||||||
|
IPaginateable[SIEMAgents, HuntressSIEMRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, SIEMAgents)
|
||||||
|
IPaginateable.__init__(self, SIEMAgents)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[SIEMAgents]:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /agents endpoint and returns an initialized PaginatedResponse object.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
page (int): The page number to request.
|
||||||
|
limit (int): The number of results to return per page.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
PaginatedResponse[SIEMAgents]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page"] = page
|
||||||
|
params["limit"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page": page, "limit": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("GET", params=params),
|
||||||
|
SIEMAgents,
|
||||||
|
self,
|
||||||
|
"agents",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> SIEMAgents:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /agents endpoint.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
data (dict[str, Any]): The data to send in the request body.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
SIEMAuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
SIEMAgents,
|
||||||
|
super()._make_request("GET", data=data, params=params).json().get('agent', {}),
|
||||||
|
)
|
||||||
@ -1,4 +1,5 @@
|
|||||||
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.endpoints.siem.BillingreportsIdEndpoint import BillingIdreportsEndpoint
|
||||||
from pyhuntress.interfaces import (
|
from pyhuntress.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
IPaginateable,
|
IPaginateable,
|
||||||
@ -21,16 +22,16 @@ class BillingreportsEndpoint(
|
|||||||
IGettable.__init__(self, SIEMBillingReports)
|
IGettable.__init__(self, SIEMBillingReports)
|
||||||
IPaginateable.__init__(self, SIEMBillingReports)
|
IPaginateable.__init__(self, SIEMBillingReports)
|
||||||
|
|
||||||
def id(self, id: int) -> HuntressEndpoint:
|
def id(self, id: int) -> BillingIdreportsEndpoint:
|
||||||
"""
|
"""
|
||||||
Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain.
|
Sets the ID for this endpoint and returns an initialized BillingIdreportsEndpoint object to move down the chain.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
id (int): The ID to set.
|
id (int): The ID to set.
|
||||||
Returns:
|
Returns:
|
||||||
HuntressEndpoint: The initialized HuntressEndpoint object.
|
BillingIdreportsEndpoint: The initialized BillingIdreportsEndpoint object.
|
||||||
"""
|
"""
|
||||||
child = HuntressEndpoint(self.client, parent_endpoint=self)
|
child = BillingIdreportsEndpoint(self.client, parent_endpoint=self)
|
||||||
child._id = id
|
child._id = id
|
||||||
return child
|
return child
|
||||||
|
|
||||||
|
|||||||
72
src/pyhuntress/endpoints/siem/BillingreportsIdEndpoint.py
Normal file
72
src/pyhuntress/endpoints/siem/BillingreportsIdEndpoint.py
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyhuntress.models.siem import SIEMBillingReports
|
||||||
|
from pyhuntress.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyhuntress.types import (
|
||||||
|
JSON,
|
||||||
|
HuntressSIEMRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class BillingIdreportsEndpoint(
|
||||||
|
HuntressEndpoint,
|
||||||
|
IGettable[SIEMBillingReports, HuntressSIEMRequestParams],
|
||||||
|
IPaginateable[SIEMBillingReports, HuntressSIEMRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, SIEMBillingReports)
|
||||||
|
IPaginateable.__init__(self, SIEMBillingReports)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[SIEMBillingReports]:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /billing_reports endpoint and returns an initialized PaginatedResponse object.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
page (int): The page number to request.
|
||||||
|
limit (int): The number of results to return per page.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
PaginatedResponse[SIEMBillingReports]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page"] = page
|
||||||
|
params["limit"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page": page, "limit": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("GET", params=params),
|
||||||
|
SIEMBillingReports,
|
||||||
|
self,
|
||||||
|
"billing_reports",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> SIEMBillingReports:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /billing_reports endpoint.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
data (dict[str, Any]): The data to send in the request body.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
SIEMAuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
SIEMBillingReports,
|
||||||
|
super()._make_request("GET", data=data, params=params).json().get('billing_report', {}),
|
||||||
|
)
|
||||||
@ -1,4 +1,5 @@
|
|||||||
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.endpoints.siem.IncidentreportsIdEndpoint import IncidentreportsIdEndpoint
|
||||||
from pyhuntress.interfaces import (
|
from pyhuntress.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
IPaginateable,
|
IPaginateable,
|
||||||
@ -21,16 +22,16 @@ class IncidentreportsEndpoint(
|
|||||||
IGettable.__init__(self, SIEMIncidentReports)
|
IGettable.__init__(self, SIEMIncidentReports)
|
||||||
IPaginateable.__init__(self, SIEMIncidentReports)
|
IPaginateable.__init__(self, SIEMIncidentReports)
|
||||||
|
|
||||||
def id(self, id: int) -> HuntressEndpoint:
|
def id(self, id: int) -> IncidentreportsIdEndpoint:
|
||||||
"""
|
"""
|
||||||
Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain.
|
Sets the ID for this endpoint and returns an initialized IncidentreportsIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
id (int): The ID to set.
|
id (int): The ID to set.
|
||||||
Returns:
|
Returns:
|
||||||
HuntressEndpoint: The initialized HuntressEndpoint object.
|
IncidentreportsIdEndpoint: The initialized IncidentreportsIdEndpoint object.
|
||||||
"""
|
"""
|
||||||
child = HuntressEndpoint(self.client, parent_endpoint=self)
|
child = IncidentreportsIdEndpoint(self.client, parent_endpoint=self)
|
||||||
child._id = id
|
child._id = id
|
||||||
return child
|
return child
|
||||||
|
|
||||||
|
|||||||
72
src/pyhuntress/endpoints/siem/IncidentreportsIdEndpoint.py
Normal file
72
src/pyhuntress/endpoints/siem/IncidentreportsIdEndpoint.py
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyhuntress.models.siem import SIEMIncidentReports
|
||||||
|
from pyhuntress.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyhuntress.types import (
|
||||||
|
JSON,
|
||||||
|
HuntressSIEMRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class IncidentreportsIdEndpoint(
|
||||||
|
HuntressEndpoint,
|
||||||
|
IGettable[SIEMIncidentReports, HuntressSIEMRequestParams],
|
||||||
|
IPaginateable[SIEMIncidentReports, HuntressSIEMRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, SIEMIncidentReports)
|
||||||
|
IPaginateable.__init__(self, SIEMIncidentReports)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[SIEMIncidentReports]:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /incident_reports endpoint and returns an initialized PaginatedResponse object.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
page (int): The page number to request.
|
||||||
|
limit (int): The number of results to return per page.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
PaginatedResponse[SIEMIncidentReports]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page"] = page
|
||||||
|
params["limit"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page": page, "limit": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("GET", params=params),
|
||||||
|
SIEMIncidentReports,
|
||||||
|
self,
|
||||||
|
"incident_reports",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> SIEMIncidentReports:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /incident_reports endpoint.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
data (dict[str, Any]): The data to send in the request body.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
SIEMAuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
SIEMIncidentReports,
|
||||||
|
super()._make_request("GET", data=data, params=params).json().get('incident_report', {}),
|
||||||
|
)
|
||||||
@ -1,4 +1,5 @@
|
|||||||
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.endpoints.siem.OrganizationsIdEndpoint import OrganizationsIdEndpoint
|
||||||
from pyhuntress.interfaces import (
|
from pyhuntress.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
IPaginateable,
|
IPaginateable,
|
||||||
@ -21,16 +22,16 @@ class OrganizationsEndpoint(
|
|||||||
IGettable.__init__(self, SIEMOrganizations)
|
IGettable.__init__(self, SIEMOrganizations)
|
||||||
IPaginateable.__init__(self, SIEMOrganizations)
|
IPaginateable.__init__(self, SIEMOrganizations)
|
||||||
|
|
||||||
def id(self, id: int) -> HuntressEndpoint:
|
def id(self, id: int) -> OrganizationsIdEndpoint:
|
||||||
"""
|
"""
|
||||||
Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain.
|
Sets the ID for this endpoint and returns an initialized OrganizationsIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
id (int): The ID to set.
|
id (int): The ID to set.
|
||||||
Returns:
|
Returns:
|
||||||
HuntressEndpoint: The initialized HuntressEndpoint object.
|
OrganizationsIdEndpoint: The initialized OrganizationsIdEndpoint object.
|
||||||
"""
|
"""
|
||||||
child = HuntressEndpoint(self.client, parent_endpoint=self)
|
child = OrganizationsIdEndpoint(self.client, parent_endpoint=self)
|
||||||
child._id = id
|
child._id = id
|
||||||
return child
|
return child
|
||||||
|
|
||||||
|
|||||||
72
src/pyhuntress/endpoints/siem/OrganizationsIdEndpoint.py
Normal file
72
src/pyhuntress/endpoints/siem/OrganizationsIdEndpoint.py
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyhuntress.models.siem import SIEMOrganizations
|
||||||
|
from pyhuntress.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyhuntress.types import (
|
||||||
|
JSON,
|
||||||
|
HuntressSIEMRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class OrganizationsIdEndpoint(
|
||||||
|
HuntressEndpoint,
|
||||||
|
IGettable[SIEMOrganizations, HuntressSIEMRequestParams],
|
||||||
|
IPaginateable[SIEMOrganizations, HuntressSIEMRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, SIEMOrganizations)
|
||||||
|
IPaginateable.__init__(self, SIEMOrganizations)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[SIEMOrganizations]:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /organizations endpoint and returns an initialized PaginatedResponse object.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
page (int): The page number to request.
|
||||||
|
limit (int): The number of results to return per page.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
PaginatedResponse[SIEMOrganizations]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page"] = page
|
||||||
|
params["limit"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page": page, "limit": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("GET", params=params),
|
||||||
|
SIEMOrganizations,
|
||||||
|
self,
|
||||||
|
"organizations",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> SIEMOrganizations:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /organizations endpoint.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
data (dict[str, Any]): The data to send in the request body.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
SIEMAuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
SIEMOrganizations,
|
||||||
|
super()._make_request("GET", data=data, params=params).json().get('organization', {}),
|
||||||
|
)
|
||||||
@ -1,4 +1,5 @@
|
|||||||
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.endpoints.siem.ReportsIdEndpoint import ReportsIdEndpoint
|
||||||
from pyhuntress.interfaces import (
|
from pyhuntress.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
IPaginateable,
|
IPaginateable,
|
||||||
@ -21,16 +22,16 @@ class ReportsEndpoint(
|
|||||||
IGettable.__init__(self, SIEMReports)
|
IGettable.__init__(self, SIEMReports)
|
||||||
IPaginateable.__init__(self, SIEMReports)
|
IPaginateable.__init__(self, SIEMReports)
|
||||||
|
|
||||||
def id(self, id: int) -> HuntressEndpoint:
|
def id(self, id: int) -> ReportsIdEndpoint:
|
||||||
"""
|
"""
|
||||||
Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain.
|
Sets the ID for this endpoint and returns an initialized ReportsIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
id (int): The ID to set.
|
id (int): The ID to set.
|
||||||
Returns:
|
Returns:
|
||||||
HuntressEndpoint: The initialized HuntressEndpoint object.
|
ReportsIdEndpoint: The initialized ReportsIdEndpoint object.
|
||||||
"""
|
"""
|
||||||
child = HuntressEndpoint(self.client, parent_endpoint=self)
|
child = ReportsIdEndpoint(self.client, parent_endpoint=self)
|
||||||
child._id = id
|
child._id = id
|
||||||
return child
|
return child
|
||||||
|
|
||||||
|
|||||||
72
src/pyhuntress/endpoints/siem/ReportsIdEndpoint.py
Normal file
72
src/pyhuntress/endpoints/siem/ReportsIdEndpoint.py
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyhuntress.models.siem import SIEMReports
|
||||||
|
from pyhuntress.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyhuntress.types import (
|
||||||
|
JSON,
|
||||||
|
HuntressSIEMRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ReportsIdEndpoint(
|
||||||
|
HuntressEndpoint,
|
||||||
|
IGettable[SIEMReports, HuntressSIEMRequestParams],
|
||||||
|
IPaginateable[SIEMReports, HuntressSIEMRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, SIEMReports)
|
||||||
|
IPaginateable.__init__(self, SIEMReports)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[SIEMReports]:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /reports endpoint and returns an initialized PaginatedResponse object.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
page (int): The page number to request.
|
||||||
|
limit (int): The number of results to return per page.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
PaginatedResponse[SIEMReports]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page"] = page
|
||||||
|
params["limit"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page": page, "limit": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("GET", params=params),
|
||||||
|
SIEMReports,
|
||||||
|
self,
|
||||||
|
"reports",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> SIEMReports:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /reports endpoint.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
data (dict[str, Any]): The data to send in the request body.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
SIEMAuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
SIEMReports,
|
||||||
|
super()._make_request("GET", data=data, params=params).json().get('report', {}),
|
||||||
|
)
|
||||||
@ -1,4 +1,5 @@
|
|||||||
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.endpoints.siem.SignalsIdEndpoint import SignalsIdEndpoint
|
||||||
from pyhuntress.interfaces import (
|
from pyhuntress.interfaces import (
|
||||||
IGettable,
|
IGettable,
|
||||||
IPaginateable,
|
IPaginateable,
|
||||||
@ -21,16 +22,16 @@ class SignalsEndpoint(
|
|||||||
IGettable.__init__(self, SIEMSignals)
|
IGettable.__init__(self, SIEMSignals)
|
||||||
IPaginateable.__init__(self, SIEMSignals)
|
IPaginateable.__init__(self, SIEMSignals)
|
||||||
|
|
||||||
def id(self, id: int) -> HuntressEndpoint:
|
def id(self, id: int) -> SignalsIdEndpoint:
|
||||||
"""
|
"""
|
||||||
Sets the ID for this endpoint and returns an initialized HuntressEndpoint object to move down the chain.
|
Sets the ID for this endpoint and returns an initialized SignalsIdEndpoint object to move down the chain.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
id (int): The ID to set.
|
id (int): The ID to set.
|
||||||
Returns:
|
Returns:
|
||||||
HuntressEndpoint: The initialized HuntressEndpoint object.
|
SignalsIdEndpoint: The initialized SignalsIdEndpoint object.
|
||||||
"""
|
"""
|
||||||
child = HuntressEndpoint(self.client, parent_endpoint=self)
|
child = SignalsIdEndpoint(self.client, parent_endpoint=self)
|
||||||
child._id = id
|
child._id = id
|
||||||
return child
|
return child
|
||||||
|
|
||||||
|
|||||||
72
src/pyhuntress/endpoints/siem/SignalsIdEndpoint.py
Normal file
72
src/pyhuntress/endpoints/siem/SignalsIdEndpoint.py
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
from pyhuntress.endpoints.base.huntress_endpoint import HuntressEndpoint
|
||||||
|
from pyhuntress.interfaces import (
|
||||||
|
IGettable,
|
||||||
|
IPaginateable,
|
||||||
|
)
|
||||||
|
from pyhuntress.models.siem import SIEMSignals
|
||||||
|
from pyhuntress.responses.paginated_response import PaginatedResponse
|
||||||
|
from pyhuntress.types import (
|
||||||
|
JSON,
|
||||||
|
HuntressSIEMRequestParams,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SignalsIdEndpoint(
|
||||||
|
HuntressEndpoint,
|
||||||
|
IGettable[SIEMSignals, HuntressSIEMRequestParams],
|
||||||
|
IPaginateable[SIEMSignals, HuntressSIEMRequestParams],
|
||||||
|
):
|
||||||
|
def __init__(self, client, parent_endpoint=None) -> None:
|
||||||
|
HuntressEndpoint.__init__(self, client, "{id}", parent_endpoint=parent_endpoint)
|
||||||
|
IGettable.__init__(self, SIEMSignals)
|
||||||
|
IPaginateable.__init__(self, SIEMSignals)
|
||||||
|
|
||||||
|
def paginated(
|
||||||
|
self,
|
||||||
|
page: int,
|
||||||
|
limit: int,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> PaginatedResponse[SIEMSignals]:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /signals endpoint and returns an initialized PaginatedResponse object.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
page (int): The page number to request.
|
||||||
|
limit (int): The number of results to return per page.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
PaginatedResponse[SIEMSignals]: The initialized PaginatedResponse object.
|
||||||
|
"""
|
||||||
|
if params:
|
||||||
|
params["page"] = page
|
||||||
|
params["limit"] = limit
|
||||||
|
else:
|
||||||
|
params = {"page": page, "limit": limit}
|
||||||
|
return PaginatedResponse(
|
||||||
|
super()._make_request("GET", params=params),
|
||||||
|
SIEMSignals,
|
||||||
|
self,
|
||||||
|
"signals",
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
|
||||||
|
def get(
|
||||||
|
self,
|
||||||
|
data: JSON | None = None,
|
||||||
|
params: HuntressSIEMRequestParams | None = None,
|
||||||
|
) -> SIEMSignals:
|
||||||
|
"""
|
||||||
|
Performs a GET request against the /signals endpoint.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
data (dict[str, Any]): The data to send in the request body.
|
||||||
|
params (dict[str, int | str]): The parameters to send in the request query string.
|
||||||
|
Returns:
|
||||||
|
SIEMAuthInformation: The parsed response data.
|
||||||
|
"""
|
||||||
|
return self._parse_one(
|
||||||
|
SIEMSignals,
|
||||||
|
super()._make_request("GET", data=data, params=params).json().get('signal', {}),
|
||||||
|
)
|
||||||
@ -24,12 +24,24 @@ siem_api_client = HuntressSIEMAPIClient(
|
|||||||
#agents = siem_api_client.agents.get()
|
#agents = siem_api_client.agents.get()
|
||||||
#print(agents)
|
#print(agents)
|
||||||
|
|
||||||
|
#agents = siem_api_client.agents.id(3989773).get()
|
||||||
|
#print(agents)
|
||||||
|
|
||||||
#billingreports = siem_api_client.billing_reports.get()
|
#billingreports = siem_api_client.billing_reports.get()
|
||||||
#print(billingreports)
|
#print(billingreports)
|
||||||
|
|
||||||
|
#billingreports = siem_api_client.billing_reports.id(90173).get()
|
||||||
|
#print(billingreports)
|
||||||
|
|
||||||
#incidentreports = siem_api_client.incident_reports.get()
|
#incidentreports = siem_api_client.incident_reports.get()
|
||||||
#print(incidentreports)
|
#print(incidentreports)
|
||||||
|
|
||||||
|
incidentreports = siem_api_client.incident_reports.id(1448648).get()
|
||||||
|
print(incidentreports)
|
||||||
|
|
||||||
|
#organizations = siem_api_client.organizations.id(174759).get()
|
||||||
|
#print(organizations)
|
||||||
|
|
||||||
#organizations = siem_api_client.organizations.get()
|
#organizations = siem_api_client.organizations.get()
|
||||||
#print(organizations)
|
#print(organizations)
|
||||||
|
|
||||||
@ -39,16 +51,22 @@ siem_api_client = HuntressSIEMAPIClient(
|
|||||||
#signals = siem_api_client.signals.get()
|
#signals = siem_api_client.signals.get()
|
||||||
#print(signals)
|
#print(signals)
|
||||||
|
|
||||||
|
reports = siem_api_client.reports.id(2175766).get()
|
||||||
|
print(reports)
|
||||||
|
|
||||||
|
signals = siem_api_client.signals.id(36581548).get()
|
||||||
|
print(signals)
|
||||||
|
|
||||||
#paginated_billingreports = siem_api_client.billing_reports.paginated(1, 10)
|
#paginated_billingreports = siem_api_client.billing_reports.paginated(1, 10)
|
||||||
#print(paginated_billingreports.data)
|
#print(paginated_billingreports.data)
|
||||||
|
|
||||||
#paginated_incidentreports = siem_api_client.incident_reports.paginated(1, 10)
|
#paginated_incidentreports = siem_api_client.incident_reports.paginated(1, 10)
|
||||||
#print(paginated_incidentreports.data)
|
#print(paginated_incidentreports.data)
|
||||||
|
|
||||||
paginated_organizations = siem_api_client.organizations.paginated(1, 1)
|
#paginated_organizations = siem_api_client.organizations.paginated(2, 100)
|
||||||
print(paginated_organizations.data)
|
#print(paginated_organizations.data)
|
||||||
paginated_organizations.get_next_page()
|
#paginated_organizations.get_next_page()
|
||||||
print(paginated_organizations.data)
|
#print(paginated_organizations.data)
|
||||||
|
|
||||||
#paginated_reports = siem_api_client.reports.paginated(1, 10)
|
#paginated_reports = siem_api_client.reports.paginated(1, 10)
|
||||||
#print(paginated_reports.data)
|
#print(paginated_reports.data)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user