Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix requester documentation #702

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
### Features
### Improvements

* fix `requester` documentation
* replace `BaseException` with `Exception` for custom errors
* refactor `generic_resolver` to validate rules on startup instead of application of each rule
* rewrite the helper method `add_field_to` such that it always raises an `FieldExistsWarning` instead of return a bool.
* add new helper method `add_fields_to` to directly add multiple fields to one event
* refactored some processors to make use of the new helper methods


### Bugfix

- fix `confluent_kafka.store_offsets` if `last_valid_record` is `None`, can happen if a rebalancing happens
* fix `confluent_kafka.store_offsets` if `last_valid_record` is `None`, can happen if a rebalancing happens
before the first message was pulled.
- fix pseudonymizer cache metrics not updated

Expand Down
3 changes: 1 addition & 2 deletions logprep/processor/requester/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
requester:
url: https://internal.cmdb.local/api/v1/locations
method: POST
content_type: application/json
target_field: cmdb.location
header:
headers:
Authorization: Bearer askdfjpiowejf283u9r
json:
hostname: ${message.hostname}
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/processor/requester/test_requester_rule.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# pylint: disable=protected-access
# pylint: disable=missing-docstring
import pytest

from logprep.processor.requester.rule import RequesterRule


Expand All @@ -16,6 +17,21 @@ def test_create_from_dict_returns_requester_rule(self):
@pytest.mark.parametrize(
["rule", "error", "message"],
[
(
{
"filter": "domain",
"requester": {
"url": "https://internal.cmdb.local/api/v1/locations",
"method": "POST",
"target_field": "cmdb.location",
"headers": {"Authorization": "Bearer askdfjpiowejf283u9r"},
"json": {"hostname": "${message.hostname}"},
},
"description": "...",
},
None,
None,
),
(
{
"filter": "message",
Expand Down
Loading