Closes #177: Remove unnecessary method from http logging

This commit is contained in:
thatmattlove 2021-12-08 23:20:30 -07:00
parent 7d41dbf4bf
commit 56432013e0
3 changed files with 5 additions and 11 deletions

View file

@ -1,6 +1,7 @@
"""Input query validation model."""
# Standard Library
import typing as t
import hashlib
import secrets
from datetime import datetime
@ -99,6 +100,10 @@ class Query(BaseModel):
manager.execute(query=self)
log.debug("Validation passed for query {!r}", self)
def dict(self) -> t.Dict[str, str]:
"""Include only public fields."""
return super().dict(include={"query_location", "query_target", "query_type"})
@property
def device(self) -> Device:
"""Get this query's device object by query_location."""

View file

@ -1,8 +1,6 @@
"""Validate logging configuration."""
# Standard Library
import base64
from ast import literal_eval
from typing import Dict, Union, Optional
from pathlib import Path
@ -88,12 +86,6 @@ class Http(HyperglassModel, extra="allow"):
else:
dumped["auth"] = self.authentication.basic()
self._obscured_params = base64.encodebytes(str(dumped).encode())
def decoded(self):
"""Decode connection details."""
return literal_eval(base64.decodestring(self._obscured_params).decode())
class Logging(HyperglassModel):
"""Validation model for logging configuration."""

View file

@ -53,7 +53,6 @@ class Webhook(HyperglassModel):
query_location: StrictStr
query_type: StrictStr
query_vrf: StrictStr
query_target: StrictStr
headers: WebhookHeaders
source: StrictStr = "Unknown"
@ -92,7 +91,6 @@ class Webhook(HyperglassModel):
{"name": "Query Location", "value": self.query_location},
{"name": "Query Target", "value": code(self.query_target)},
{"name": "Query Type", "value": self.query_type},
{"name": "Query VRF", "value": self.query_vrf},
],
},
{"markdown": True, "text": "**Source Information**"},
@ -133,7 +131,6 @@ class Webhook(HyperglassModel):
{"type": "mrkdwn", "text": make_field("Query Location", self.query_location)},
{"type": "mrkdwn", "text": make_field("Query Target", self.query_target, code=True)},
{"type": "mrkdwn", "text": make_field("Query Type", self.query_type)},
{"type": "mrkdwn", "text": make_field("Query VRF", self.query_vrf)},
]
source_data = [