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.
Files changed (55) hide show
  1. src/stackit/albwaf/__init__.py +164 -0
  2. src/stackit/albwaf/api/__init__.py +4 -0
  3. src/stackit/albwaf/api/default_api.py +4611 -0
  4. src/stackit/albwaf/api_client.py +649 -0
  5. src/stackit/albwaf/api_response.py +22 -0
  6. src/stackit/albwaf/configuration.py +162 -0
  7. src/stackit/albwaf/exceptions.py +217 -0
  8. src/stackit/albwaf/models/__init__.py +75 -0
  9. src/stackit/albwaf/models/action.py +37 -0
  10. src/stackit/albwaf/models/behavior.py +99 -0
  11. src/stackit/albwaf/models/condition.py +102 -0
  12. src/stackit/albwaf/models/condition_operator.py +87 -0
  13. src/stackit/albwaf/models/condition_variable.py +87 -0
  14. src/stackit/albwaf/models/create_custom_rule.py +109 -0
  15. src/stackit/albwaf/models/create_custom_rule_group_payload.py +154 -0
  16. src/stackit/albwaf/models/create_managed_rule_set_payload.py +141 -0
  17. src/stackit/albwaf/models/create_waf_payload.py +183 -0
  18. src/stackit/albwaf/models/crg_config_quota.py +87 -0
  19. src/stackit/albwaf/models/crg_usage.py +87 -0
  20. src/stackit/albwaf/models/get_behavior.py +107 -0
  21. src/stackit/albwaf/models/get_custom_rule.py +111 -0
  22. src/stackit/albwaf/models/get_custom_rule_group_response.py +118 -0
  23. src/stackit/albwaf/models/get_limited_managed_rule_set_response.py +119 -0
  24. src/stackit/albwaf/models/get_managed_rule_set_response.py +136 -0
  25. src/stackit/albwaf/models/get_quota_response.py +132 -0
  26. src/stackit/albwaf/models/get_waf_response.py +143 -0
  27. src/stackit/albwaf/models/google_protobuf_any.py +98 -0
  28. src/stackit/albwaf/models/list_custom_rule_group_response.py +121 -0
  29. src/stackit/albwaf/models/list_managed_rule_set_response.py +121 -0
  30. src/stackit/albwaf/models/list_waf_response.py +117 -0
  31. src/stackit/albwaf/models/mode.py +37 -0
  32. src/stackit/albwaf/models/mrs_config_quota.py +88 -0
  33. src/stackit/albwaf/models/mrs_rule.py +99 -0
  34. src/stackit/albwaf/models/mrs_rule_group.py +116 -0
  35. src/stackit/albwaf/models/mrs_usage.py +83 -0
  36. src/stackit/albwaf/models/operator.py +50 -0
  37. src/stackit/albwaf/models/patch_managed_rule_set_payload.py +161 -0
  38. src/stackit/albwaf/models/patch_mrs_rule.py +84 -0
  39. src/stackit/albwaf/models/patch_mrs_rule_group.py +99 -0
  40. src/stackit/albwaf/models/quotas.py +111 -0
  41. src/stackit/albwaf/models/severity.py +42 -0
  42. src/stackit/albwaf/models/status.py +112 -0
  43. src/stackit/albwaf/models/transformation.py +40 -0
  44. src/stackit/albwaf/models/type.py +35 -0
  45. src/stackit/albwaf/models/update_custom_rule_group_payload.py +158 -0
  46. src/stackit/albwaf/models/update_waf_payload.py +185 -0
  47. src/stackit/albwaf/models/variable.py +56 -0
  48. src/stackit/albwaf/models/waf_config_quota.py +88 -0
  49. src/stackit/albwaf/models/waf_usage.py +102 -0
  50. src/stackit/albwaf/models/waf_usage_item.py +91 -0
  51. src/stackit/albwaf/py.typed +0 -0
  52. src/stackit/albwaf/rest.py +163 -0
  53. stackit_albwaf-0.0.1.dist-info/METADATA +45 -0
  54. stackit_albwaf-0.0.1.dist-info/RECORD +55 -0
  55. stackit_albwaf-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,98 @@
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, StrictStr
21
+ from pydantic_core import to_jsonable_python
22
+ from typing_extensions import Self
23
+
24
+
25
+ class GoogleProtobufAny(BaseModel):
26
+ """
27
+ Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.
28
+ """ # noqa: E501
29
+
30
+ type: Optional[StrictStr] = Field(default=None, description="The type of the serialized message.", alias="@type")
31
+ additional_properties: Dict[str, Any] = {}
32
+ __properties: ClassVar[List[str]] = ["@type"]
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 GoogleProtobufAny 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
+ * Fields in `self.additional_properties` are added to the output dict.
64
+ """
65
+ excluded_fields: Set[str] = set(
66
+ [
67
+ "additional_properties",
68
+ ]
69
+ )
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # puts key-value pairs in additional_properties in the top level
77
+ if self.additional_properties is not None:
78
+ for _key, _value in self.additional_properties.items():
79
+ _dict[_key] = _value
80
+
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of GoogleProtobufAny from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({"@type": obj.get("@type")})
93
+ # store additional fields in additional_properties
94
+ for _key in obj.keys():
95
+ if _key not in cls.__properties:
96
+ _obj.additional_properties[_key] = obj.get(_key)
97
+
98
+ return _obj
@@ -0,0 +1,121 @@
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, field_validator
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Annotated, Self
24
+
25
+ from stackit.albwaf.models.get_custom_rule_group_response import (
26
+ GetCustomRuleGroupResponse,
27
+ )
28
+
29
+
30
+ class ListCustomRuleGroupResponse(BaseModel):
31
+ """
32
+ ListCustomRuleGroupResponse returns a list of Custom Rule Group responses.
33
+ """ # noqa: E501
34
+
35
+ items: Optional[List[GetCustomRuleGroupResponse]] = None
36
+ next_page_id: Optional[Annotated[str, Field(strict=True)]] = Field(
37
+ default=None,
38
+ description="Continue token from the ListCustomRuleGroupResponse with Limit option",
39
+ alias="nextPageId",
40
+ )
41
+ __properties: ClassVar[List[str]] = ["items", "nextPageId"]
42
+
43
+ @field_validator("next_page_id")
44
+ def next_page_id_validate_regular_expression(cls, value):
45
+ """Validates the regular expression"""
46
+ if value is None:
47
+ return value
48
+
49
+ if not isinstance(value, str):
50
+ value = str(value)
51
+
52
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
53
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
54
+ return value
55
+
56
+ model_config = ConfigDict(
57
+ validate_by_name=True,
58
+ validate_by_alias=True,
59
+ validate_assignment=True,
60
+ protected_namespaces=(),
61
+ )
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ return json.dumps(to_jsonable_python(self.to_dict()))
70
+
71
+ @classmethod
72
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
+ """Create an instance of ListCustomRuleGroupResponse from a JSON string"""
74
+ return cls.from_dict(json.loads(json_str))
75
+
76
+ def to_dict(self) -> Dict[str, Any]:
77
+ """Return the dictionary representation of the model using alias.
78
+
79
+ This has the following differences from calling pydantic's
80
+ `self.model_dump(by_alias=True)`:
81
+
82
+ * `None` is only added to the output dict for nullable fields that
83
+ were set at model initialization. Other fields with value `None`
84
+ are ignored.
85
+ """
86
+ excluded_fields: Set[str] = set([])
87
+
88
+ _dict = self.model_dump(
89
+ by_alias=True,
90
+ exclude=excluded_fields,
91
+ exclude_none=True,
92
+ )
93
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
94
+ _items = []
95
+ if self.items:
96
+ for _item_items in self.items:
97
+ if _item_items:
98
+ _items.append(_item_items.to_dict())
99
+ _dict["items"] = _items
100
+ return _dict
101
+
102
+ @classmethod
103
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104
+ """Create an instance of ListCustomRuleGroupResponse from a dict"""
105
+ if obj is None:
106
+ return None
107
+
108
+ if not isinstance(obj, dict):
109
+ return cls.model_validate(obj)
110
+
111
+ _obj = cls.model_validate(
112
+ {
113
+ "items": (
114
+ [GetCustomRuleGroupResponse.from_dict(_item) for _item in obj["items"]]
115
+ if obj.get("items") is not None
116
+ else None
117
+ ),
118
+ "nextPageId": obj.get("nextPageId"),
119
+ }
120
+ )
121
+ return _obj
@@ -0,0 +1,121 @@
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, field_validator
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Annotated, Self
24
+
25
+ from stackit.albwaf.models.get_limited_managed_rule_set_response import (
26
+ GetLimitedManagedRuleSetResponse,
27
+ )
28
+
29
+
30
+ class ListManagedRuleSetResponse(BaseModel):
31
+ """
32
+ ListManagedRuleSetResponse returns a list of rule configuration responses.
33
+ """ # noqa: E501
34
+
35
+ items: Optional[List[GetLimitedManagedRuleSetResponse]] = None
36
+ next_page_id: Optional[Annotated[str, Field(strict=True)]] = Field(
37
+ default=None,
38
+ description="Continue token from the ListManagedRuleSetResponse with Limit option",
39
+ alias="nextPageId",
40
+ )
41
+ __properties: ClassVar[List[str]] = ["items", "nextPageId"]
42
+
43
+ @field_validator("next_page_id")
44
+ def next_page_id_validate_regular_expression(cls, value):
45
+ """Validates the regular expression"""
46
+ if value is None:
47
+ return value
48
+
49
+ if not isinstance(value, str):
50
+ value = str(value)
51
+
52
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
53
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
54
+ return value
55
+
56
+ model_config = ConfigDict(
57
+ validate_by_name=True,
58
+ validate_by_alias=True,
59
+ validate_assignment=True,
60
+ protected_namespaces=(),
61
+ )
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ return json.dumps(to_jsonable_python(self.to_dict()))
70
+
71
+ @classmethod
72
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
+ """Create an instance of ListManagedRuleSetResponse from a JSON string"""
74
+ return cls.from_dict(json.loads(json_str))
75
+
76
+ def to_dict(self) -> Dict[str, Any]:
77
+ """Return the dictionary representation of the model using alias.
78
+
79
+ This has the following differences from calling pydantic's
80
+ `self.model_dump(by_alias=True)`:
81
+
82
+ * `None` is only added to the output dict for nullable fields that
83
+ were set at model initialization. Other fields with value `None`
84
+ are ignored.
85
+ """
86
+ excluded_fields: Set[str] = set([])
87
+
88
+ _dict = self.model_dump(
89
+ by_alias=True,
90
+ exclude=excluded_fields,
91
+ exclude_none=True,
92
+ )
93
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
94
+ _items = []
95
+ if self.items:
96
+ for _item_items in self.items:
97
+ if _item_items:
98
+ _items.append(_item_items.to_dict())
99
+ _dict["items"] = _items
100
+ return _dict
101
+
102
+ @classmethod
103
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104
+ """Create an instance of ListManagedRuleSetResponse from a dict"""
105
+ if obj is None:
106
+ return None
107
+
108
+ if not isinstance(obj, dict):
109
+ return cls.model_validate(obj)
110
+
111
+ _obj = cls.model_validate(
112
+ {
113
+ "items": (
114
+ [GetLimitedManagedRuleSetResponse.from_dict(_item) for _item in obj["items"]]
115
+ if obj.get("items") is not None
116
+ else None
117
+ ),
118
+ "nextPageId": obj.get("nextPageId"),
119
+ }
120
+ )
121
+ return _obj
@@ -0,0 +1,117 @@
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, field_validator
22
+ from pydantic_core import to_jsonable_python
23
+ from typing_extensions import Annotated, Self
24
+
25
+ from stackit.albwaf.models.get_waf_response import GetWAFResponse
26
+
27
+
28
+ class ListWAFResponse(BaseModel):
29
+ """
30
+ ListWAFResponse returns a list of WAF responses.
31
+ """ # noqa: E501
32
+
33
+ items: Optional[List[GetWAFResponse]] = None
34
+ next_page_id: Optional[Annotated[str, Field(strict=True)]] = Field(
35
+ default=None, description="Continue token from the ListWAFResponse with Limit option", alias="nextPageId"
36
+ )
37
+ __properties: ClassVar[List[str]] = ["items", "nextPageId"]
38
+
39
+ @field_validator("next_page_id")
40
+ def next_page_id_validate_regular_expression(cls, value):
41
+ """Validates the regular expression"""
42
+ if value is None:
43
+ return value
44
+
45
+ if not isinstance(value, str):
46
+ value = str(value)
47
+
48
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
49
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
50
+ return value
51
+
52
+ model_config = ConfigDict(
53
+ validate_by_name=True,
54
+ validate_by_alias=True,
55
+ validate_assignment=True,
56
+ protected_namespaces=(),
57
+ )
58
+
59
+ def to_str(self) -> str:
60
+ """Returns the string representation of the model using alias"""
61
+ return pprint.pformat(self.model_dump(by_alias=True))
62
+
63
+ def to_json(self) -> str:
64
+ """Returns the JSON representation of the model using alias"""
65
+ return json.dumps(to_jsonable_python(self.to_dict()))
66
+
67
+ @classmethod
68
+ def from_json(cls, json_str: str) -> Optional[Self]:
69
+ """Create an instance of ListWAFResponse from a JSON string"""
70
+ return cls.from_dict(json.loads(json_str))
71
+
72
+ def to_dict(self) -> Dict[str, Any]:
73
+ """Return the dictionary representation of the model using alias.
74
+
75
+ This has the following differences from calling pydantic's
76
+ `self.model_dump(by_alias=True)`:
77
+
78
+ * `None` is only added to the output dict for nullable fields that
79
+ were set at model initialization. Other fields with value `None`
80
+ are ignored.
81
+ """
82
+ excluded_fields: Set[str] = set([])
83
+
84
+ _dict = self.model_dump(
85
+ by_alias=True,
86
+ exclude=excluded_fields,
87
+ exclude_none=True,
88
+ )
89
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
90
+ _items = []
91
+ if self.items:
92
+ for _item_items in self.items:
93
+ if _item_items:
94
+ _items.append(_item_items.to_dict())
95
+ _dict["items"] = _items
96
+ return _dict
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
+ """Create an instance of ListWAFResponse from a dict"""
101
+ if obj is None:
102
+ return None
103
+
104
+ if not isinstance(obj, dict):
105
+ return cls.model_validate(obj)
106
+
107
+ _obj = cls.model_validate(
108
+ {
109
+ "items": (
110
+ [GetWAFResponse.from_dict(_item) for _item in obj["items"]]
111
+ if obj.get("items") is not None
112
+ else None
113
+ ),
114
+ "nextPageId": obj.get("nextPageId"),
115
+ }
116
+ )
117
+ return _obj
@@ -0,0 +1,37 @@
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 Mode(str, Enum):
23
+ """
24
+ The current mode of the rule.
25
+ """
26
+
27
+ """
28
+ allowed enum values
29
+ """
30
+ MODE_ENABLED = "MODE_ENABLED"
31
+ MODE_DISABLED = "MODE_DISABLED"
32
+ MODE_LOG_ONLY = "MODE_LOG_ONLY"
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of Mode from a JSON string"""
37
+ return cls(json.loads(json_str))
@@ -0,0 +1,88 @@
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 MRSConfigQuota(BaseModel):
26
+ """
27
+ MRS Config quota holds the limit and usage for Managed Rule Set configuration 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 Managed Rule Set configurations in this project."
32
+ )
33
+ usage: Optional[Annotated[int, Field(le=1000000, strict=True, ge=-1)]] = Field(
34
+ default=None,
35
+ description="The number of Managed Rule Set configurations that are currently existing in this project.",
36
+ )
37
+ __properties: ClassVar[List[str]] = ["limit", "usage"]
38
+
39
+ model_config = ConfigDict(
40
+ validate_by_name=True,
41
+ validate_by_alias=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ return json.dumps(to_jsonable_python(self.to_dict()))
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of MRSConfigQuota from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of MRSConfigQuota from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate({"limit": obj.get("limit"), "usage": obj.get("usage")})
88
+ 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
+ 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.mode import Mode
26
+
27
+
28
+ class MRSRule(BaseModel):
29
+ """
30
+ Rule represents an individual security or validation rule.
31
+ """ # noqa: E501
32
+
33
+ description: StrictStr = Field(description="A description of what this rule covers.")
34
+ mode: Mode
35
+ severity: Annotated[str, Field(strict=True)] = Field(description="Impact level.")
36
+ __properties: ClassVar[List[str]] = ["description", "mode", "severity"]
37
+
38
+ @field_validator("severity")
39
+ def severity_validate_regular_expression(cls, value):
40
+ """Validates the regular expression"""
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
44
+ if not re.match(r"^(CRITICAL|ERROR|WARNING|INFO)$", value):
45
+ raise ValueError(r"must validate the regular expression /^(CRITICAL|ERROR|WARNING|INFO)$/")
46
+ return value
47
+
48
+ model_config = ConfigDict(
49
+ validate_by_name=True,
50
+ validate_by_alias=True,
51
+ validate_assignment=True,
52
+ protected_namespaces=(),
53
+ )
54
+
55
+ def to_str(self) -> str:
56
+ """Returns the string representation of the model using alias"""
57
+ return pprint.pformat(self.model_dump(by_alias=True))
58
+
59
+ def to_json(self) -> str:
60
+ """Returns the JSON representation of the model using alias"""
61
+ return json.dumps(to_jsonable_python(self.to_dict()))
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of MRSRule from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of MRSRule from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate(
97
+ {"description": obj.get("description"), "mode": obj.get("mode"), "severity": obj.get("severity")}
98
+ )
99
+ return _obj