stackit-albwaf 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- src/stackit/albwaf/__init__.py +164 -0
- src/stackit/albwaf/api/__init__.py +4 -0
- src/stackit/albwaf/api/default_api.py +4611 -0
- src/stackit/albwaf/api_client.py +649 -0
- src/stackit/albwaf/api_response.py +22 -0
- src/stackit/albwaf/configuration.py +162 -0
- src/stackit/albwaf/exceptions.py +217 -0
- src/stackit/albwaf/models/__init__.py +75 -0
- src/stackit/albwaf/models/action.py +37 -0
- src/stackit/albwaf/models/behavior.py +99 -0
- src/stackit/albwaf/models/condition.py +102 -0
- src/stackit/albwaf/models/condition_operator.py +87 -0
- src/stackit/albwaf/models/condition_variable.py +87 -0
- src/stackit/albwaf/models/create_custom_rule.py +109 -0
- src/stackit/albwaf/models/create_custom_rule_group_payload.py +154 -0
- src/stackit/albwaf/models/create_managed_rule_set_payload.py +141 -0
- src/stackit/albwaf/models/create_waf_payload.py +183 -0
- src/stackit/albwaf/models/crg_config_quota.py +87 -0
- src/stackit/albwaf/models/crg_usage.py +87 -0
- src/stackit/albwaf/models/get_behavior.py +107 -0
- src/stackit/albwaf/models/get_custom_rule.py +111 -0
- src/stackit/albwaf/models/get_custom_rule_group_response.py +118 -0
- src/stackit/albwaf/models/get_limited_managed_rule_set_response.py +119 -0
- src/stackit/albwaf/models/get_managed_rule_set_response.py +136 -0
- src/stackit/albwaf/models/get_quota_response.py +132 -0
- src/stackit/albwaf/models/get_waf_response.py +143 -0
- src/stackit/albwaf/models/google_protobuf_any.py +98 -0
- src/stackit/albwaf/models/list_custom_rule_group_response.py +121 -0
- src/stackit/albwaf/models/list_managed_rule_set_response.py +121 -0
- src/stackit/albwaf/models/list_waf_response.py +117 -0
- src/stackit/albwaf/models/mode.py +37 -0
- src/stackit/albwaf/models/mrs_config_quota.py +88 -0
- src/stackit/albwaf/models/mrs_rule.py +99 -0
- src/stackit/albwaf/models/mrs_rule_group.py +116 -0
- src/stackit/albwaf/models/mrs_usage.py +83 -0
- src/stackit/albwaf/models/operator.py +50 -0
- src/stackit/albwaf/models/patch_managed_rule_set_payload.py +161 -0
- src/stackit/albwaf/models/patch_mrs_rule.py +84 -0
- src/stackit/albwaf/models/patch_mrs_rule_group.py +99 -0
- src/stackit/albwaf/models/quotas.py +111 -0
- src/stackit/albwaf/models/severity.py +42 -0
- src/stackit/albwaf/models/status.py +112 -0
- src/stackit/albwaf/models/transformation.py +40 -0
- src/stackit/albwaf/models/type.py +35 -0
- src/stackit/albwaf/models/update_custom_rule_group_payload.py +158 -0
- src/stackit/albwaf/models/update_waf_payload.py +185 -0
- src/stackit/albwaf/models/variable.py +56 -0
- src/stackit/albwaf/models/waf_config_quota.py +88 -0
- src/stackit/albwaf/models/waf_usage.py +102 -0
- src/stackit/albwaf/models/waf_usage_item.py +91 -0
- src/stackit/albwaf/py.typed +0 -0
- src/stackit/albwaf/rest.py +163 -0
- stackit_albwaf-0.0.1.dist-info/METADATA +45 -0
- stackit_albwaf-0.0.1.dist-info/RECORD +55 -0
- stackit_albwaf-0.0.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Application Load Balancer Web Application Firewall API
|
|
5
|
+
|
|
6
|
+
Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have Managed Rule Set (MRS) and in addition can have Custom Rule Group (CRG). To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from pydantic_core import to_jsonable_python
|
|
23
|
+
from typing_extensions import Annotated, Self
|
|
24
|
+
|
|
25
|
+
from stackit.albwaf.models.mrs_rule import MRSRule
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class MRSRuleGroup(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
RuleGroup represents a collection of rules associated with a specific group.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
description: StrictStr = Field(description="A description of what this group covers.")
|
|
34
|
+
group_name: Annotated[str, Field(strict=True)] = Field(
|
|
35
|
+
description="The name for the rule group.", alias="groupName"
|
|
36
|
+
)
|
|
37
|
+
rules: Optional[Dict[str, MRSRule]] = None
|
|
38
|
+
__properties: ClassVar[List[str]] = ["description", "groupName", "rules"]
|
|
39
|
+
|
|
40
|
+
@field_validator("group_name")
|
|
41
|
+
def group_name_validate_regular_expression(cls, value):
|
|
42
|
+
"""Validates the regular expression"""
|
|
43
|
+
if not isinstance(value, str):
|
|
44
|
+
value = str(value)
|
|
45
|
+
|
|
46
|
+
if not re.match(r"^[a-zA-Z\(\) ]+$", value):
|
|
47
|
+
raise ValueError(r"must validate the regular expression /^[a-zA-Z\(\) ]+$/")
|
|
48
|
+
return value
|
|
49
|
+
|
|
50
|
+
model_config = ConfigDict(
|
|
51
|
+
validate_by_name=True,
|
|
52
|
+
validate_by_alias=True,
|
|
53
|
+
validate_assignment=True,
|
|
54
|
+
protected_namespaces=(),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
def to_str(self) -> str:
|
|
58
|
+
"""Returns the string representation of the model using alias"""
|
|
59
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
60
|
+
|
|
61
|
+
def to_json(self) -> str:
|
|
62
|
+
"""Returns the JSON representation of the model using alias"""
|
|
63
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
67
|
+
"""Create an instance of MRSRuleGroup from a JSON string"""
|
|
68
|
+
return cls.from_dict(json.loads(json_str))
|
|
69
|
+
|
|
70
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
71
|
+
"""Return the dictionary representation of the model using alias.
|
|
72
|
+
|
|
73
|
+
This has the following differences from calling pydantic's
|
|
74
|
+
`self.model_dump(by_alias=True)`:
|
|
75
|
+
|
|
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([])
|
|
81
|
+
|
|
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 each value in rules (dict)
|
|
88
|
+
_field_dict = {}
|
|
89
|
+
if self.rules:
|
|
90
|
+
for _key_rules in self.rules:
|
|
91
|
+
if self.rules[_key_rules]:
|
|
92
|
+
_field_dict[_key_rules] = self.rules[_key_rules].to_dict()
|
|
93
|
+
_dict["rules"] = _field_dict
|
|
94
|
+
return _dict
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
98
|
+
"""Create an instance of MRSRuleGroup from a dict"""
|
|
99
|
+
if obj is None:
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
if not isinstance(obj, dict):
|
|
103
|
+
return cls.model_validate(obj)
|
|
104
|
+
|
|
105
|
+
_obj = cls.model_validate(
|
|
106
|
+
{
|
|
107
|
+
"description": obj.get("description"),
|
|
108
|
+
"groupName": obj.get("groupName"),
|
|
109
|
+
"rules": (
|
|
110
|
+
dict((_k, MRSRule.from_dict(_v)) for _k, _v in obj["rules"].items())
|
|
111
|
+
if obj.get("rules") is not None
|
|
112
|
+
else None
|
|
113
|
+
),
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
return _obj
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Application Load Balancer Web Application Firewall API
|
|
5
|
+
|
|
6
|
+
Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have Managed Rule Set (MRS) and in addition can have Custom Rule Group (CRG). To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
|
+
from pydantic_core import to_jsonable_python
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class MRSUsage(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
MRSUsage
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
count: Optional[StrictInt] = Field(default=None, description="Number of WAFs using this Managed Rule Set.")
|
|
31
|
+
items: Optional[List[StrictStr]] = Field(default=None, description="List of WAFs that use this Managed Rule Set.")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["count", "items"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
validate_by_name=True,
|
|
36
|
+
validate_by_alias=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of MRSUsage from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of MRSUsage from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({"count": obj.get("count"), "items": obj.get("items")})
|
|
83
|
+
return _obj
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Application Load Balancer Web Application Firewall API
|
|
5
|
+
|
|
6
|
+
Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have Managed Rule Set (MRS) and in addition can have Custom Rule Group (CRG). To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
from enum import Enum
|
|
18
|
+
|
|
19
|
+
from typing_extensions import Self
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Operator(str, Enum):
|
|
23
|
+
"""
|
|
24
|
+
The operational evaluation type definition macro.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
allowed enum values
|
|
29
|
+
"""
|
|
30
|
+
OPERATOR_BEGINS_WITH = "OPERATOR_BEGINS_WITH"
|
|
31
|
+
OPERATOR_CONTAINS = "OPERATOR_CONTAINS"
|
|
32
|
+
OPERATOR_ENDS_WITH = "OPERATOR_ENDS_WITH"
|
|
33
|
+
OPERATOR_EQ = "OPERATOR_EQ"
|
|
34
|
+
OPERATOR_GE = "OPERATOR_GE"
|
|
35
|
+
OPERATOR_GT = "OPERATOR_GT"
|
|
36
|
+
OPERATOR_IP_MATCH = "OPERATOR_IP_MATCH"
|
|
37
|
+
OPERATOR_LE = "OPERATOR_LE"
|
|
38
|
+
OPERATOR_LT = "OPERATOR_LT"
|
|
39
|
+
OPERATOR_RX = "OPERATOR_RX"
|
|
40
|
+
OPERATOR_STREQ = "OPERATOR_STREQ"
|
|
41
|
+
OPERATOR_STRMATCH = "OPERATOR_STRMATCH"
|
|
42
|
+
OPERATOR_VALIDATE_SCHEMA = "OPERATOR_VALIDATE_SCHEMA"
|
|
43
|
+
OPERATOR_VALIDATE_URL_ENCODING = "OPERATOR_VALIDATE_URL_ENCODING"
|
|
44
|
+
OPERATOR_VALIDATE_UTF8_ENCODING = "OPERATOR_VALIDATE_UTF8_ENCODING"
|
|
45
|
+
OPERATOR_WITHIN = "OPERATOR_WITHIN"
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_json(cls, json_str: str) -> Self:
|
|
49
|
+
"""Create an instance of Operator from a JSON string"""
|
|
50
|
+
return cls(json.loads(json_str))
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Application Load Balancer Web Application Firewall API
|
|
5
|
+
|
|
6
|
+
Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have Managed Rule Set (MRS) and in addition can have Custom Rule Group (CRG). To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
from uuid import UUID
|
|
21
|
+
|
|
22
|
+
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
23
|
+
from pydantic_core import to_jsonable_python
|
|
24
|
+
from typing_extensions import Annotated, Self
|
|
25
|
+
|
|
26
|
+
from stackit.albwaf.models.patch_mrs_rule_group import PatchMRSRuleGroup
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class PatchManagedRuleSetPayload(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
PatchManagedRuleSetRequest updates a rules configuration.
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
|
|
34
|
+
groups: Dict[str, PatchMRSRuleGroup] = Field(
|
|
35
|
+
description="Map of Managed Rule Set groups to be patched. The key is the Group ID (e.g., 942 for SQL Injection). Only provided rules within the group will be updated; others remain unchanged."
|
|
36
|
+
)
|
|
37
|
+
name: Optional[Annotated[str, Field(strict=True)]] = Field(
|
|
38
|
+
default=None, description="Managed rule set configuration name."
|
|
39
|
+
)
|
|
40
|
+
project_id: Optional[UUID] = Field(default=None, description="Project identifier", alias="projectId")
|
|
41
|
+
region: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Region")
|
|
42
|
+
__properties: ClassVar[List[str]] = ["groups", "name", "projectId", "region"]
|
|
43
|
+
|
|
44
|
+
@field_validator("name")
|
|
45
|
+
def name_validate_regular_expression(cls, value):
|
|
46
|
+
"""Validates the regular expression"""
|
|
47
|
+
if value is None:
|
|
48
|
+
return value
|
|
49
|
+
|
|
50
|
+
if not isinstance(value, str):
|
|
51
|
+
value = str(value)
|
|
52
|
+
|
|
53
|
+
if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
|
|
54
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
|
|
55
|
+
return value
|
|
56
|
+
|
|
57
|
+
@field_validator("project_id")
|
|
58
|
+
def project_id_validate_regular_expression(cls, value):
|
|
59
|
+
"""Validates the regular expression"""
|
|
60
|
+
if value is None:
|
|
61
|
+
return value
|
|
62
|
+
|
|
63
|
+
if not isinstance(value, str):
|
|
64
|
+
value = str(value)
|
|
65
|
+
|
|
66
|
+
if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$", value):
|
|
67
|
+
raise ValueError(
|
|
68
|
+
r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/"
|
|
69
|
+
)
|
|
70
|
+
return value
|
|
71
|
+
|
|
72
|
+
@field_validator("region")
|
|
73
|
+
def region_validate_regular_expression(cls, value):
|
|
74
|
+
"""Validates the regular expression"""
|
|
75
|
+
if value is None:
|
|
76
|
+
return value
|
|
77
|
+
|
|
78
|
+
if not isinstance(value, str):
|
|
79
|
+
value = str(value)
|
|
80
|
+
|
|
81
|
+
if not re.match(r"^[a-z]{2,4}[0-9]{2}$", value):
|
|
82
|
+
raise ValueError(r"must validate the regular expression /^[a-z]{2,4}[0-9]{2}$/")
|
|
83
|
+
return value
|
|
84
|
+
|
|
85
|
+
model_config = ConfigDict(
|
|
86
|
+
validate_by_name=True,
|
|
87
|
+
validate_by_alias=True,
|
|
88
|
+
validate_assignment=True,
|
|
89
|
+
protected_namespaces=(),
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
def to_str(self) -> str:
|
|
93
|
+
"""Returns the string representation of the model using alias"""
|
|
94
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
95
|
+
|
|
96
|
+
def to_json(self) -> str:
|
|
97
|
+
"""Returns the JSON representation of the model using alias"""
|
|
98
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
102
|
+
"""Create an instance of PatchManagedRuleSetPayload from a JSON string"""
|
|
103
|
+
return cls.from_dict(json.loads(json_str))
|
|
104
|
+
|
|
105
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
106
|
+
"""Return the dictionary representation of the model using alias.
|
|
107
|
+
|
|
108
|
+
This has the following differences from calling pydantic's
|
|
109
|
+
`self.model_dump(by_alias=True)`:
|
|
110
|
+
|
|
111
|
+
* `None` is only added to the output dict for nullable fields that
|
|
112
|
+
were set at model initialization. Other fields with value `None`
|
|
113
|
+
are ignored.
|
|
114
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
115
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
116
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
117
|
+
"""
|
|
118
|
+
excluded_fields: Set[str] = set(
|
|
119
|
+
[
|
|
120
|
+
"name",
|
|
121
|
+
"project_id",
|
|
122
|
+
"region",
|
|
123
|
+
]
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
_dict = self.model_dump(
|
|
127
|
+
by_alias=True,
|
|
128
|
+
exclude=excluded_fields,
|
|
129
|
+
exclude_none=True,
|
|
130
|
+
)
|
|
131
|
+
# override the default output from pydantic by calling `to_dict()` of each value in groups (dict)
|
|
132
|
+
_field_dict = {}
|
|
133
|
+
if self.groups:
|
|
134
|
+
for _key_groups in self.groups:
|
|
135
|
+
if self.groups[_key_groups]:
|
|
136
|
+
_field_dict[_key_groups] = self.groups[_key_groups].to_dict()
|
|
137
|
+
_dict["groups"] = _field_dict
|
|
138
|
+
return _dict
|
|
139
|
+
|
|
140
|
+
@classmethod
|
|
141
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
142
|
+
"""Create an instance of PatchManagedRuleSetPayload from a dict"""
|
|
143
|
+
if obj is None:
|
|
144
|
+
return None
|
|
145
|
+
|
|
146
|
+
if not isinstance(obj, dict):
|
|
147
|
+
return cls.model_validate(obj)
|
|
148
|
+
|
|
149
|
+
_obj = cls.model_validate(
|
|
150
|
+
{
|
|
151
|
+
"groups": (
|
|
152
|
+
dict((_k, PatchMRSRuleGroup.from_dict(_v)) for _k, _v in obj["groups"].items())
|
|
153
|
+
if obj.get("groups") is not None
|
|
154
|
+
else None
|
|
155
|
+
),
|
|
156
|
+
"name": obj.get("name"),
|
|
157
|
+
"projectId": obj.get("projectId"),
|
|
158
|
+
"region": obj.get("region"),
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
return _obj
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Application Load Balancer Web Application Firewall API
|
|
5
|
+
|
|
6
|
+
Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have Managed Rule Set (MRS) and in addition can have Custom Rule Group (CRG). To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict
|
|
21
|
+
from pydantic_core import to_jsonable_python
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from stackit.albwaf.models.mode import Mode
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PatchMRSRule(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PatchMRSRule
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
|
|
32
|
+
mode: Optional[Mode] = None
|
|
33
|
+
__properties: ClassVar[List[str]] = ["mode"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of PatchMRSRule from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
return _dict
|
|
73
|
+
|
|
74
|
+
@classmethod
|
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
76
|
+
"""Create an instance of PatchMRSRule from a dict"""
|
|
77
|
+
if obj is None:
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
if not isinstance(obj, dict):
|
|
81
|
+
return cls.model_validate(obj)
|
|
82
|
+
|
|
83
|
+
_obj = cls.model_validate({"mode": obj.get("mode")})
|
|
84
|
+
return _obj
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Application Load Balancer Web Application Firewall API
|
|
5
|
+
|
|
6
|
+
Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have Managed Rule Set (MRS) and in addition can have Custom Rule Group (CRG). To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict
|
|
21
|
+
from pydantic_core import to_jsonable_python
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from stackit.albwaf.models.patch_mrs_rule import PatchMRSRule
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PatchMRSRuleGroup(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PatchMRSRuleGroup
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
|
|
32
|
+
rules: Dict[str, PatchMRSRule]
|
|
33
|
+
__properties: ClassVar[List[str]] = ["rules"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of PatchMRSRuleGroup from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
# override the default output from pydantic by calling `to_dict()` of each value in rules (dict)
|
|
73
|
+
_field_dict = {}
|
|
74
|
+
if self.rules:
|
|
75
|
+
for _key_rules in self.rules:
|
|
76
|
+
if self.rules[_key_rules]:
|
|
77
|
+
_field_dict[_key_rules] = self.rules[_key_rules].to_dict()
|
|
78
|
+
_dict["rules"] = _field_dict
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of PatchMRSRuleGroup from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate(
|
|
91
|
+
{
|
|
92
|
+
"rules": (
|
|
93
|
+
dict((_k, PatchMRSRule.from_dict(_v)) for _k, _v in obj["rules"].items())
|
|
94
|
+
if obj.get("rules") is not None
|
|
95
|
+
else None
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
return _obj
|