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,183 @@
|
|
|
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, StrictStr, field_validator
|
|
23
|
+
from pydantic_core import to_jsonable_python
|
|
24
|
+
from typing_extensions import Annotated, Self
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CreateWAFPayload(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
CreateWAFRequest creates a WAF with rules.
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
|
|
32
|
+
custom_rule_group_name: Optional[Annotated[str, Field(strict=True)]] = Field(
|
|
33
|
+
default=None, description="Name of the CRG configuration for that WAF.", alias="customRuleGroupName"
|
|
34
|
+
)
|
|
35
|
+
labels: Optional[Dict[str, StrictStr]] = Field(
|
|
36
|
+
default=None,
|
|
37
|
+
description="Labels represent user-defined metadata as key-value pairs. Label count should not exceed 64 per WAF. **Key Formatting Rules:** Length: 1-63 characters. Characters: Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. Keys starting with 'stackit-' are system-reserved; users MUST NOT manage them. **Value Formatting Rules:** Length: 0-63 characters (empty string explicitly allowed). Characters (for non-empty values): Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. ",
|
|
38
|
+
)
|
|
39
|
+
managed_rule_set_name: Optional[Annotated[str, Field(strict=True)]] = Field(
|
|
40
|
+
default=None, description="Name of the managed rule set configuration for that WAF.", alias="managedRuleSetName"
|
|
41
|
+
)
|
|
42
|
+
name: Annotated[str, Field(strict=True)] = Field(description="WAF name")
|
|
43
|
+
project_id: Optional[UUID] = Field(default=None, description="Project identifier", alias="projectId")
|
|
44
|
+
region: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Region")
|
|
45
|
+
__properties: ClassVar[List[str]] = [
|
|
46
|
+
"customRuleGroupName",
|
|
47
|
+
"labels",
|
|
48
|
+
"managedRuleSetName",
|
|
49
|
+
"name",
|
|
50
|
+
"projectId",
|
|
51
|
+
"region",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
@field_validator("custom_rule_group_name")
|
|
55
|
+
def custom_rule_group_name_validate_regular_expression(cls, value):
|
|
56
|
+
"""Validates the regular expression"""
|
|
57
|
+
if value is None:
|
|
58
|
+
return value
|
|
59
|
+
|
|
60
|
+
if not isinstance(value, str):
|
|
61
|
+
value = str(value)
|
|
62
|
+
|
|
63
|
+
if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
|
|
64
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
|
|
65
|
+
return value
|
|
66
|
+
|
|
67
|
+
@field_validator("managed_rule_set_name")
|
|
68
|
+
def managed_rule_set_name_validate_regular_expression(cls, value):
|
|
69
|
+
"""Validates the regular expression"""
|
|
70
|
+
if value is None:
|
|
71
|
+
return value
|
|
72
|
+
|
|
73
|
+
if not isinstance(value, str):
|
|
74
|
+
value = str(value)
|
|
75
|
+
|
|
76
|
+
if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
|
|
77
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
|
|
78
|
+
return value
|
|
79
|
+
|
|
80
|
+
@field_validator("name")
|
|
81
|
+
def name_validate_regular_expression(cls, value):
|
|
82
|
+
"""Validates the regular expression"""
|
|
83
|
+
if not isinstance(value, str):
|
|
84
|
+
value = str(value)
|
|
85
|
+
|
|
86
|
+
if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
|
|
87
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
|
|
88
|
+
return value
|
|
89
|
+
|
|
90
|
+
@field_validator("project_id")
|
|
91
|
+
def project_id_validate_regular_expression(cls, value):
|
|
92
|
+
"""Validates the regular expression"""
|
|
93
|
+
if value is None:
|
|
94
|
+
return value
|
|
95
|
+
|
|
96
|
+
if not isinstance(value, str):
|
|
97
|
+
value = str(value)
|
|
98
|
+
|
|
99
|
+
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):
|
|
100
|
+
raise ValueError(
|
|
101
|
+
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}$/"
|
|
102
|
+
)
|
|
103
|
+
return value
|
|
104
|
+
|
|
105
|
+
@field_validator("region")
|
|
106
|
+
def region_validate_regular_expression(cls, value):
|
|
107
|
+
"""Validates the regular expression"""
|
|
108
|
+
if value is None:
|
|
109
|
+
return value
|
|
110
|
+
|
|
111
|
+
if not isinstance(value, str):
|
|
112
|
+
value = str(value)
|
|
113
|
+
|
|
114
|
+
if not re.match(r"^[a-z]{2,4}[0-9]{2}$", value):
|
|
115
|
+
raise ValueError(r"must validate the regular expression /^[a-z]{2,4}[0-9]{2}$/")
|
|
116
|
+
return value
|
|
117
|
+
|
|
118
|
+
model_config = ConfigDict(
|
|
119
|
+
validate_by_name=True,
|
|
120
|
+
validate_by_alias=True,
|
|
121
|
+
validate_assignment=True,
|
|
122
|
+
protected_namespaces=(),
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
def to_str(self) -> str:
|
|
126
|
+
"""Returns the string representation of the model using alias"""
|
|
127
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
128
|
+
|
|
129
|
+
def to_json(self) -> str:
|
|
130
|
+
"""Returns the JSON representation of the model using alias"""
|
|
131
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
135
|
+
"""Create an instance of CreateWAFPayload from a JSON string"""
|
|
136
|
+
return cls.from_dict(json.loads(json_str))
|
|
137
|
+
|
|
138
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
139
|
+
"""Return the dictionary representation of the model using alias.
|
|
140
|
+
|
|
141
|
+
This has the following differences from calling pydantic's
|
|
142
|
+
`self.model_dump(by_alias=True)`:
|
|
143
|
+
|
|
144
|
+
* `None` is only added to the output dict for nullable fields that
|
|
145
|
+
were set at model initialization. Other fields with value `None`
|
|
146
|
+
are ignored.
|
|
147
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
148
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
149
|
+
"""
|
|
150
|
+
excluded_fields: Set[str] = set(
|
|
151
|
+
[
|
|
152
|
+
"project_id",
|
|
153
|
+
"region",
|
|
154
|
+
]
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
_dict = self.model_dump(
|
|
158
|
+
by_alias=True,
|
|
159
|
+
exclude=excluded_fields,
|
|
160
|
+
exclude_none=True,
|
|
161
|
+
)
|
|
162
|
+
return _dict
|
|
163
|
+
|
|
164
|
+
@classmethod
|
|
165
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
166
|
+
"""Create an instance of CreateWAFPayload from a dict"""
|
|
167
|
+
if obj is None:
|
|
168
|
+
return None
|
|
169
|
+
|
|
170
|
+
if not isinstance(obj, dict):
|
|
171
|
+
return cls.model_validate(obj)
|
|
172
|
+
|
|
173
|
+
_obj = cls.model_validate(
|
|
174
|
+
{
|
|
175
|
+
"customRuleGroupName": obj.get("customRuleGroupName"),
|
|
176
|
+
"labels": obj.get("labels"),
|
|
177
|
+
"managedRuleSetName": obj.get("managedRuleSetName"),
|
|
178
|
+
"name": obj.get("name"),
|
|
179
|
+
"projectId": obj.get("projectId"),
|
|
180
|
+
"region": obj.get("region"),
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
return _obj
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
|
21
|
+
from pydantic_core import to_jsonable_python
|
|
22
|
+
from typing_extensions import Annotated, Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CRGConfigQuota(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
CRG quotas holds the limit and usage for CRG resources
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
limit: Optional[Annotated[int, Field(le=1000000, strict=True, ge=-1)]] = Field(
|
|
31
|
+
default=None, description="The maximum number of custom rule groups in this project."
|
|
32
|
+
)
|
|
33
|
+
usage: Optional[Annotated[int, Field(le=1000000, strict=True, ge=-1)]] = Field(
|
|
34
|
+
default=None, description="The number of custom rule groups that are currently existing in this project."
|
|
35
|
+
)
|
|
36
|
+
__properties: ClassVar[List[str]] = ["limit", "usage"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
validate_by_name=True,
|
|
40
|
+
validate_by_alias=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of CRGConfigQuota from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
return _dict
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of CRGConfigQuota from a dict"""
|
|
80
|
+
if obj is None:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
if not isinstance(obj, dict):
|
|
84
|
+
return cls.model_validate(obj)
|
|
85
|
+
|
|
86
|
+
_obj = cls.model_validate({"limit": obj.get("limit"), "usage": obj.get("usage")})
|
|
87
|
+
return _obj
|
|
@@ -0,0 +1,87 @@
|
|
|
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 CRGUsage(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Tracking metrics for CRG resource utilization
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
count: Optional[StrictInt] = Field(
|
|
31
|
+
default=None, description="Number of WAF configurations actively using this rule group."
|
|
32
|
+
)
|
|
33
|
+
items: Optional[List[StrictStr]] = Field(
|
|
34
|
+
default=None, description="List of individual WAF configuration names that bind this rule group."
|
|
35
|
+
)
|
|
36
|
+
__properties: ClassVar[List[str]] = ["count", "items"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
validate_by_name=True,
|
|
40
|
+
validate_by_alias=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of CRGUsage from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
return _dict
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of CRGUsage from a dict"""
|
|
80
|
+
if obj is None:
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
if not isinstance(obj, dict):
|
|
84
|
+
return cls.model_validate(obj)
|
|
85
|
+
|
|
86
|
+
_obj = cls.model_validate({"count": obj.get("count"), "items": obj.get("items")})
|
|
87
|
+
return _obj
|
|
@@ -0,0 +1,107 @@
|
|
|
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 (
|
|
21
|
+
BaseModel,
|
|
22
|
+
ConfigDict,
|
|
23
|
+
Field,
|
|
24
|
+
StrictBool,
|
|
25
|
+
StrictStr,
|
|
26
|
+
)
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
from typing_extensions import Self
|
|
29
|
+
|
|
30
|
+
from stackit.albwaf.models.action import Action
|
|
31
|
+
from stackit.albwaf.models.severity import Severity
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class GetBehavior(BaseModel):
|
|
35
|
+
"""
|
|
36
|
+
GetBehavior
|
|
37
|
+
""" # noqa: E501
|
|
38
|
+
|
|
39
|
+
action: Action
|
|
40
|
+
log: StrictBool = Field(
|
|
41
|
+
description="Determines whether an entry should be generated in the security ledger upon a rule hit."
|
|
42
|
+
)
|
|
43
|
+
log_msg: Optional[StrictStr] = Field(
|
|
44
|
+
default=None,
|
|
45
|
+
description="Custom notification message string mapped to underlying logdata contexts.",
|
|
46
|
+
alias="logMsg",
|
|
47
|
+
)
|
|
48
|
+
severity: Severity
|
|
49
|
+
__properties: ClassVar[List[str]] = ["action", "log", "logMsg", "severity"]
|
|
50
|
+
|
|
51
|
+
model_config = ConfigDict(
|
|
52
|
+
validate_by_name=True,
|
|
53
|
+
validate_by_alias=True,
|
|
54
|
+
validate_assignment=True,
|
|
55
|
+
protected_namespaces=(),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
68
|
+
"""Create an instance of GetBehavior from a JSON string"""
|
|
69
|
+
return cls.from_dict(json.loads(json_str))
|
|
70
|
+
|
|
71
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
72
|
+
"""Return the dictionary representation of the model using alias.
|
|
73
|
+
|
|
74
|
+
This has the following differences from calling pydantic's
|
|
75
|
+
`self.model_dump(by_alias=True)`:
|
|
76
|
+
|
|
77
|
+
* `None` is only added to the output dict for nullable fields that
|
|
78
|
+
were set at model initialization. Other fields with value `None`
|
|
79
|
+
are ignored.
|
|
80
|
+
"""
|
|
81
|
+
excluded_fields: Set[str] = set([])
|
|
82
|
+
|
|
83
|
+
_dict = self.model_dump(
|
|
84
|
+
by_alias=True,
|
|
85
|
+
exclude=excluded_fields,
|
|
86
|
+
exclude_none=True,
|
|
87
|
+
)
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of GetBehavior from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate(
|
|
100
|
+
{
|
|
101
|
+
"action": obj.get("action"),
|
|
102
|
+
"log": obj.get("log"),
|
|
103
|
+
"logMsg": obj.get("logMsg"),
|
|
104
|
+
"severity": obj.get("severity"),
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
return _obj
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
from stackit.albwaf.models.condition import Condition
|
|
25
|
+
from stackit.albwaf.models.get_behavior import GetBehavior
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class GetCustomRule(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
GetCustomRule
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
behavior: GetBehavior
|
|
34
|
+
conditions: List[Condition] = Field(description="[HINT] Order matters! First condition match triggers execution.")
|
|
35
|
+
description: Optional[StrictStr] = Field(
|
|
36
|
+
default=None, description="A clear description explaining the threat vector or criteria addressed by this rule."
|
|
37
|
+
)
|
|
38
|
+
id: StrictInt = Field(description="Backend auto-allocated unique rule ID within the valid 1-99999 threshold.")
|
|
39
|
+
__properties: ClassVar[List[str]] = ["behavior", "conditions", "description", "id"]
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
validate_by_name=True,
|
|
43
|
+
validate_by_alias=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of GetCustomRule from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of behavior
|
|
79
|
+
if self.behavior:
|
|
80
|
+
_dict["behavior"] = self.behavior.to_dict()
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of each item in conditions (list)
|
|
82
|
+
_items = []
|
|
83
|
+
if self.conditions:
|
|
84
|
+
for _item_conditions in self.conditions:
|
|
85
|
+
if _item_conditions:
|
|
86
|
+
_items.append(_item_conditions.to_dict())
|
|
87
|
+
_dict["conditions"] = _items
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of GetCustomRule from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate(
|
|
100
|
+
{
|
|
101
|
+
"behavior": GetBehavior.from_dict(obj["behavior"]) if obj.get("behavior") is not None else None,
|
|
102
|
+
"conditions": (
|
|
103
|
+
[Condition.from_dict(_item) for _item in obj["conditions"]]
|
|
104
|
+
if obj.get("conditions") is not None
|
|
105
|
+
else None
|
|
106
|
+
),
|
|
107
|
+
"description": obj.get("description"),
|
|
108
|
+
"id": obj.get("id"),
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
return _obj
|