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,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 ScheduleRunStatus(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
Status of a schedule execution run.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
RUNNING = 'running'
|
|
30
|
+
SUCCESS = 'success'
|
|
31
|
+
FAILED = 'failed'
|
|
32
|
+
SKIPPED = 'skipped'
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def from_json(cls, json_str: str) -> Self:
|
|
36
|
+
"""Create an instance of ScheduleRunStatus from a JSON string"""
|
|
37
|
+
return cls(json.loads(json_str))
|
|
38
|
+
|
|
39
|
+
|
|
@@ -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 ScheduleTargetType(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
Whether the schedule or webhook targets an agent, a workflow, or an installed app. App targets POST a fixed payload to endpoint_path on the catalog install URL (schedules on cron; webhooks on inbound trigger).
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
AGENT = 'agent'
|
|
30
|
+
WORKFLOW = 'workflow'
|
|
31
|
+
APP = 'app'
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_json(cls, json_str: str) -> Self:
|
|
35
|
+
"""Create an instance of ScheduleTargetType from a JSON string"""
|
|
36
|
+
return cls(json.loads(json_str))
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,141 @@
|
|
|
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, StrictBool, StrictFloat, StrictInt, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
23
|
+
from stackgen.generated.models.artifact_info import ArtifactInfo
|
|
24
|
+
from stackgen.generated.models.session_responder_kind import SessionResponderKind
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class Session(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Detailed, rich view of a conversation session offering profound insights and a 'wow' factor for users.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
session_id: Optional[StrictStr] = Field(default=None, description="Logical session identifier.")
|
|
33
|
+
agent_name: Optional[StrictStr] = Field(default=None, description="Agent that handled this session.")
|
|
34
|
+
started_by: Optional[StrictStr] = Field(default=None, description="User email of the person who initiated the session.")
|
|
35
|
+
started_by_id: Optional[StrictStr] = Field(default=None, description="ID of the person who initiated the session.")
|
|
36
|
+
started_at: Optional[datetime] = Field(default=None, description="Timestamp of the first event.")
|
|
37
|
+
last_activity: Optional[datetime] = Field(default=None, description="Timestamp of the most recent event.")
|
|
38
|
+
duration_ms: Optional[StrictInt] = Field(default=None, description="Total active duration of the session in milliseconds.")
|
|
39
|
+
primary_query: Optional[StrictStr] = Field(default=None, description="The full initial request or primary prompt that started the session.")
|
|
40
|
+
summary: Optional[StrictStr] = Field(default=None, description="AI-generated, rich-text summary of the session's overall outcome, key decisions, or final state.")
|
|
41
|
+
total_cost: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total estimated cost in USD for this session. Returns -1 if the cost is not yet calculated or the session is actively running.")
|
|
42
|
+
artifacts: Optional[List[ArtifactInfo]] = Field(default=None, description="List of artifacts (files, images, etc.) uploaded or generated during the session.")
|
|
43
|
+
event_counts: Optional[Dict[str, StrictInt]] = Field(default=None, description="Dictionary mapping event types (e.g., 'chat_request', 'tool_call', 'error') to their respective counts within the session.")
|
|
44
|
+
tags: Optional[List[StrictStr]] = Field(default=None, description="AI-generated labels categorizing the session for quick filtering (e.g., 'Security', 'Database', 'High Cost').")
|
|
45
|
+
workflow_name: Optional[StrictStr] = Field(default=None, description="Name of the workflow that was executed in this session. Empty for direct agent chat sessions.")
|
|
46
|
+
prompt: Optional[StrictStr] = Field(default=None, description="Short snippet of the original user request (max 120 chars). Mirrors the list view's prompt so detail and list agree.")
|
|
47
|
+
source_app: Optional[StrictStr] = Field(default=None, description="Installed application that initiated the session, when applicable.")
|
|
48
|
+
responder_kind: Optional[SessionResponderKind] = None
|
|
49
|
+
responder_name: Optional[StrictStr] = Field(default=None, description="Display name of the primary responder (agent name, workflow name, or app id).")
|
|
50
|
+
title: Optional[StrictStr] = Field(default=None, description="User-assigned display name for this session. When set, shown instead of the prompt snippet.")
|
|
51
|
+
starred: Optional[StrictBool] = Field(default=None, description="Whether the user has starred (favourited) this session.")
|
|
52
|
+
archived: Optional[StrictBool] = Field(default=None, description="Whether the conversation is archived and omitted from active history.")
|
|
53
|
+
source_metadata: Optional[Dict[str, StrictStr]] = Field(default=None, description="Arbitrary key-value metadata from the initiating app. Examples: alert_id, dashboard_url, severity, etc. ")
|
|
54
|
+
required_completion_tools: Optional[List[StrictStr]] = Field(default=None, description="Immutable session policy listing tool names that must SUCCESSFULLY execute at least once before each Plan/ReAcTree Chat may finish. Empty when no completion gate was set for this session. ")
|
|
55
|
+
__properties: ClassVar[List[str]] = ["session_id", "agent_name", "started_by", "started_by_id", "started_at", "last_activity", "duration_ms", "primary_query", "summary", "total_cost", "artifacts", "event_counts", "tags", "workflow_name", "prompt", "source_app", "responder_kind", "responder_name", "title", "starred", "archived", "source_metadata", "required_completion_tools"]
|
|
56
|
+
|
|
57
|
+
model_config = ConfigDict(
|
|
58
|
+
populate_by_name=True,
|
|
59
|
+
validate_assignment=True,
|
|
60
|
+
protected_namespaces=(),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def to_str(self) -> str:
|
|
65
|
+
"""Returns the string representation of the model using alias"""
|
|
66
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
67
|
+
|
|
68
|
+
def to_json(self) -> str:
|
|
69
|
+
"""Returns the JSON representation of the model using alias"""
|
|
70
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
71
|
+
return json.dumps(self.to_dict())
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of Session from a JSON string"""
|
|
76
|
+
return cls.from_dict(json.loads(json_str))
|
|
77
|
+
|
|
78
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
79
|
+
"""Return the dictionary representation of the model using alias.
|
|
80
|
+
|
|
81
|
+
This has the following differences from calling pydantic's
|
|
82
|
+
`self.model_dump(by_alias=True)`:
|
|
83
|
+
|
|
84
|
+
* `None` is only added to the output dict for nullable fields that
|
|
85
|
+
were set at model initialization. Other fields with value `None`
|
|
86
|
+
are ignored.
|
|
87
|
+
"""
|
|
88
|
+
excluded_fields: Set[str] = set([
|
|
89
|
+
])
|
|
90
|
+
|
|
91
|
+
_dict = self.model_dump(
|
|
92
|
+
by_alias=True,
|
|
93
|
+
exclude=excluded_fields,
|
|
94
|
+
exclude_none=True,
|
|
95
|
+
)
|
|
96
|
+
# override the default output from pydantic by calling `to_dict()` of each item in artifacts (list)
|
|
97
|
+
_items = []
|
|
98
|
+
if self.artifacts:
|
|
99
|
+
for _item_artifacts in self.artifacts:
|
|
100
|
+
if _item_artifacts:
|
|
101
|
+
_items.append(_item_artifacts.to_dict())
|
|
102
|
+
_dict['artifacts'] = _items
|
|
103
|
+
return _dict
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
107
|
+
"""Create an instance of Session from a dict"""
|
|
108
|
+
if obj is None:
|
|
109
|
+
return None
|
|
110
|
+
|
|
111
|
+
if not isinstance(obj, dict):
|
|
112
|
+
return cls.model_validate(obj)
|
|
113
|
+
|
|
114
|
+
_obj = cls.model_validate({
|
|
115
|
+
"session_id": obj.get("session_id"),
|
|
116
|
+
"agent_name": obj.get("agent_name"),
|
|
117
|
+
"started_by": obj.get("started_by"),
|
|
118
|
+
"started_by_id": obj.get("started_by_id"),
|
|
119
|
+
"started_at": obj.get("started_at"),
|
|
120
|
+
"last_activity": obj.get("last_activity"),
|
|
121
|
+
"duration_ms": obj.get("duration_ms"),
|
|
122
|
+
"primary_query": obj.get("primary_query"),
|
|
123
|
+
"summary": obj.get("summary"),
|
|
124
|
+
"total_cost": obj.get("total_cost"),
|
|
125
|
+
"artifacts": [ArtifactInfo.from_dict(_item) for _item in obj["artifacts"]] if obj.get("artifacts") is not None else None,
|
|
126
|
+
"event_counts": obj.get("event_counts"),
|
|
127
|
+
"tags": obj.get("tags"),
|
|
128
|
+
"workflow_name": obj.get("workflow_name"),
|
|
129
|
+
"prompt": obj.get("prompt"),
|
|
130
|
+
"source_app": obj.get("source_app"),
|
|
131
|
+
"responder_kind": obj.get("responder_kind"),
|
|
132
|
+
"responder_name": obj.get("responder_name"),
|
|
133
|
+
"title": obj.get("title"),
|
|
134
|
+
"starred": obj.get("starred"),
|
|
135
|
+
"archived": obj.get("archived"),
|
|
136
|
+
"source_metadata": obj.get("source_metadata"),
|
|
137
|
+
"required_completion_tools": obj.get("required_completion_tools")
|
|
138
|
+
})
|
|
139
|
+
return _obj
|
|
140
|
+
|
|
141
|
+
|
|
@@ -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 SessionResponderKind(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
Kind of primary responder for a session.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
AGENT = 'agent'
|
|
30
|
+
WORKFLOW = 'workflow'
|
|
31
|
+
APP = 'app'
|
|
32
|
+
SCHEDULE = 'schedule'
|
|
33
|
+
WEBHOOK = 'webhook'
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def from_json(cls, json_str: str) -> Self:
|
|
37
|
+
"""Create an instance of SessionResponderKind from a JSON string"""
|
|
38
|
+
return cls(json.loads(json_str))
|
|
39
|
+
|
|
40
|
+
|
|
@@ -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 SignalSeverity(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
Normalized monitor signal severity used for alerts table badges and severity filtering. Maps multiple upstream source_severity strings into a single bucket (for example warning and medium both map to Medium).
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
CRITICAL = 'Critical'
|
|
30
|
+
HIGH = 'High'
|
|
31
|
+
MEDIUM = 'Medium'
|
|
32
|
+
LOW = 'Low'
|
|
33
|
+
INFO = 'info'
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def from_json(cls, json_str: str) -> Self:
|
|
37
|
+
"""Create an instance of SignalSeverity from a JSON string"""
|
|
38
|
+
return cls(json.loads(json_str))
|
|
39
|
+
|
|
40
|
+
|
|
@@ -0,0 +1,136 @@
|
|
|
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, StrictInt, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from stackgen.generated.models.alert_sync_run_status import AlertSyncRunStatus
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class SyncResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
State of an alert sync run — returned immediately on start and updated on poll.
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
sync_run_id: StrictStr = Field(description="UUID of the alert_sync_runs row. Use this to poll GET /api/v1/alerts/sync/{id}.")
|
|
32
|
+
triggered_by: StrictStr = Field(description="What triggered this sync (manual, schedule, webhook, or chat_correlate).")
|
|
33
|
+
source: Optional[StrictStr] = Field(default=None, description="Alert source type being synced (e.g. \"grafana\"). Null means the default source.")
|
|
34
|
+
integration_name: Optional[StrictStr] = Field(default=None, description="Integration instance name being synced (e.g. \"prod-grafana\"). Null means the first available.")
|
|
35
|
+
started_at: Optional[datetime] = Field(default=None, description="When the sync run started.")
|
|
36
|
+
finished_at: Optional[datetime] = Field(default=None, description="When the sync run completed or failed. Null while still running.")
|
|
37
|
+
status: AlertSyncRunStatus
|
|
38
|
+
alerts_created: StrictInt = Field(description="Number of new alert rows created (0 while running).")
|
|
39
|
+
alerts_updated: StrictInt = Field(description="Number of existing alert rows updated (0 while running).")
|
|
40
|
+
alerts_resolved: StrictInt = Field(description="Number of alerts marked resolved (0 while running).")
|
|
41
|
+
error: Optional[StrictStr] = Field(default=None, description="Error message when status is \"failed\".")
|
|
42
|
+
__properties: ClassVar[List[str]] = ["sync_run_id", "triggered_by", "source", "integration_name", "started_at", "finished_at", "status", "alerts_created", "alerts_updated", "alerts_resolved", "error"]
|
|
43
|
+
|
|
44
|
+
@field_validator('triggered_by')
|
|
45
|
+
def triggered_by_validate_enum(cls, value):
|
|
46
|
+
"""Validates the enum"""
|
|
47
|
+
if value not in set(['manual', 'schedule', 'webhook', 'chat_correlate']):
|
|
48
|
+
raise ValueError("must be one of enum values ('manual', 'schedule', 'webhook', 'chat_correlate')")
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
model_config = ConfigDict(
|
|
52
|
+
populate_by_name=True,
|
|
53
|
+
validate_assignment=True,
|
|
54
|
+
protected_namespaces=(),
|
|
55
|
+
)
|
|
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
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
65
|
+
return json.dumps(self.to_dict())
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
69
|
+
"""Create an instance of SyncResponse from a JSON string"""
|
|
70
|
+
return cls.from_dict(json.loads(json_str))
|
|
71
|
+
|
|
72
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
73
|
+
"""Return the dictionary representation of the model using alias.
|
|
74
|
+
|
|
75
|
+
This has the following differences from calling pydantic's
|
|
76
|
+
`self.model_dump(by_alias=True)`:
|
|
77
|
+
|
|
78
|
+
* `None` is only added to the output dict for nullable fields that
|
|
79
|
+
were set at model initialization. Other fields with value `None`
|
|
80
|
+
are ignored.
|
|
81
|
+
"""
|
|
82
|
+
excluded_fields: Set[str] = set([
|
|
83
|
+
])
|
|
84
|
+
|
|
85
|
+
_dict = self.model_dump(
|
|
86
|
+
by_alias=True,
|
|
87
|
+
exclude=excluded_fields,
|
|
88
|
+
exclude_none=True,
|
|
89
|
+
)
|
|
90
|
+
# set to None if source (nullable) is None
|
|
91
|
+
# and model_fields_set contains the field
|
|
92
|
+
if self.source is None and "source" in self.model_fields_set:
|
|
93
|
+
_dict['source'] = None
|
|
94
|
+
|
|
95
|
+
# set to None if integration_name (nullable) is None
|
|
96
|
+
# and model_fields_set contains the field
|
|
97
|
+
if self.integration_name is None and "integration_name" in self.model_fields_set:
|
|
98
|
+
_dict['integration_name'] = None
|
|
99
|
+
|
|
100
|
+
# set to None if finished_at (nullable) is None
|
|
101
|
+
# and model_fields_set contains the field
|
|
102
|
+
if self.finished_at is None and "finished_at" in self.model_fields_set:
|
|
103
|
+
_dict['finished_at'] = None
|
|
104
|
+
|
|
105
|
+
# set to None if error (nullable) is None
|
|
106
|
+
# and model_fields_set contains the field
|
|
107
|
+
if self.error is None and "error" in self.model_fields_set:
|
|
108
|
+
_dict['error'] = None
|
|
109
|
+
|
|
110
|
+
return _dict
|
|
111
|
+
|
|
112
|
+
@classmethod
|
|
113
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
114
|
+
"""Create an instance of SyncResponse from a dict"""
|
|
115
|
+
if obj is None:
|
|
116
|
+
return None
|
|
117
|
+
|
|
118
|
+
if not isinstance(obj, dict):
|
|
119
|
+
return cls.model_validate(obj)
|
|
120
|
+
|
|
121
|
+
_obj = cls.model_validate({
|
|
122
|
+
"sync_run_id": obj.get("sync_run_id"),
|
|
123
|
+
"triggered_by": obj.get("triggered_by"),
|
|
124
|
+
"source": obj.get("source"),
|
|
125
|
+
"integration_name": obj.get("integration_name"),
|
|
126
|
+
"started_at": obj.get("started_at"),
|
|
127
|
+
"finished_at": obj.get("finished_at"),
|
|
128
|
+
"status": obj.get("status"),
|
|
129
|
+
"alerts_created": obj.get("alerts_created"),
|
|
130
|
+
"alerts_updated": obj.get("alerts_updated"),
|
|
131
|
+
"alerts_resolved": obj.get("alerts_resolved"),
|
|
132
|
+
"error": obj.get("error")
|
|
133
|
+
})
|
|
134
|
+
return _obj
|
|
135
|
+
|
|
136
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
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 stackgen.generated.models.schedule_target_type import ScheduleTargetType
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class TriggerWebhook202Response(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Acknowledgement returned when a public webhook trigger starts dispatch. session_id and trace_id are not included here because dispatch is asynchronous; poll GET /api/v1/webhooks/{webhook_id}/runs/{invocation_id} until those fields are populated.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
run_id: Optional[StrictStr] = Field(default=None, description="Temporal dispatch workflow run ID.")
|
|
31
|
+
message: Optional[StrictStr] = Field(default=None, description="Human-readable trigger status message.")
|
|
32
|
+
webhook_id: Optional[StrictStr] = Field(default=None, description="Webhook configuration that accepted this trigger.")
|
|
33
|
+
invocation_id: Optional[StrictStr] = Field(default=None, description="Invocation row ID for GET /api/v1/webhooks/{webhook_id}/runs/{invocation_id}. Empty when invocation history is unavailable or the target does not record invocations (for example app-forward webhooks). ")
|
|
34
|
+
target_type: Optional[ScheduleTargetType] = None
|
|
35
|
+
target_name: Optional[StrictStr] = Field(default=None, description="Target agent, workflow, or app name snapshot at trigger time.")
|
|
36
|
+
__properties: ClassVar[List[str]] = ["run_id", "message", "webhook_id", "invocation_id", "target_type", "target_name"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
populate_by_name=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
56
|
+
"""Create an instance of TriggerWebhook202Response from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
|
61
|
+
|
|
62
|
+
This has the following differences from calling pydantic's
|
|
63
|
+
`self.model_dump(by_alias=True)`:
|
|
64
|
+
|
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
|
66
|
+
were set at model initialization. Other fields with value `None`
|
|
67
|
+
are ignored.
|
|
68
|
+
"""
|
|
69
|
+
excluded_fields: Set[str] = set([
|
|
70
|
+
])
|
|
71
|
+
|
|
72
|
+
_dict = self.model_dump(
|
|
73
|
+
by_alias=True,
|
|
74
|
+
exclude=excluded_fields,
|
|
75
|
+
exclude_none=True,
|
|
76
|
+
)
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of TriggerWebhook202Response from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"run_id": obj.get("run_id"),
|
|
90
|
+
"message": obj.get("message"),
|
|
91
|
+
"webhook_id": obj.get("webhook_id"),
|
|
92
|
+
"invocation_id": obj.get("invocation_id"),
|
|
93
|
+
"target_type": obj.get("target_type"),
|
|
94
|
+
"target_name": obj.get("target_name")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
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, StrictBool, StrictInt, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from stackgen.generated.models.schedule_run_status import ScheduleRunStatus
|
|
24
|
+
from stackgen.generated.models.schedule_target_type import ScheduleTargetType
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class WebhookRun(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
A single named webhook invocation. List responses include metadata and payload size/truncation information but omit the payload body.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
id: Optional[StrictStr] = Field(default=None, description="Unique webhook invocation identifier.")
|
|
33
|
+
webhook_id: Optional[StrictStr] = Field(default=None, description="Webhook configuration that received this invocation.")
|
|
34
|
+
webhook_name: Optional[StrictStr] = Field(default=None, description="Webhook name snapshot at invocation time.")
|
|
35
|
+
target_type: Optional[ScheduleTargetType] = None
|
|
36
|
+
target_name: Optional[StrictStr] = Field(default=None, description="Target agent or workflow name snapshot at invocation time.")
|
|
37
|
+
status: Optional[ScheduleRunStatus] = None
|
|
38
|
+
started_at: Optional[datetime] = Field(default=None, description="Timestamp when the webhook was accepted.")
|
|
39
|
+
finished_at: Optional[datetime] = Field(default=None, description="Timestamp when dispatch completed, if known.")
|
|
40
|
+
duration_ms: Optional[StrictInt] = Field(default=None, description="Dispatch duration in milliseconds when finished_at is present.")
|
|
41
|
+
error: Optional[StrictStr] = Field(default=None, description="Error message if dispatch failed.")
|
|
42
|
+
run_id: Optional[StrictStr] = Field(default=None, description="Downstream Temporal execution run ID, empty until available.")
|
|
43
|
+
trace_id: Optional[StrictStr] = Field(default=None, description="Execution trace identifier used by the subscribe endpoint.")
|
|
44
|
+
session_id: Optional[StrictStr] = Field(default=None, description="Downstream session identifier for the dispatched run. Used to correlate this invocation with execution_agent_summaries and the NATS session stream. Empty until dispatch starts a run. ")
|
|
45
|
+
subscribe_url: Optional[StrictStr] = Field(default=None, description="Relative SSE subscribe URL for the execution trace.")
|
|
46
|
+
client_ip: Optional[StrictStr] = Field(default=None, description="Source IP address observed by the webhook handler.")
|
|
47
|
+
payload_bytes: Optional[StrictInt] = Field(default=None, description="Original serialized payload size in bytes.")
|
|
48
|
+
payload_truncated: Optional[StrictBool] = Field(default=None, description="Whether the stored payload was replaced by a bounded preview.")
|
|
49
|
+
payload_preview: Optional[StrictStr] = Field(default=None, description="Bounded payload preview, populated when payload_truncated is true.")
|
|
50
|
+
__properties: ClassVar[List[str]] = ["id", "webhook_id", "webhook_name", "target_type", "target_name", "status", "started_at", "finished_at", "duration_ms", "error", "run_id", "trace_id", "session_id", "subscribe_url", "client_ip", "payload_bytes", "payload_truncated", "payload_preview"]
|
|
51
|
+
|
|
52
|
+
model_config = ConfigDict(
|
|
53
|
+
populate_by_name=True,
|
|
54
|
+
validate_assignment=True,
|
|
55
|
+
protected_namespaces=(),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def to_str(self) -> str:
|
|
60
|
+
"""Returns the string representation of the model using alias"""
|
|
61
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
62
|
+
|
|
63
|
+
def to_json(self) -> str:
|
|
64
|
+
"""Returns the JSON representation of the model using alias"""
|
|
65
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
66
|
+
return json.dumps(self.to_dict())
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
70
|
+
"""Create an instance of WebhookRun from a JSON string"""
|
|
71
|
+
return cls.from_dict(json.loads(json_str))
|
|
72
|
+
|
|
73
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
74
|
+
"""Return the dictionary representation of the model using alias.
|
|
75
|
+
|
|
76
|
+
This has the following differences from calling pydantic's
|
|
77
|
+
`self.model_dump(by_alias=True)`:
|
|
78
|
+
|
|
79
|
+
* `None` is only added to the output dict for nullable fields that
|
|
80
|
+
were set at model initialization. Other fields with value `None`
|
|
81
|
+
are ignored.
|
|
82
|
+
"""
|
|
83
|
+
excluded_fields: Set[str] = set([
|
|
84
|
+
])
|
|
85
|
+
|
|
86
|
+
_dict = self.model_dump(
|
|
87
|
+
by_alias=True,
|
|
88
|
+
exclude=excluded_fields,
|
|
89
|
+
exclude_none=True,
|
|
90
|
+
)
|
|
91
|
+
# set to None if finished_at (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.finished_at is None and "finished_at" in self.model_fields_set:
|
|
94
|
+
_dict['finished_at'] = None
|
|
95
|
+
|
|
96
|
+
return _dict
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
100
|
+
"""Create an instance of WebhookRun from a dict"""
|
|
101
|
+
if obj is None:
|
|
102
|
+
return None
|
|
103
|
+
|
|
104
|
+
if not isinstance(obj, dict):
|
|
105
|
+
return cls.model_validate(obj)
|
|
106
|
+
|
|
107
|
+
_obj = cls.model_validate({
|
|
108
|
+
"id": obj.get("id"),
|
|
109
|
+
"webhook_id": obj.get("webhook_id"),
|
|
110
|
+
"webhook_name": obj.get("webhook_name"),
|
|
111
|
+
"target_type": obj.get("target_type"),
|
|
112
|
+
"target_name": obj.get("target_name"),
|
|
113
|
+
"status": obj.get("status"),
|
|
114
|
+
"started_at": obj.get("started_at"),
|
|
115
|
+
"finished_at": obj.get("finished_at"),
|
|
116
|
+
"duration_ms": obj.get("duration_ms"),
|
|
117
|
+
"error": obj.get("error"),
|
|
118
|
+
"run_id": obj.get("run_id"),
|
|
119
|
+
"trace_id": obj.get("trace_id"),
|
|
120
|
+
"session_id": obj.get("session_id"),
|
|
121
|
+
"subscribe_url": obj.get("subscribe_url"),
|
|
122
|
+
"client_ip": obj.get("client_ip"),
|
|
123
|
+
"payload_bytes": obj.get("payload_bytes"),
|
|
124
|
+
"payload_truncated": obj.get("payload_truncated"),
|
|
125
|
+
"payload_preview": obj.get("payload_preview")
|
|
126
|
+
})
|
|
127
|
+
return _obj
|
|
128
|
+
|
|
129
|
+
|