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.
- stackgen/__init__.py +52 -0
- stackgen/_http.py +96 -0
- stackgen/_version.py +24 -0
- stackgen/aiden/__init__.py +9 -0
- stackgen/aiden/namespace.py +26 -0
- stackgen/aiden/runs.py +36 -0
- stackgen/aiden/webhook.py +185 -0
- stackgen/cli.py +33 -0
- stackgen/client.py +31 -0
- stackgen/config.py +88 -0
- stackgen/errors.py +41 -0
- stackgen/generated/.openapi-generator/FILES +141 -0
- stackgen/generated/.openapi-generator/VERSION +1 -0
- stackgen/generated/.openapi-generator-ignore +23 -0
- stackgen/generated/__init__.py +131 -0
- stackgen/generated/api/__init__.py +6 -0
- stackgen/generated/api/aiden_api.py +1806 -0
- stackgen/generated/api/sre_api.py +1618 -0
- stackgen/generated/api_client.py +801 -0
- stackgen/generated/api_response.py +21 -0
- stackgen/generated/configuration.py +600 -0
- stackgen/generated/exceptions.py +216 -0
- stackgen/generated/models/__init__.py +57 -0
- stackgen/generated/models/alert_analysis_status.py +40 -0
- stackgen/generated/models/alert_attention.py +39 -0
- stackgen/generated/models/alert_categorization_summary.py +97 -0
- stackgen/generated/models/alert_role.py +38 -0
- stackgen/generated/models/alert_sort_by.py +37 -0
- stackgen/generated/models/alert_status.py +38 -0
- stackgen/generated/models/alert_summary.py +95 -0
- stackgen/generated/models/alert_sync_run_status.py +38 -0
- stackgen/generated/models/alert_v1.py +213 -0
- stackgen/generated/models/artifact_info.py +98 -0
- stackgen/generated/models/error_response.py +91 -0
- stackgen/generated/models/investigate_alert_request.py +91 -0
- stackgen/generated/models/investigate_response.py +91 -0
- stackgen/generated/models/investigation.py +167 -0
- stackgen/generated/models/investigation_evidence.py +114 -0
- stackgen/generated/models/investigation_evidence_kind.py +44 -0
- stackgen/generated/models/investigation_evidence_source.py +39 -0
- stackgen/generated/models/investigation_hypothesis.py +112 -0
- stackgen/generated/models/investigation_plain_summary.py +104 -0
- stackgen/generated/models/investigation_prior_incident.py +109 -0
- stackgen/generated/models/investigation_recommended_next_step.py +101 -0
- stackgen/generated/models/investigation_ref.py +118 -0
- stackgen/generated/models/investigation_status.py +42 -0
- stackgen/generated/models/investigation_structured_hypothesis_entry.py +115 -0
- stackgen/generated/models/investigation_structured_limitation_entry.py +120 -0
- stackgen/generated/models/investigation_structured_rca.py +139 -0
- stackgen/generated/models/investigation_triage_metadata.py +134 -0
- stackgen/generated/models/json_error.py +91 -0
- stackgen/generated/models/list_alerts_response.py +119 -0
- stackgen/generated/models/list_investigations_response.py +101 -0
- stackgen/generated/models/pagination.py +91 -0
- stackgen/generated/models/schedule_run_status.py +39 -0
- stackgen/generated/models/schedule_target_type.py +38 -0
- stackgen/generated/models/session.py +141 -0
- stackgen/generated/models/session_responder_kind.py +40 -0
- stackgen/generated/models/signal_severity.py +40 -0
- stackgen/generated/models/sync_response.py +136 -0
- stackgen/generated/models/trigger_webhook202_response.py +98 -0
- stackgen/generated/models/webhook_run.py +129 -0
- stackgen/generated/models/webhook_run_detail.py +136 -0
- stackgen/generated/models/webhook_run_list_response.py +97 -0
- stackgen/generated/rest.py +258 -0
- stackgen/sre/__init__.py +5 -0
- stackgen/sre/namespace.py +57 -0
- stackgen/vault/__init__.py +5 -0
- stackgen/vault/namespace.py +17 -0
- stackgen_sdk-0.1.1.dist-info/METADATA +60 -0
- stackgen_sdk-0.1.1.dist-info/RECORD +73 -0
- stackgen_sdk-0.1.1.dist-info/WHEEL +4 -0
- stackgen_sdk-0.1.1.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,139 @@
|
|
|
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, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from stackgen.generated.models.investigation_plain_summary import InvestigationPlainSummary
|
|
24
|
+
from stackgen.generated.models.investigation_recommended_next_step import InvestigationRecommendedNextStep
|
|
25
|
+
from stackgen.generated.models.investigation_structured_hypothesis_entry import InvestigationStructuredHypothesisEntry
|
|
26
|
+
from stackgen.generated.models.investigation_structured_limitation_entry import InvestigationStructuredLimitationEntry
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
29
|
+
|
|
30
|
+
class InvestigationStructuredRCA(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
Structured root-cause analysis fields attached to an investigation after triage completes.
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
root_cause: StrictStr = Field(description="Identified or suspected root cause in plain language.")
|
|
35
|
+
impact: StrictStr = Field(description="User or system impact summary.")
|
|
36
|
+
mitigation: StrictStr = Field(description="Recommended mitigation or next steps.")
|
|
37
|
+
confidence: Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]] = Field(description="Agent confidence in the RCA (0–1).")
|
|
38
|
+
unverified_hypotheses: Optional[List[InvestigationStructuredHypothesisEntry]] = Field(default=None, description="Hypotheses that could not be confirmed or ruled out during triage.")
|
|
39
|
+
ruled_out_hypotheses: Optional[List[InvestigationStructuredHypothesisEntry]] = Field(default=None, description="Hypotheses falsified during investigation.")
|
|
40
|
+
investigation_limitations: Optional[List[InvestigationStructuredLimitationEntry]] = Field(default=None, description="Observability or integration gaps encountered during triage.")
|
|
41
|
+
recommended_next_steps: Optional[List[InvestigationRecommendedNextStep]] = Field(default=None, description="Tiered remediation steps with verification, rollback, and operator commands. Required when triage status is completed; also required for HTTP error incidents.")
|
|
42
|
+
plain_summary: Optional[InvestigationPlainSummary] = None
|
|
43
|
+
__properties: ClassVar[List[str]] = ["root_cause", "impact", "mitigation", "confidence", "unverified_hypotheses", "ruled_out_hypotheses", "investigation_limitations", "recommended_next_steps", "plain_summary"]
|
|
44
|
+
|
|
45
|
+
model_config = ConfigDict(
|
|
46
|
+
populate_by_name=True,
|
|
47
|
+
validate_assignment=True,
|
|
48
|
+
protected_namespaces=(),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def to_str(self) -> str:
|
|
53
|
+
"""Returns the string representation of the model using alias"""
|
|
54
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
55
|
+
|
|
56
|
+
def to_json(self) -> str:
|
|
57
|
+
"""Returns the JSON representation of the model using alias"""
|
|
58
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
59
|
+
return json.dumps(self.to_dict())
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
63
|
+
"""Create an instance of InvestigationStructuredRCA from a JSON string"""
|
|
64
|
+
return cls.from_dict(json.loads(json_str))
|
|
65
|
+
|
|
66
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
67
|
+
"""Return the dictionary representation of the model using alias.
|
|
68
|
+
|
|
69
|
+
This has the following differences from calling pydantic's
|
|
70
|
+
`self.model_dump(by_alias=True)`:
|
|
71
|
+
|
|
72
|
+
* `None` is only added to the output dict for nullable fields that
|
|
73
|
+
were set at model initialization. Other fields with value `None`
|
|
74
|
+
are ignored.
|
|
75
|
+
"""
|
|
76
|
+
excluded_fields: Set[str] = set([
|
|
77
|
+
])
|
|
78
|
+
|
|
79
|
+
_dict = self.model_dump(
|
|
80
|
+
by_alias=True,
|
|
81
|
+
exclude=excluded_fields,
|
|
82
|
+
exclude_none=True,
|
|
83
|
+
)
|
|
84
|
+
# override the default output from pydantic by calling `to_dict()` of each item in unverified_hypotheses (list)
|
|
85
|
+
_items = []
|
|
86
|
+
if self.unverified_hypotheses:
|
|
87
|
+
for _item_unverified_hypotheses in self.unverified_hypotheses:
|
|
88
|
+
if _item_unverified_hypotheses:
|
|
89
|
+
_items.append(_item_unverified_hypotheses.to_dict())
|
|
90
|
+
_dict['unverified_hypotheses'] = _items
|
|
91
|
+
# override the default output from pydantic by calling `to_dict()` of each item in ruled_out_hypotheses (list)
|
|
92
|
+
_items = []
|
|
93
|
+
if self.ruled_out_hypotheses:
|
|
94
|
+
for _item_ruled_out_hypotheses in self.ruled_out_hypotheses:
|
|
95
|
+
if _item_ruled_out_hypotheses:
|
|
96
|
+
_items.append(_item_ruled_out_hypotheses.to_dict())
|
|
97
|
+
_dict['ruled_out_hypotheses'] = _items
|
|
98
|
+
# override the default output from pydantic by calling `to_dict()` of each item in investigation_limitations (list)
|
|
99
|
+
_items = []
|
|
100
|
+
if self.investigation_limitations:
|
|
101
|
+
for _item_investigation_limitations in self.investigation_limitations:
|
|
102
|
+
if _item_investigation_limitations:
|
|
103
|
+
_items.append(_item_investigation_limitations.to_dict())
|
|
104
|
+
_dict['investigation_limitations'] = _items
|
|
105
|
+
# override the default output from pydantic by calling `to_dict()` of each item in recommended_next_steps (list)
|
|
106
|
+
_items = []
|
|
107
|
+
if self.recommended_next_steps:
|
|
108
|
+
for _item_recommended_next_steps in self.recommended_next_steps:
|
|
109
|
+
if _item_recommended_next_steps:
|
|
110
|
+
_items.append(_item_recommended_next_steps.to_dict())
|
|
111
|
+
_dict['recommended_next_steps'] = _items
|
|
112
|
+
# override the default output from pydantic by calling `to_dict()` of plain_summary
|
|
113
|
+
if self.plain_summary:
|
|
114
|
+
_dict['plain_summary'] = self.plain_summary.to_dict()
|
|
115
|
+
return _dict
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
119
|
+
"""Create an instance of InvestigationStructuredRCA from a dict"""
|
|
120
|
+
if obj is None:
|
|
121
|
+
return None
|
|
122
|
+
|
|
123
|
+
if not isinstance(obj, dict):
|
|
124
|
+
return cls.model_validate(obj)
|
|
125
|
+
|
|
126
|
+
_obj = cls.model_validate({
|
|
127
|
+
"root_cause": obj.get("root_cause"),
|
|
128
|
+
"impact": obj.get("impact"),
|
|
129
|
+
"mitigation": obj.get("mitigation"),
|
|
130
|
+
"confidence": obj.get("confidence"),
|
|
131
|
+
"unverified_hypotheses": [InvestigationStructuredHypothesisEntry.from_dict(_item) for _item in obj["unverified_hypotheses"]] if obj.get("unverified_hypotheses") is not None else None,
|
|
132
|
+
"ruled_out_hypotheses": [InvestigationStructuredHypothesisEntry.from_dict(_item) for _item in obj["ruled_out_hypotheses"]] if obj.get("ruled_out_hypotheses") is not None else None,
|
|
133
|
+
"investigation_limitations": [InvestigationStructuredLimitationEntry.from_dict(_item) for _item in obj["investigation_limitations"]] if obj.get("investigation_limitations") is not None else None,
|
|
134
|
+
"recommended_next_steps": [InvestigationRecommendedNextStep.from_dict(_item) for _item in obj["recommended_next_steps"]] if obj.get("recommended_next_steps") is not None else None,
|
|
135
|
+
"plain_summary": InvestigationPlainSummary.from_dict(obj["plain_summary"]) if obj.get("plain_summary") is not None else None
|
|
136
|
+
})
|
|
137
|
+
return _obj
|
|
138
|
+
|
|
139
|
+
|
|
@@ -0,0 +1,134 @@
|
|
|
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 datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from stackgen.generated.models.alert_role import AlertRole
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class InvestigationTriageMetadata(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Opaque-but-typed metadata about how structured triage was produced (classifier version, storm context, timestamps, draft follow-ups).
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
alert_role: Optional[AlertRole] = None
|
|
32
|
+
storm_context: Optional[StrictStr] = Field(default=None, description="Whether triage ran on a lone alert or a correlated storm.")
|
|
33
|
+
classifier_version: Optional[StrictStr] = Field(default=None, description="Version tag of the heuristic or agent classifier used.")
|
|
34
|
+
classified_at: Optional[datetime] = Field(default=None, description="When cause-effect classification was last applied.")
|
|
35
|
+
more_info_requested: Optional[List[StrictStr]] = Field(default=None, description="Gaps requested when triage was accepted as draft instead of completed. Operators and follow-up submits should address every entry.")
|
|
36
|
+
more_info_notes: Optional[StrictStr] = Field(default=None, description="Plain-English note for operators explaining why the investigation is still draft. Agent-facing gap codes stay in more_info_requested.")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["alert_role", "storm_context", "classifier_version", "classified_at", "more_info_requested", "more_info_notes"]
|
|
38
|
+
|
|
39
|
+
@field_validator('storm_context')
|
|
40
|
+
def storm_context_validate_enum(cls, value):
|
|
41
|
+
"""Validates the enum"""
|
|
42
|
+
if value is None:
|
|
43
|
+
return value
|
|
44
|
+
|
|
45
|
+
if value not in set(['single', 'correlated']):
|
|
46
|
+
raise ValueError("must be one of enum values ('single', 'correlated')")
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
model_config = ConfigDict(
|
|
50
|
+
populate_by_name=True,
|
|
51
|
+
validate_assignment=True,
|
|
52
|
+
protected_namespaces=(),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def to_str(self) -> str:
|
|
57
|
+
"""Returns the string representation of the model using alias"""
|
|
58
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
59
|
+
|
|
60
|
+
def to_json(self) -> str:
|
|
61
|
+
"""Returns the JSON representation of the model using alias"""
|
|
62
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
63
|
+
return json.dumps(self.to_dict())
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
67
|
+
"""Create an instance of InvestigationTriageMetadata from a JSON string"""
|
|
68
|
+
return cls.from_dict(json.loads(json_str))
|
|
69
|
+
|
|
70
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
71
|
+
"""Return the dictionary representation of the model using alias.
|
|
72
|
+
|
|
73
|
+
This has the following differences from calling pydantic's
|
|
74
|
+
`self.model_dump(by_alias=True)`:
|
|
75
|
+
|
|
76
|
+
* `None` is only added to the output dict for nullable fields that
|
|
77
|
+
were set at model initialization. Other fields with value `None`
|
|
78
|
+
are ignored.
|
|
79
|
+
"""
|
|
80
|
+
excluded_fields: Set[str] = set([
|
|
81
|
+
])
|
|
82
|
+
|
|
83
|
+
_dict = self.model_dump(
|
|
84
|
+
by_alias=True,
|
|
85
|
+
exclude=excluded_fields,
|
|
86
|
+
exclude_none=True,
|
|
87
|
+
)
|
|
88
|
+
# set to None if storm_context (nullable) is None
|
|
89
|
+
# and model_fields_set contains the field
|
|
90
|
+
if self.storm_context is None and "storm_context" in self.model_fields_set:
|
|
91
|
+
_dict['storm_context'] = None
|
|
92
|
+
|
|
93
|
+
# set to None if classifier_version (nullable) is None
|
|
94
|
+
# and model_fields_set contains the field
|
|
95
|
+
if self.classifier_version is None and "classifier_version" in self.model_fields_set:
|
|
96
|
+
_dict['classifier_version'] = None
|
|
97
|
+
|
|
98
|
+
# set to None if classified_at (nullable) is None
|
|
99
|
+
# and model_fields_set contains the field
|
|
100
|
+
if self.classified_at is None and "classified_at" in self.model_fields_set:
|
|
101
|
+
_dict['classified_at'] = None
|
|
102
|
+
|
|
103
|
+
# set to None if more_info_requested (nullable) is None
|
|
104
|
+
# and model_fields_set contains the field
|
|
105
|
+
if self.more_info_requested is None and "more_info_requested" in self.model_fields_set:
|
|
106
|
+
_dict['more_info_requested'] = None
|
|
107
|
+
|
|
108
|
+
# set to None if more_info_notes (nullable) is None
|
|
109
|
+
# and model_fields_set contains the field
|
|
110
|
+
if self.more_info_notes is None and "more_info_notes" in self.model_fields_set:
|
|
111
|
+
_dict['more_info_notes'] = None
|
|
112
|
+
|
|
113
|
+
return _dict
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
117
|
+
"""Create an instance of InvestigationTriageMetadata from a dict"""
|
|
118
|
+
if obj is None:
|
|
119
|
+
return None
|
|
120
|
+
|
|
121
|
+
if not isinstance(obj, dict):
|
|
122
|
+
return cls.model_validate(obj)
|
|
123
|
+
|
|
124
|
+
_obj = cls.model_validate({
|
|
125
|
+
"alert_role": obj.get("alert_role"),
|
|
126
|
+
"storm_context": obj.get("storm_context"),
|
|
127
|
+
"classifier_version": obj.get("classifier_version"),
|
|
128
|
+
"classified_at": obj.get("classified_at"),
|
|
129
|
+
"more_info_requested": obj.get("more_info_requested"),
|
|
130
|
+
"more_info_notes": obj.get("more_info_notes")
|
|
131
|
+
})
|
|
132
|
+
return _obj
|
|
133
|
+
|
|
134
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
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, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class JsonError(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
JSON body Aiden returns for many failed requests. Same shape as `github.com/appcd-dev/go-lib/problems.Problem` serialized to JSON (`msg`, `errCode`, optional `extras`). Keep `msg` as stable constant strings; put variables in `extras` (often one object map).
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
msg: StrictStr = Field(description="Human-readable message; use constant strings for validation errors so metrics stay low-cardinality.")
|
|
30
|
+
err_code: StrictStr = Field(description="Machine-readable code (e.g. BAD_REQUEST, PAYLOAD_TOO_LARGE, NOT_FOUND).", alias="errCode")
|
|
31
|
+
extras: Optional[List[Dict[str, Any]]] = Field(default=None, description="Optional context list; often a single object map (e.g. filename, max_files, session_id).")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["msg", "errCode", "extras"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
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
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of JsonError from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of JsonError from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate({
|
|
85
|
+
"msg": obj.get("msg"),
|
|
86
|
+
"errCode": obj.get("errCode"),
|
|
87
|
+
"extras": obj.get("extras")
|
|
88
|
+
})
|
|
89
|
+
return _obj
|
|
90
|
+
|
|
91
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from stackgen.generated.models.alert_categorization_summary import AlertCategorizationSummary
|
|
23
|
+
from stackgen.generated.models.alert_summary import AlertSummary
|
|
24
|
+
from stackgen.generated.models.alert_v1 import AlertV1
|
|
25
|
+
from stackgen.generated.models.pagination import Pagination
|
|
26
|
+
from stackgen.generated.models.sync_response import SyncResponse
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
29
|
+
|
|
30
|
+
class ListAlertsResponse(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
Paginated alert list with summary counts.
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
summary: AlertSummary
|
|
35
|
+
categorization: AlertCategorizationSummary
|
|
36
|
+
alerts: List[AlertV1] = Field(description="Current page of alerts.")
|
|
37
|
+
pagination: Pagination
|
|
38
|
+
active_sync: Optional[SyncResponse] = None
|
|
39
|
+
__properties: ClassVar[List[str]] = ["summary", "categorization", "alerts", "pagination", "active_sync"]
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
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
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of ListAlertsResponse from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of summary
|
|
81
|
+
if self.summary:
|
|
82
|
+
_dict['summary'] = self.summary.to_dict()
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of categorization
|
|
84
|
+
if self.categorization:
|
|
85
|
+
_dict['categorization'] = self.categorization.to_dict()
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of each item in alerts (list)
|
|
87
|
+
_items = []
|
|
88
|
+
if self.alerts:
|
|
89
|
+
for _item_alerts in self.alerts:
|
|
90
|
+
if _item_alerts:
|
|
91
|
+
_items.append(_item_alerts.to_dict())
|
|
92
|
+
_dict['alerts'] = _items
|
|
93
|
+
# override the default output from pydantic by calling `to_dict()` of pagination
|
|
94
|
+
if self.pagination:
|
|
95
|
+
_dict['pagination'] = self.pagination.to_dict()
|
|
96
|
+
# override the default output from pydantic by calling `to_dict()` of active_sync
|
|
97
|
+
if self.active_sync:
|
|
98
|
+
_dict['active_sync'] = self.active_sync.to_dict()
|
|
99
|
+
return _dict
|
|
100
|
+
|
|
101
|
+
@classmethod
|
|
102
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
103
|
+
"""Create an instance of ListAlertsResponse from a dict"""
|
|
104
|
+
if obj is None:
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
if not isinstance(obj, dict):
|
|
108
|
+
return cls.model_validate(obj)
|
|
109
|
+
|
|
110
|
+
_obj = cls.model_validate({
|
|
111
|
+
"summary": AlertSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None,
|
|
112
|
+
"categorization": AlertCategorizationSummary.from_dict(obj["categorization"]) if obj.get("categorization") is not None else None,
|
|
113
|
+
"alerts": [AlertV1.from_dict(_item) for _item in obj["alerts"]] if obj.get("alerts") is not None else None,
|
|
114
|
+
"pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None,
|
|
115
|
+
"active_sync": SyncResponse.from_dict(obj["active_sync"]) if obj.get("active_sync") is not None else None
|
|
116
|
+
})
|
|
117
|
+
return _obj
|
|
118
|
+
|
|
119
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from stackgen.generated.models.investigation import Investigation
|
|
23
|
+
from stackgen.generated.models.pagination import Pagination
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class ListInvestigationsResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Paginated investigation list.
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
investigations: List[Investigation]
|
|
32
|
+
pagination: Pagination
|
|
33
|
+
__properties: ClassVar[List[str]] = ["investigations", "pagination"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ListInvestigationsResponse from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in investigations (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.investigations:
|
|
77
|
+
for _item_investigations in self.investigations:
|
|
78
|
+
if _item_investigations:
|
|
79
|
+
_items.append(_item_investigations.to_dict())
|
|
80
|
+
_dict['investigations'] = _items
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of pagination
|
|
82
|
+
if self.pagination:
|
|
83
|
+
_dict['pagination'] = self.pagination.to_dict()
|
|
84
|
+
return _dict
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
88
|
+
"""Create an instance of ListInvestigationsResponse from a dict"""
|
|
89
|
+
if obj is None:
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
if not isinstance(obj, dict):
|
|
93
|
+
return cls.model_validate(obj)
|
|
94
|
+
|
|
95
|
+
_obj = cls.model_validate({
|
|
96
|
+
"investigations": [Investigation.from_dict(_item) for _item in obj["investigations"]] if obj.get("investigations") is not None else None,
|
|
97
|
+
"pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
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 Pagination(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Pagination metadata for a list response.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
page: StrictInt = Field(description="Current page number (1-based).")
|
|
30
|
+
page_size: StrictInt = Field(description="Number of items per page.")
|
|
31
|
+
total: StrictInt = Field(description="Total number of matching items.")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["page", "page_size", "total"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
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
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of Pagination from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of Pagination from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate({
|
|
85
|
+
"page": obj.get("page"),
|
|
86
|
+
"page_size": obj.get("page_size"),
|
|
87
|
+
"total": obj.get("total")
|
|
88
|
+
})
|
|
89
|
+
return _obj
|
|
90
|
+
|
|
91
|
+
|