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,118 @@
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.crg_usage import CRGUsage
26
+ from stackit.albwaf.models.get_custom_rule import GetCustomRule
27
+
28
+
29
+ class GetCustomRuleGroupResponse(BaseModel):
30
+ """
31
+ Response payload delivering the detailed CRG configuration name and it's rule content.
32
+ """ # noqa: E501
33
+
34
+ name: Annotated[str, Field(strict=True)] = Field(description="Custom rule group configuration name.")
35
+ rules: List[GetCustomRule] = Field(
36
+ description="Enriched rules containing auto-generated IDs and computed severity values."
37
+ )
38
+ usage: Optional[CRGUsage] = None
39
+ __properties: ClassVar[List[str]] = ["name", "rules", "usage"]
40
+
41
+ @field_validator("name")
42
+ def name_validate_regular_expression(cls, value):
43
+ """Validates the regular expression"""
44
+ if not isinstance(value, str):
45
+ value = str(value)
46
+
47
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
48
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
49
+ return value
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 GetCustomRuleGroupResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in rules (list)
89
+ _items = []
90
+ if self.rules:
91
+ for _item_rules in self.rules:
92
+ if _item_rules:
93
+ _items.append(_item_rules.to_dict())
94
+ _dict["rules"] = _items
95
+ # override the default output from pydantic by calling `to_dict()` of usage
96
+ if self.usage:
97
+ _dict["usage"] = self.usage.to_dict()
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of GetCustomRuleGroupResponse from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate(
110
+ {
111
+ "name": obj.get("name"),
112
+ "rules": (
113
+ [GetCustomRule.from_dict(_item) for _item in obj["rules"]] if obj.get("rules") is not None else None
114
+ ),
115
+ "usage": CRGUsage.from_dict(obj["usage"]) if obj.get("usage") is not None else None,
116
+ }
117
+ )
118
+ return _obj
@@ -0,0 +1,119 @@
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.mrs_usage import MRSUsage
26
+ from stackit.albwaf.models.type import Type
27
+
28
+
29
+ class GetLimitedManagedRuleSetResponse(BaseModel):
30
+ """
31
+ GetLimitedManagedRuleSetResponse
32
+ """ # noqa: E501
33
+
34
+ name: Annotated[str, Field(strict=True)] = Field(description="Managed rule set configuration name.")
35
+ type: Type
36
+ usage: Optional[MRSUsage] = None
37
+ version: Annotated[str, Field(strict=True)] = Field(description="Managed rule set version.")
38
+ __properties: ClassVar[List[str]] = ["name", "type", "usage", "version"]
39
+
40
+ @field_validator("name")
41
+ def 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"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
47
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
48
+ return value
49
+
50
+ @field_validator("version")
51
+ def version_validate_regular_expression(cls, value):
52
+ """Validates the regular expression"""
53
+ if not isinstance(value, str):
54
+ value = str(value)
55
+
56
+ if not re.match(r"^v\d+\.\d+\.\d+$", value):
57
+ raise ValueError(r"must validate the regular expression /^v\d+\.\d+\.\d+$/")
58
+ return value
59
+
60
+ model_config = ConfigDict(
61
+ validate_by_name=True,
62
+ validate_by_alias=True,
63
+ validate_assignment=True,
64
+ protected_namespaces=(),
65
+ )
66
+
67
+ def to_str(self) -> str:
68
+ """Returns the string representation of the model using alias"""
69
+ return pprint.pformat(self.model_dump(by_alias=True))
70
+
71
+ def to_json(self) -> str:
72
+ """Returns the JSON representation of the model using alias"""
73
+ return json.dumps(to_jsonable_python(self.to_dict()))
74
+
75
+ @classmethod
76
+ def from_json(cls, json_str: str) -> Optional[Self]:
77
+ """Create an instance of GetLimitedManagedRuleSetResponse from a JSON string"""
78
+ return cls.from_dict(json.loads(json_str))
79
+
80
+ def to_dict(self) -> Dict[str, Any]:
81
+ """Return the dictionary representation of the model using alias.
82
+
83
+ This has the following differences from calling pydantic's
84
+ `self.model_dump(by_alias=True)`:
85
+
86
+ * `None` is only added to the output dict for nullable fields that
87
+ were set at model initialization. Other fields with value `None`
88
+ are ignored.
89
+ """
90
+ excluded_fields: Set[str] = set([])
91
+
92
+ _dict = self.model_dump(
93
+ by_alias=True,
94
+ exclude=excluded_fields,
95
+ exclude_none=True,
96
+ )
97
+ # override the default output from pydantic by calling `to_dict()` of usage
98
+ if self.usage:
99
+ _dict["usage"] = self.usage.to_dict()
100
+ return _dict
101
+
102
+ @classmethod
103
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104
+ """Create an instance of GetLimitedManagedRuleSetResponse 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
+ "name": obj.get("name"),
114
+ "type": obj.get("type"),
115
+ "usage": MRSUsage.from_dict(obj["usage"]) if obj.get("usage") is not None else None,
116
+ "version": obj.get("version"),
117
+ }
118
+ )
119
+ return _obj
@@ -0,0 +1,136 @@
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.mrs_rule_group import MRSRuleGroup
26
+ from stackit.albwaf.models.mrs_usage import MRSUsage
27
+ from stackit.albwaf.models.type import Type
28
+
29
+
30
+ class GetManagedRuleSetResponse(BaseModel):
31
+ """
32
+ GetManagedRuleSetResponse returns rule configuration name and it's rules.
33
+ """ # noqa: E501
34
+
35
+ groups: Optional[Dict[str, MRSRuleGroup]] = Field(
36
+ default=None,
37
+ description="Inventory of all available Managed Rule Set groups and their current configuration. The key is the unique Group ID.",
38
+ )
39
+ name: Annotated[str, Field(strict=True)] = Field(description="Managed rule set configuration name.")
40
+ type: Type
41
+ usage: Optional[MRSUsage] = None
42
+ version: Annotated[str, Field(strict=True)] = Field(description="Managed rule set version.")
43
+ __properties: ClassVar[List[str]] = ["groups", "name", "type", "usage", "version"]
44
+
45
+ @field_validator("name")
46
+ def name_validate_regular_expression(cls, value):
47
+ """Validates the regular expression"""
48
+ if not isinstance(value, str):
49
+ value = str(value)
50
+
51
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
52
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
53
+ return value
54
+
55
+ @field_validator("version")
56
+ def version_validate_regular_expression(cls, value):
57
+ """Validates the regular expression"""
58
+ if not isinstance(value, str):
59
+ value = str(value)
60
+
61
+ if not re.match(r"^v\d+\.\d+\.\d+$", value):
62
+ raise ValueError(r"must validate the regular expression /^v\d+\.\d+\.\d+$/")
63
+ return value
64
+
65
+ model_config = ConfigDict(
66
+ validate_by_name=True,
67
+ validate_by_alias=True,
68
+ validate_assignment=True,
69
+ protected_namespaces=(),
70
+ )
71
+
72
+ def to_str(self) -> str:
73
+ """Returns the string representation of the model using alias"""
74
+ return pprint.pformat(self.model_dump(by_alias=True))
75
+
76
+ def to_json(self) -> str:
77
+ """Returns the JSON representation of the model using alias"""
78
+ return json.dumps(to_jsonable_python(self.to_dict()))
79
+
80
+ @classmethod
81
+ def from_json(cls, json_str: str) -> Optional[Self]:
82
+ """Create an instance of GetManagedRuleSetResponse from a JSON string"""
83
+ return cls.from_dict(json.loads(json_str))
84
+
85
+ def to_dict(self) -> Dict[str, Any]:
86
+ """Return the dictionary representation of the model using alias.
87
+
88
+ This has the following differences from calling pydantic's
89
+ `self.model_dump(by_alias=True)`:
90
+
91
+ * `None` is only added to the output dict for nullable fields that
92
+ were set at model initialization. Other fields with value `None`
93
+ are ignored.
94
+ """
95
+ excluded_fields: Set[str] = set([])
96
+
97
+ _dict = self.model_dump(
98
+ by_alias=True,
99
+ exclude=excluded_fields,
100
+ exclude_none=True,
101
+ )
102
+ # override the default output from pydantic by calling `to_dict()` of each value in groups (dict)
103
+ _field_dict = {}
104
+ if self.groups:
105
+ for _key_groups in self.groups:
106
+ if self.groups[_key_groups]:
107
+ _field_dict[_key_groups] = self.groups[_key_groups].to_dict()
108
+ _dict["groups"] = _field_dict
109
+ # override the default output from pydantic by calling `to_dict()` of usage
110
+ if self.usage:
111
+ _dict["usage"] = self.usage.to_dict()
112
+ return _dict
113
+
114
+ @classmethod
115
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
116
+ """Create an instance of GetManagedRuleSetResponse from a dict"""
117
+ if obj is None:
118
+ return None
119
+
120
+ if not isinstance(obj, dict):
121
+ return cls.model_validate(obj)
122
+
123
+ _obj = cls.model_validate(
124
+ {
125
+ "groups": (
126
+ dict((_k, MRSRuleGroup.from_dict(_v)) for _k, _v in obj["groups"].items())
127
+ if obj.get("groups") is not None
128
+ else None
129
+ ),
130
+ "name": obj.get("name"),
131
+ "type": obj.get("type"),
132
+ "usage": MRSUsage.from_dict(obj["usage"]) if obj.get("usage") is not None else None,
133
+ "version": obj.get("version"),
134
+ }
135
+ )
136
+ return _obj
@@ -0,0 +1,132 @@
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.quotas import Quotas
27
+
28
+
29
+ class GetQuotaResponse(BaseModel):
30
+ """
31
+ GetQuotaResponse
32
+ """ # noqa: E501
33
+
34
+ project_id: Optional[UUID] = Field(default=None, description="Project identifier", alias="projectId")
35
+ quotas: Quotas
36
+ region: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Region")
37
+ __properties: ClassVar[List[str]] = ["projectId", "quotas", "region"]
38
+
39
+ @field_validator("project_id")
40
+ def project_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-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$", value):
49
+ raise ValueError(
50
+ 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}$/"
51
+ )
52
+ return value
53
+
54
+ @field_validator("region")
55
+ def region_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"^[a-z]{2,4}[0-9]{2}$", value):
64
+ raise ValueError(r"must validate the regular expression /^[a-z]{2,4}[0-9]{2}$/")
65
+ return value
66
+
67
+ model_config = ConfigDict(
68
+ validate_by_name=True,
69
+ validate_by_alias=True,
70
+ validate_assignment=True,
71
+ protected_namespaces=(),
72
+ )
73
+
74
+ def to_str(self) -> str:
75
+ """Returns the string representation of the model using alias"""
76
+ return pprint.pformat(self.model_dump(by_alias=True))
77
+
78
+ def to_json(self) -> str:
79
+ """Returns the JSON representation of the model using alias"""
80
+ return json.dumps(to_jsonable_python(self.to_dict()))
81
+
82
+ @classmethod
83
+ def from_json(cls, json_str: str) -> Optional[Self]:
84
+ """Create an instance of GetQuotaResponse from a JSON string"""
85
+ return cls.from_dict(json.loads(json_str))
86
+
87
+ def to_dict(self) -> Dict[str, Any]:
88
+ """Return the dictionary representation of the model using alias.
89
+
90
+ This has the following differences from calling pydantic's
91
+ `self.model_dump(by_alias=True)`:
92
+
93
+ * `None` is only added to the output dict for nullable fields that
94
+ were set at model initialization. Other fields with value `None`
95
+ are ignored.
96
+ * OpenAPI `readOnly` fields are excluded.
97
+ * OpenAPI `readOnly` fields are excluded.
98
+ """
99
+ excluded_fields: Set[str] = set(
100
+ [
101
+ "project_id",
102
+ "region",
103
+ ]
104
+ )
105
+
106
+ _dict = self.model_dump(
107
+ by_alias=True,
108
+ exclude=excluded_fields,
109
+ exclude_none=True,
110
+ )
111
+ # override the default output from pydantic by calling `to_dict()` of quotas
112
+ if self.quotas:
113
+ _dict["quotas"] = self.quotas.to_dict()
114
+ return _dict
115
+
116
+ @classmethod
117
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
118
+ """Create an instance of GetQuotaResponse from a dict"""
119
+ if obj is None:
120
+ return None
121
+
122
+ if not isinstance(obj, dict):
123
+ return cls.model_validate(obj)
124
+
125
+ _obj = cls.model_validate(
126
+ {
127
+ "projectId": obj.get("projectId"),
128
+ "quotas": Quotas.from_dict(obj["quotas"]) if obj.get("quotas") is not None else None,
129
+ "region": obj.get("region"),
130
+ }
131
+ )
132
+ return _obj
@@ -0,0 +1,143 @@
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.waf_usage import WAFUsage
26
+
27
+
28
+ class GetWAFResponse(BaseModel):
29
+ """
30
+ GetWAFResponse returns detailed information about the WAF, which includes the identifying name, references to MRS/CRG and usage.
31
+ """ # noqa: E501
32
+
33
+ custom_rule_group_name: Optional[Annotated[str, Field(strict=True)]] = Field(
34
+ default=None, description="Name of the CRG configuration for that WAF.", alias="customRuleGroupName"
35
+ )
36
+ labels: Optional[Dict[str, StrictStr]] = Field(
37
+ default=None,
38
+ 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. ",
39
+ )
40
+ managed_rule_set_name: Optional[Annotated[str, Field(strict=True)]] = Field(
41
+ default=None, description="Name of the managed rule set configuration for that WAF.", alias="managedRuleSetName"
42
+ )
43
+ name: Annotated[str, Field(strict=True)] = Field(description="WAF name")
44
+ usage: Optional[WAFUsage] = None
45
+ __properties: ClassVar[List[str]] = ["customRuleGroupName", "labels", "managedRuleSetName", "name", "usage"]
46
+
47
+ @field_validator("custom_rule_group_name")
48
+ def custom_rule_group_name_validate_regular_expression(cls, value):
49
+ """Validates the regular expression"""
50
+ if value is None:
51
+ return value
52
+
53
+ if not isinstance(value, str):
54
+ value = str(value)
55
+
56
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
57
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
58
+ return value
59
+
60
+ @field_validator("managed_rule_set_name")
61
+ def managed_rule_set_name_validate_regular_expression(cls, value):
62
+ """Validates the regular expression"""
63
+ if value is None:
64
+ return value
65
+
66
+ if not isinstance(value, str):
67
+ value = str(value)
68
+
69
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
70
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
71
+ return value
72
+
73
+ @field_validator("name")
74
+ def name_validate_regular_expression(cls, value):
75
+ """Validates the regular expression"""
76
+ if not isinstance(value, str):
77
+ value = str(value)
78
+
79
+ if not re.match(r"^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$", value):
80
+ raise ValueError(r"must validate the regular expression /^[0-9a-z](?:(?:[0-9a-z]|-){0,61}[0-9a-z])?$/")
81
+ return value
82
+
83
+ model_config = ConfigDict(
84
+ validate_by_name=True,
85
+ validate_by_alias=True,
86
+ validate_assignment=True,
87
+ protected_namespaces=(),
88
+ )
89
+
90
+ def to_str(self) -> str:
91
+ """Returns the string representation of the model using alias"""
92
+ return pprint.pformat(self.model_dump(by_alias=True))
93
+
94
+ def to_json(self) -> str:
95
+ """Returns the JSON representation of the model using alias"""
96
+ return json.dumps(to_jsonable_python(self.to_dict()))
97
+
98
+ @classmethod
99
+ def from_json(cls, json_str: str) -> Optional[Self]:
100
+ """Create an instance of GetWAFResponse from a JSON string"""
101
+ return cls.from_dict(json.loads(json_str))
102
+
103
+ def to_dict(self) -> Dict[str, Any]:
104
+ """Return the dictionary representation of the model using alias.
105
+
106
+ This has the following differences from calling pydantic's
107
+ `self.model_dump(by_alias=True)`:
108
+
109
+ * `None` is only added to the output dict for nullable fields that
110
+ were set at model initialization. Other fields with value `None`
111
+ are ignored.
112
+ """
113
+ excluded_fields: Set[str] = set([])
114
+
115
+ _dict = self.model_dump(
116
+ by_alias=True,
117
+ exclude=excluded_fields,
118
+ exclude_none=True,
119
+ )
120
+ # override the default output from pydantic by calling `to_dict()` of usage
121
+ if self.usage:
122
+ _dict["usage"] = self.usage.to_dict()
123
+ return _dict
124
+
125
+ @classmethod
126
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
127
+ """Create an instance of GetWAFResponse from a dict"""
128
+ if obj is None:
129
+ return None
130
+
131
+ if not isinstance(obj, dict):
132
+ return cls.model_validate(obj)
133
+
134
+ _obj = cls.model_validate(
135
+ {
136
+ "customRuleGroupName": obj.get("customRuleGroupName"),
137
+ "labels": obj.get("labels"),
138
+ "managedRuleSetName": obj.get("managedRuleSetName"),
139
+ "name": obj.get("name"),
140
+ "usage": WAFUsage.from_dict(obj["usage"]) if obj.get("usage") is not None else None,
141
+ }
142
+ )
143
+ return _obj