stackgen-sdk 0.1.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 (73) hide show
  1. stackgen/__init__.py +52 -0
  2. stackgen/_http.py +96 -0
  3. stackgen/_version.py +24 -0
  4. stackgen/aiden/__init__.py +9 -0
  5. stackgen/aiden/namespace.py +26 -0
  6. stackgen/aiden/runs.py +36 -0
  7. stackgen/aiden/webhook.py +185 -0
  8. stackgen/cli.py +33 -0
  9. stackgen/client.py +31 -0
  10. stackgen/config.py +88 -0
  11. stackgen/errors.py +41 -0
  12. stackgen/generated/.openapi-generator/FILES +141 -0
  13. stackgen/generated/.openapi-generator/VERSION +1 -0
  14. stackgen/generated/.openapi-generator-ignore +23 -0
  15. stackgen/generated/__init__.py +131 -0
  16. stackgen/generated/api/__init__.py +6 -0
  17. stackgen/generated/api/aiden_api.py +1806 -0
  18. stackgen/generated/api/sre_api.py +1618 -0
  19. stackgen/generated/api_client.py +801 -0
  20. stackgen/generated/api_response.py +21 -0
  21. stackgen/generated/configuration.py +600 -0
  22. stackgen/generated/exceptions.py +216 -0
  23. stackgen/generated/models/__init__.py +57 -0
  24. stackgen/generated/models/alert_analysis_status.py +40 -0
  25. stackgen/generated/models/alert_attention.py +39 -0
  26. stackgen/generated/models/alert_categorization_summary.py +97 -0
  27. stackgen/generated/models/alert_role.py +38 -0
  28. stackgen/generated/models/alert_sort_by.py +37 -0
  29. stackgen/generated/models/alert_status.py +38 -0
  30. stackgen/generated/models/alert_summary.py +95 -0
  31. stackgen/generated/models/alert_sync_run_status.py +38 -0
  32. stackgen/generated/models/alert_v1.py +213 -0
  33. stackgen/generated/models/artifact_info.py +98 -0
  34. stackgen/generated/models/error_response.py +91 -0
  35. stackgen/generated/models/investigate_alert_request.py +91 -0
  36. stackgen/generated/models/investigate_response.py +91 -0
  37. stackgen/generated/models/investigation.py +167 -0
  38. stackgen/generated/models/investigation_evidence.py +114 -0
  39. stackgen/generated/models/investigation_evidence_kind.py +44 -0
  40. stackgen/generated/models/investigation_evidence_source.py +39 -0
  41. stackgen/generated/models/investigation_hypothesis.py +112 -0
  42. stackgen/generated/models/investigation_plain_summary.py +104 -0
  43. stackgen/generated/models/investigation_prior_incident.py +109 -0
  44. stackgen/generated/models/investigation_recommended_next_step.py +101 -0
  45. stackgen/generated/models/investigation_ref.py +118 -0
  46. stackgen/generated/models/investigation_status.py +42 -0
  47. stackgen/generated/models/investigation_structured_hypothesis_entry.py +115 -0
  48. stackgen/generated/models/investigation_structured_limitation_entry.py +120 -0
  49. stackgen/generated/models/investigation_structured_rca.py +139 -0
  50. stackgen/generated/models/investigation_triage_metadata.py +134 -0
  51. stackgen/generated/models/json_error.py +91 -0
  52. stackgen/generated/models/list_alerts_response.py +119 -0
  53. stackgen/generated/models/list_investigations_response.py +101 -0
  54. stackgen/generated/models/pagination.py +91 -0
  55. stackgen/generated/models/schedule_run_status.py +39 -0
  56. stackgen/generated/models/schedule_target_type.py +38 -0
  57. stackgen/generated/models/session.py +141 -0
  58. stackgen/generated/models/session_responder_kind.py +40 -0
  59. stackgen/generated/models/signal_severity.py +40 -0
  60. stackgen/generated/models/sync_response.py +136 -0
  61. stackgen/generated/models/trigger_webhook202_response.py +98 -0
  62. stackgen/generated/models/webhook_run.py +129 -0
  63. stackgen/generated/models/webhook_run_detail.py +136 -0
  64. stackgen/generated/models/webhook_run_list_response.py +97 -0
  65. stackgen/generated/rest.py +258 -0
  66. stackgen/sre/__init__.py +5 -0
  67. stackgen/sre/namespace.py +57 -0
  68. stackgen/vault/__init__.py +5 -0
  69. stackgen/vault/namespace.py +17 -0
  70. stackgen_sdk-0.1.1.dist-info/METADATA +60 -0
  71. stackgen_sdk-0.1.1.dist-info/RECORD +73 -0
  72. stackgen_sdk-0.1.1.dist-info/WHEEL +4 -0
  73. stackgen_sdk-0.1.1.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,216 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ StackGen External API
5
+
6
+ Allowlisted StackGen API surface for the public SDK. Managed via api-docs/product/allowlists/external.yaml.
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from typing import Any, Optional
15
+ from typing_extensions import Self
16
+
17
+ class OpenApiException(Exception):
18
+ """The base exception class for all OpenAPIExceptions"""
19
+
20
+
21
+ class ApiTypeError(OpenApiException, TypeError):
22
+ def __init__(self, msg, path_to_item=None, valid_classes=None,
23
+ key_type=None) -> None:
24
+ """ Raises an exception for TypeErrors
25
+
26
+ Args:
27
+ msg (str): the exception message
28
+
29
+ Keyword Args:
30
+ path_to_item (list): a list of keys an indices to get to the
31
+ current_item
32
+ None if unset
33
+ valid_classes (tuple): the primitive classes that current item
34
+ should be an instance of
35
+ None if unset
36
+ key_type (bool): False if our value is a value in a dict
37
+ True if it is a key in a dict
38
+ False if our item is an item in a list
39
+ None if unset
40
+ """
41
+ self.path_to_item = path_to_item
42
+ self.valid_classes = valid_classes
43
+ self.key_type = key_type
44
+ full_msg = msg
45
+ if path_to_item:
46
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
47
+ super(ApiTypeError, self).__init__(full_msg)
48
+
49
+
50
+ class ApiValueError(OpenApiException, ValueError):
51
+ def __init__(self, msg, path_to_item=None) -> None:
52
+ """
53
+ Args:
54
+ msg (str): the exception message
55
+
56
+ Keyword Args:
57
+ path_to_item (list) the path to the exception in the
58
+ received_data dict. None if unset
59
+ """
60
+
61
+ self.path_to_item = path_to_item
62
+ full_msg = msg
63
+ if path_to_item:
64
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
65
+ super(ApiValueError, self).__init__(full_msg)
66
+
67
+
68
+ class ApiAttributeError(OpenApiException, AttributeError):
69
+ def __init__(self, msg, path_to_item=None) -> None:
70
+ """
71
+ Raised when an attribute reference or assignment fails.
72
+
73
+ Args:
74
+ msg (str): the exception message
75
+
76
+ Keyword Args:
77
+ path_to_item (None/list) the path to the exception in the
78
+ received_data dict
79
+ """
80
+ self.path_to_item = path_to_item
81
+ full_msg = msg
82
+ if path_to_item:
83
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
84
+ super(ApiAttributeError, self).__init__(full_msg)
85
+
86
+
87
+ class ApiKeyError(OpenApiException, KeyError):
88
+ def __init__(self, msg, path_to_item=None) -> None:
89
+ """
90
+ Args:
91
+ msg (str): the exception message
92
+
93
+ Keyword Args:
94
+ path_to_item (None/list) the path to the exception in the
95
+ received_data dict
96
+ """
97
+ self.path_to_item = path_to_item
98
+ full_msg = msg
99
+ if path_to_item:
100
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
101
+ super(ApiKeyError, self).__init__(full_msg)
102
+
103
+
104
+ class ApiException(OpenApiException):
105
+
106
+ def __init__(
107
+ self,
108
+ status=None,
109
+ reason=None,
110
+ http_resp=None,
111
+ *,
112
+ body: Optional[str] = None,
113
+ data: Optional[Any] = None,
114
+ ) -> None:
115
+ self.status = status
116
+ self.reason = reason
117
+ self.body = body
118
+ self.data = data
119
+ self.headers = None
120
+
121
+ if http_resp:
122
+ if self.status is None:
123
+ self.status = http_resp.status
124
+ if self.reason is None:
125
+ self.reason = http_resp.reason
126
+ if self.body is None:
127
+ try:
128
+ self.body = http_resp.data.decode('utf-8')
129
+ except Exception:
130
+ pass
131
+ self.headers = http_resp.getheaders()
132
+
133
+ @classmethod
134
+ def from_response(
135
+ cls,
136
+ *,
137
+ http_resp,
138
+ body: Optional[str],
139
+ data: Optional[Any],
140
+ ) -> Self:
141
+ if http_resp.status == 400:
142
+ raise BadRequestException(http_resp=http_resp, body=body, data=data)
143
+
144
+ if http_resp.status == 401:
145
+ raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
146
+
147
+ if http_resp.status == 403:
148
+ raise ForbiddenException(http_resp=http_resp, body=body, data=data)
149
+
150
+ if http_resp.status == 404:
151
+ raise NotFoundException(http_resp=http_resp, body=body, data=data)
152
+
153
+ # Added new conditions for 409 and 422
154
+ if http_resp.status == 409:
155
+ raise ConflictException(http_resp=http_resp, body=body, data=data)
156
+
157
+ if http_resp.status == 422:
158
+ raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
159
+
160
+ if 500 <= http_resp.status <= 599:
161
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
162
+ raise ApiException(http_resp=http_resp, body=body, data=data)
163
+
164
+ def __str__(self):
165
+ """Custom error messages for exception"""
166
+ error_message = "({0})\n"\
167
+ "Reason: {1}\n".format(self.status, self.reason)
168
+ if self.headers:
169
+ error_message += "HTTP response headers: {0}\n".format(
170
+ self.headers)
171
+
172
+ if self.data or self.body:
173
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
174
+
175
+ return error_message
176
+
177
+
178
+ class BadRequestException(ApiException):
179
+ pass
180
+
181
+
182
+ class NotFoundException(ApiException):
183
+ pass
184
+
185
+
186
+ class UnauthorizedException(ApiException):
187
+ pass
188
+
189
+
190
+ class ForbiddenException(ApiException):
191
+ pass
192
+
193
+
194
+ class ServiceException(ApiException):
195
+ pass
196
+
197
+
198
+ class ConflictException(ApiException):
199
+ """Exception for HTTP 409 Conflict."""
200
+ pass
201
+
202
+
203
+ class UnprocessableEntityException(ApiException):
204
+ """Exception for HTTP 422 Unprocessable Entity."""
205
+ pass
206
+
207
+
208
+ def render_path(path_to_item):
209
+ """Returns a string representation of a path"""
210
+ result = ""
211
+ for pth in path_to_item:
212
+ if isinstance(pth, int):
213
+ result += "[{0}]".format(pth)
214
+ else:
215
+ result += "['{0}']".format(pth)
216
+ return result
@@ -0,0 +1,57 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+ StackGen External API
6
+
7
+ Allowlisted StackGen API surface for the public SDK. Managed via api-docs/product/allowlists/external.yaml.
8
+
9
+ The version of the OpenAPI document: 0.1.0
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ # import models into model package
17
+ from stackgen.generated.models.alert_analysis_status import AlertAnalysisStatus
18
+ from stackgen.generated.models.alert_attention import AlertAttention
19
+ from stackgen.generated.models.alert_categorization_summary import AlertCategorizationSummary
20
+ from stackgen.generated.models.alert_role import AlertRole
21
+ from stackgen.generated.models.alert_sort_by import AlertSortBy
22
+ from stackgen.generated.models.alert_status import AlertStatus
23
+ from stackgen.generated.models.alert_summary import AlertSummary
24
+ from stackgen.generated.models.alert_sync_run_status import AlertSyncRunStatus
25
+ from stackgen.generated.models.alert_v1 import AlertV1
26
+ from stackgen.generated.models.artifact_info import ArtifactInfo
27
+ from stackgen.generated.models.error_response import ErrorResponse
28
+ from stackgen.generated.models.investigate_alert_request import InvestigateAlertRequest
29
+ from stackgen.generated.models.investigate_response import InvestigateResponse
30
+ from stackgen.generated.models.investigation import Investigation
31
+ from stackgen.generated.models.investigation_evidence import InvestigationEvidence
32
+ from stackgen.generated.models.investigation_evidence_kind import InvestigationEvidenceKind
33
+ from stackgen.generated.models.investigation_evidence_source import InvestigationEvidenceSource
34
+ from stackgen.generated.models.investigation_hypothesis import InvestigationHypothesis
35
+ from stackgen.generated.models.investigation_plain_summary import InvestigationPlainSummary
36
+ from stackgen.generated.models.investigation_prior_incident import InvestigationPriorIncident
37
+ from stackgen.generated.models.investigation_recommended_next_step import InvestigationRecommendedNextStep
38
+ from stackgen.generated.models.investigation_ref import InvestigationRef
39
+ from stackgen.generated.models.investigation_status import InvestigationStatus
40
+ from stackgen.generated.models.investigation_structured_hypothesis_entry import InvestigationStructuredHypothesisEntry
41
+ from stackgen.generated.models.investigation_structured_limitation_entry import InvestigationStructuredLimitationEntry
42
+ from stackgen.generated.models.investigation_structured_rca import InvestigationStructuredRCA
43
+ from stackgen.generated.models.investigation_triage_metadata import InvestigationTriageMetadata
44
+ from stackgen.generated.models.json_error import JsonError
45
+ from stackgen.generated.models.list_alerts_response import ListAlertsResponse
46
+ from stackgen.generated.models.list_investigations_response import ListInvestigationsResponse
47
+ from stackgen.generated.models.pagination import Pagination
48
+ from stackgen.generated.models.schedule_run_status import ScheduleRunStatus
49
+ from stackgen.generated.models.schedule_target_type import ScheduleTargetType
50
+ from stackgen.generated.models.session import Session
51
+ from stackgen.generated.models.session_responder_kind import SessionResponderKind
52
+ from stackgen.generated.models.signal_severity import SignalSeverity
53
+ from stackgen.generated.models.sync_response import SyncResponse
54
+ from stackgen.generated.models.trigger_webhook202_response import TriggerWebhook202Response
55
+ from stackgen.generated.models.webhook_run import WebhookRun
56
+ from stackgen.generated.models.webhook_run_detail import WebhookRunDetail
57
+ from stackgen.generated.models.webhook_run_list_response import WebhookRunListResponse
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ StackGen External API
5
+
6
+ Allowlisted StackGen API surface for the public SDK. Managed via api-docs/product/allowlists/external.yaml.
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class AlertAnalysisStatus(str, Enum):
22
+ """
23
+ Progress of Aiden auto-analysis on an alert. Never set by the operator.
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ NONE = 'none'
30
+ QUEUED = 'queued'
31
+ RUNNING = 'running'
32
+ COMPLETED = 'completed'
33
+ FAILED = 'failed'
34
+
35
+ @classmethod
36
+ def from_json(cls, json_str: str) -> Self:
37
+ """Create an instance of AlertAnalysisStatus from a JSON string"""
38
+ return cls(json.loads(json_str))
39
+
40
+
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ StackGen External API
5
+
6
+ Allowlisted StackGen API surface for the public SDK. Managed via api-docs/product/allowlists/external.yaml.
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class AlertAttention(str, Enum):
22
+ """
23
+ Triage classification for an alert, set by Aiden auto-analysis or an analyst.
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ NEEDS_ATTENTION = 'needs_attention'
30
+ NEEDS_REVIEW = 'needs_review'
31
+ FALSE_POSITIVE = 'false_positive'
32
+ OTHERS = 'others'
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of AlertAttention from a JSON string"""
37
+ return cls(json.loads(json_str))
38
+
39
+
@@ -0,0 +1,97 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ StackGen External API
5
+
6
+ Allowlisted StackGen API surface for the public SDK. Managed via api-docs/product/allowlists/external.yaml.
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class AlertCategorizationSummary(BaseModel):
26
+ """
27
+ Progress counts for Aiden alert categorization across active alerts. Use is_running to show the loading state while categorization workflows are queued or running, and failed to explain alerts that could not be categorized automatically.
28
+ """ # noqa: E501
29
+ total_active: StrictInt = Field(description="Total number of alerts with status=active.")
30
+ not_started: StrictInt = Field(description="Count of active alerts with analysis_status=none.")
31
+ in_progress: StrictInt = Field(description="Count of active alerts with analysis_status=queued or running.")
32
+ completed: StrictInt = Field(description="Count of active alerts with analysis_status=completed.")
33
+ failed: StrictInt = Field(description="Count of active alerts with analysis_status=failed.")
34
+ is_running: StrictBool = Field(description="True when at least one active alert is queued or running categorization.")
35
+ __properties: ClassVar[List[str]] = ["total_active", "not_started", "in_progress", "completed", "failed", "is_running"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of AlertCategorizationSummary 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
+
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 AlertCategorizationSummary 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({
88
+ "total_active": obj.get("total_active"),
89
+ "not_started": obj.get("not_started"),
90
+ "in_progress": obj.get("in_progress"),
91
+ "completed": obj.get("completed"),
92
+ "failed": obj.get("failed"),
93
+ "is_running": obj.get("is_running")
94
+ })
95
+ return _obj
96
+
97
+
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ StackGen External API
5
+
6
+ Allowlisted StackGen API surface for the public SDK. Managed via api-docs/product/allowlists/external.yaml.
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class AlertRole(str, Enum):
22
+ """
23
+ Cause-effect role for an alert in a correlated storm. Symptom alerts (latency, 5xx) surface user impact; cause alerts (pool exhaustion, CPU, restarts) point to upstream failure modes. Set by ingest heuristics or refined by Aiden triage.
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ SYMPTOM = 'symptom'
30
+ CAUSE = 'cause'
31
+ UNKNOWN = 'unknown'
32
+
33
+ @classmethod
34
+ def from_json(cls, json_str: str) -> Self:
35
+ """Create an instance of AlertRole from a JSON string"""
36
+ return cls(json.loads(json_str))
37
+
38
+
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ StackGen External API
5
+
6
+ Allowlisted StackGen API surface for the public SDK. Managed via api-docs/product/allowlists/external.yaml.
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class AlertSortBy(str, Enum):
22
+ """
23
+ Ordering for the alert inbox. severity keeps monitor-rank sort; impact surfaces estimated blast radius (env, scope, storm) first.
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ SEVERITY = 'severity'
30
+ IMPACT = 'impact'
31
+
32
+ @classmethod
33
+ def from_json(cls, json_str: str) -> Self:
34
+ """Create an instance of AlertSortBy from a JSON string"""
35
+ return cls(json.loads(json_str))
36
+
37
+
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ StackGen External API
5
+
6
+ Allowlisted StackGen API surface for the public SDK. Managed via api-docs/product/allowlists/external.yaml.
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class AlertStatus(str, Enum):
22
+ """
23
+ Lifecycle status of an alert.
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ ACTIVE = 'active'
30
+ RESOLVED = 'resolved'
31
+ IGNORED = 'ignored'
32
+
33
+ @classmethod
34
+ def from_json(cls, json_str: str) -> Self:
35
+ """Create an instance of AlertStatus from a JSON string"""
36
+ return cls(json.loads(json_str))
37
+
38
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ StackGen External API
5
+
6
+ Allowlisted StackGen API surface for the public SDK. Managed via api-docs/product/allowlists/external.yaml.
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class AlertSummary(BaseModel):
26
+ """
27
+ Fixed counts for active alerts by triage attention category.
28
+ """ # noqa: E501
29
+ total_active: StrictInt = Field(description="Total number of alerts with status=active.")
30
+ needs_attention: StrictInt = Field(description="Count of active alerts with attention=needs_attention.")
31
+ others: StrictInt = Field(description="Count of active alerts with attention=others.")
32
+ needs_review: StrictInt = Field(description="Count of active alerts with attention=needs_review.")
33
+ false_positive: StrictInt = Field(description="Count of active alerts with attention=false_positive.")
34
+ __properties: ClassVar[List[str]] = ["total_active", "needs_attention", "others", "needs_review", "false_positive"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of AlertSummary from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
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 AlertSummary 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({
87
+ "total_active": obj.get("total_active"),
88
+ "needs_attention": obj.get("needs_attention"),
89
+ "others": obj.get("others"),
90
+ "needs_review": obj.get("needs_review"),
91
+ "false_positive": obj.get("false_positive")
92
+ })
93
+ return _obj
94
+
95
+