Coverage for fingerprint_server_sdk / models / event_rule_action_allow.py: 63%
38 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-11 18:41 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-11 18:41 +0000
1"""
2Server API
3Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios.
4Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.
6The version of the OpenAPI document: 4
7Contact: support@fingerprint.com
8Generated by OpenAPI Generator (https://openapi-generator.tech)
10Do not edit the class manually.
11""" # noqa: E501
13from __future__ import annotations
15import json
16import pprint
17import re # noqa: F401
18from typing import Any, ClassVar, Optional
20from pydantic import BaseModel, ConfigDict, Field, StrictStr
21from typing_extensions import Self
23from fingerprint_server_sdk.models.request_header_modifications import RequestHeaderModifications
24from fingerprint_server_sdk.models.rule_action_type import RuleActionType
27class EventRuleActionAllow(BaseModel):
28 """
29 Informs the client that the request should be forwarded to the origin with optional request header modifications.
30 """
32 ruleset_id: StrictStr = Field(description='The ID of the evaluated ruleset.')
33 rule_id: Optional[StrictStr] = Field(
34 default=None, description='The ID of the rule that matched the identification event.'
35 )
36 rule_expression: Optional[StrictStr] = Field(
37 default=None,
38 description='The expression of the rule that matched the identification event.',
39 )
40 type: RuleActionType
41 request_header_modifications: Optional[RequestHeaderModifications] = None
42 __properties: ClassVar[list[str]] = [
43 'ruleset_id',
44 'rule_id',
45 'rule_expression',
46 'type',
47 'request_header_modifications',
48 ]
50 model_config = ConfigDict(
51 populate_by_name=True,
52 validate_assignment=True,
53 protected_namespaces=(),
54 )
56 def to_str(self) -> str:
57 """Returns the string representation of the model using alias"""
58 return pprint.pformat(self.model_dump(by_alias=True))
60 def to_json(self) -> str:
61 """Returns the JSON representation of the model using alias"""
62 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
63 return json.dumps(self.to_dict())
65 @classmethod
66 def from_json(cls, json_str: str) -> Optional[Self]:
67 """Create an instance of EventRuleActionAllow from a JSON string"""
68 return cls.from_dict(json.loads(json_str))
70 def to_dict(self) -> dict[str, Any]:
71 """Return the dictionary representation of the model using alias.
73 This has the following differences from calling pydantic's
74 `self.model_dump(by_alias=True)`:
76 * `None` is only added to the output dict for nullable fields that
77 were set at model initialization. Other fields with value `None`
78 are ignored.
79 """
80 excluded_fields: set[str] = set([])
82 _dict = self.model_dump(
83 by_alias=True,
84 exclude=excluded_fields,
85 exclude_none=True,
86 )
87 # override the default output from pydantic by calling `to_dict()` of request_header_modifications
88 if self.request_header_modifications:
89 _dict['request_header_modifications'] = self.request_header_modifications.to_dict()
90 return _dict
92 @classmethod
93 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
94 """Create an instance of EventRuleActionAllow from a dict"""
95 if obj is None:
96 return None
98 if not isinstance(obj, dict):
99 return cls.model_validate(obj)
101 _obj = cls.model_validate(
102 {
103 'ruleset_id': obj.get('ruleset_id'),
104 'rule_id': obj.get('rule_id'),
105 'rule_expression': obj.get('rule_expression'),
106 'type': obj.get('type'),
107 'request_header_modifications': RequestHeaderModifications.from_dict(
108 obj['request_header_modifications']
109 )
110 if obj.get('request_header_modifications') is not None
111 else None,
112 }
113 )
114 return _obj