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,109 @@
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 typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class InvestigationPriorIncident(BaseModel):
27
+ """
28
+ A prior incident similar to the current alert context.
29
+ """ # noqa: E501
30
+ alert_id: Optional[StrictStr] = Field(default=None, description="Internal alert UUID when the prior incident is known.")
31
+ title: StrictStr = Field(description="Short title of the prior incident.")
32
+ similarity: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=None, description="Similarity score to the current alert (0–1).")
33
+ confidence_boost: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=None, description="How much this match should boost downstream hypothesis confidence.")
34
+ __properties: ClassVar[List[str]] = ["alert_id", "title", "similarity", "confidence_boost"]
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 InvestigationPriorIncident 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
+ # set to None if alert_id (nullable) is None
76
+ # and model_fields_set contains the field
77
+ if self.alert_id is None and "alert_id" in self.model_fields_set:
78
+ _dict['alert_id'] = None
79
+
80
+ # set to None if similarity (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.similarity is None and "similarity" in self.model_fields_set:
83
+ _dict['similarity'] = None
84
+
85
+ # set to None if confidence_boost (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.confidence_boost is None and "confidence_boost" in self.model_fields_set:
88
+ _dict['confidence_boost'] = None
89
+
90
+ return _dict
91
+
92
+ @classmethod
93
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
94
+ """Create an instance of InvestigationPriorIncident from a dict"""
95
+ if obj is None:
96
+ return None
97
+
98
+ if not isinstance(obj, dict):
99
+ return cls.model_validate(obj)
100
+
101
+ _obj = cls.model_validate({
102
+ "alert_id": obj.get("alert_id"),
103
+ "title": obj.get("title"),
104
+ "similarity": obj.get("similarity"),
105
+ "confidence_boost": obj.get("confidence_boost")
106
+ })
107
+ return _obj
108
+
109
+
@@ -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, Field, StrictBool, 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 InvestigationRecommendedNextStep(BaseModel):
26
+ """
27
+ One tiered remediation action with risk, verification, and optional operator commands for kubectl or gh.
28
+ """ # noqa: E501
29
+ tier: StrictStr = Field(description="Mitigation tier such as immediate_containment, immediate_app, restore_observability, secondary_cluster, or preventive.")
30
+ action: StrictStr = Field(description="Plain-language remediation action for operators.")
31
+ risk: Optional[StrictStr] = Field(default=None, description="Risk level such as low, medium, or high.")
32
+ approval_required: Optional[StrictBool] = Field(default=None, description="Whether operator approval is required before execution.")
33
+ expected_impact: Optional[StrictStr] = Field(default=None, description="Expected outcome after the action succeeds.")
34
+ verify: Optional[StrictStr] = Field(default=None, description="Metric or log check that confirms success.")
35
+ rollback: Optional[StrictStr] = Field(default=None, description="How to undo the action if verification fails.")
36
+ operator_commands: Optional[List[StrictStr]] = Field(default=None, description="Copy-paste kubectl or gh commands for operators.")
37
+ __properties: ClassVar[List[str]] = ["tier", "action", "risk", "approval_required", "expected_impact", "verify", "rollback", "operator_commands"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
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
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of InvestigationRecommendedNextStep from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of InvestigationRecommendedNextStep from a dict"""
83
+ if obj is None:
84
+ return None
85
+
86
+ if not isinstance(obj, dict):
87
+ return cls.model_validate(obj)
88
+
89
+ _obj = cls.model_validate({
90
+ "tier": obj.get("tier"),
91
+ "action": obj.get("action"),
92
+ "risk": obj.get("risk"),
93
+ "approval_required": obj.get("approval_required"),
94
+ "expected_impact": obj.get("expected_impact"),
95
+ "verify": obj.get("verify"),
96
+ "rollback": obj.get("rollback"),
97
+ "operator_commands": obj.get("operator_commands")
98
+ })
99
+ return _obj
100
+
101
+
@@ -0,0 +1,118 @@
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_extensions import Annotated
23
+ from stackgen.generated.models.investigation_status import InvestigationStatus
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class InvestigationRef(BaseModel):
28
+ """
29
+ Minimal reference to a Aiden investigation linked to an alert.
30
+ """ # noqa: E501
31
+ id: StrictStr = Field(description="Investigation UUID.")
32
+ alert_id: StrictStr = Field(description="Alert UUID that triggered this investigation.")
33
+ guild_trace_id: StrictStr = Field(description="Aiden trace ID used to stream live investigation output.")
34
+ guild_session_id: Optional[StrictStr] = Field(default=None, description="Aiden session ID for the in-progress chat run. Populated by Aiden MCP callbacks once the session is created. Used by the UI to deep link into the conversation view.")
35
+ status: InvestigationStatus
36
+ result_summary: Optional[StrictStr] = Field(default=None, description="Short summary of the investigation result, once completed.")
37
+ parent_investigation_id: Optional[StrictStr] = Field(default=None, description="When this investigation was created by forking another, the parent investigation it was forked from. Null for normal investigations.")
38
+ evidence_count: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=0, description="Number of evidence URLs persisted on the investigation. Computed server-side via jsonb_array_length so it stays consistent with the full list returned by /api/v1/investigations/{id}.")
39
+ __properties: ClassVar[List[str]] = ["id", "alert_id", "guild_trace_id", "guild_session_id", "status", "result_summary", "parent_investigation_id", "evidence_count"]
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 InvestigationRef 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
+ # set to None if guild_session_id (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.guild_session_id is None and "guild_session_id" in self.model_fields_set:
83
+ _dict['guild_session_id'] = None
84
+
85
+ # set to None if result_summary (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.result_summary is None and "result_summary" in self.model_fields_set:
88
+ _dict['result_summary'] = None
89
+
90
+ # set to None if parent_investigation_id (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.parent_investigation_id is None and "parent_investigation_id" in self.model_fields_set:
93
+ _dict['parent_investigation_id'] = None
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of InvestigationRef from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate({
107
+ "id": obj.get("id"),
108
+ "alert_id": obj.get("alert_id"),
109
+ "guild_trace_id": obj.get("guild_trace_id"),
110
+ "guild_session_id": obj.get("guild_session_id"),
111
+ "status": obj.get("status"),
112
+ "result_summary": obj.get("result_summary"),
113
+ "parent_investigation_id": obj.get("parent_investigation_id"),
114
+ "evidence_count": obj.get("evidence_count") if obj.get("evidence_count") is not None else 0
115
+ })
116
+ return _obj
117
+
118
+
@@ -0,0 +1,42 @@
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 InvestigationStatus(str, Enum):
22
+ """
23
+ Lifecycle status of a Aiden investigation. `draft` means triage was persisted with gaps (more info requested) and is not operator-final.
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ QUEUED = 'queued'
30
+ RUNNING = 'running'
31
+ DRAFT = 'draft'
32
+ COMPLETED = 'completed'
33
+ FAILED = 'failed'
34
+ CANCELLED = 'cancelled'
35
+ RESOLVED = 'resolved'
36
+
37
+ @classmethod
38
+ def from_json(cls, json_str: str) -> Self:
39
+ """Create an instance of InvestigationStatus from a JSON string"""
40
+ return cls(json.loads(json_str))
41
+
42
+
@@ -0,0 +1,115 @@
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 InvestigationStructuredHypothesisEntry(BaseModel):
26
+ """
27
+ A ruled-out or unverified hypothesis recorded in structured RCA.
28
+ """ # noqa: E501
29
+ statement: StrictStr = Field(description="Plain-language hypothesis statement.")
30
+ falsifier: Optional[StrictStr] = Field(default=None, description="Evidence that would falsify the hypothesis.")
31
+ reason: Optional[StrictStr] = Field(default=None, description="Why the hypothesis was ruled out or left unverified.")
32
+ missing_capability: Optional[StrictStr] = Field(default=None, description="Tool or integration gap that blocked verification.")
33
+ what_would_falsify: Optional[StrictStr] = Field(default=None, description="Concrete signal that would confirm or reject the hypothesis.")
34
+ __properties: ClassVar[List[str]] = ["statement", "falsifier", "reason", "missing_capability", "what_would_falsify"]
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 InvestigationStructuredHypothesisEntry 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
+ # set to None if falsifier (nullable) is None
76
+ # and model_fields_set contains the field
77
+ if self.falsifier is None and "falsifier" in self.model_fields_set:
78
+ _dict['falsifier'] = None
79
+
80
+ # set to None if reason (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.reason is None and "reason" in self.model_fields_set:
83
+ _dict['reason'] = None
84
+
85
+ # set to None if missing_capability (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.missing_capability is None and "missing_capability" in self.model_fields_set:
88
+ _dict['missing_capability'] = None
89
+
90
+ # set to None if what_would_falsify (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.what_would_falsify is None and "what_would_falsify" in self.model_fields_set:
93
+ _dict['what_would_falsify'] = None
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of InvestigationStructuredHypothesisEntry from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate({
107
+ "statement": obj.get("statement"),
108
+ "falsifier": obj.get("falsifier"),
109
+ "reason": obj.get("reason"),
110
+ "missing_capability": obj.get("missing_capability"),
111
+ "what_would_falsify": obj.get("what_would_falsify")
112
+ })
113
+ return _obj
114
+
115
+
@@ -0,0 +1,120 @@
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 InvestigationStructuredLimitationEntry(BaseModel):
26
+ """
27
+ An observability or integration limitation recorded during triage.
28
+ """ # noqa: E501
29
+ plane: Optional[StrictStr] = Field(default=None, description="Observability plane (metrics, logs, traces, etc.).")
30
+ datasource_uid_or_tool: Optional[StrictStr] = Field(default=None, description="Datasource UID or tool name that was unavailable.")
31
+ error_verbatim: Optional[StrictStr] = Field(default=None, description="Raw error text from the failed probe.")
32
+ operator_action: Optional[StrictStr] = Field(default=None, description="Suggested operator follow-up.")
33
+ status: Optional[StrictStr] = Field(default=None, description="Structured limitation outcome (e.g. selector_recovery_exhausted when logs recovery ran but the plane is still empty).")
34
+ __properties: ClassVar[List[str]] = ["plane", "datasource_uid_or_tool", "error_verbatim", "operator_action", "status"]
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 InvestigationStructuredLimitationEntry 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
+ # set to None if plane (nullable) is None
76
+ # and model_fields_set contains the field
77
+ if self.plane is None and "plane" in self.model_fields_set:
78
+ _dict['plane'] = None
79
+
80
+ # set to None if datasource_uid_or_tool (nullable) is None
81
+ # and model_fields_set contains the field
82
+ if self.datasource_uid_or_tool is None and "datasource_uid_or_tool" in self.model_fields_set:
83
+ _dict['datasource_uid_or_tool'] = None
84
+
85
+ # set to None if error_verbatim (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.error_verbatim is None and "error_verbatim" in self.model_fields_set:
88
+ _dict['error_verbatim'] = None
89
+
90
+ # set to None if operator_action (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.operator_action is None and "operator_action" in self.model_fields_set:
93
+ _dict['operator_action'] = None
94
+
95
+ # set to None if status (nullable) is None
96
+ # and model_fields_set contains the field
97
+ if self.status is None and "status" in self.model_fields_set:
98
+ _dict['status'] = None
99
+
100
+ return _dict
101
+
102
+ @classmethod
103
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104
+ """Create an instance of InvestigationStructuredLimitationEntry 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
+ "plane": obj.get("plane"),
113
+ "datasource_uid_or_tool": obj.get("datasource_uid_or_tool"),
114
+ "error_verbatim": obj.get("error_verbatim"),
115
+ "operator_action": obj.get("operator_action"),
116
+ "status": obj.get("status")
117
+ })
118
+ return _obj
119
+
120
+