blaxel 0.1.16rc60__py3-none-any.whl → 0.1.18rc61__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 (60) hide show
  1. blaxel/authentication/clientcredentials.py +1 -1
  2. blaxel/client/api/jobs/__init__.py +0 -0
  3. blaxel/client/api/{default/get_template_file_contents.py → jobs/create_job.py} +57 -44
  4. blaxel/client/api/jobs/delete_job.py +154 -0
  5. blaxel/client/api/{default/get_template_contents.py → jobs/get_job.py} +43 -30
  6. blaxel/client/api/jobs/list_job_revisions.py +159 -0
  7. blaxel/client/api/jobs/list_jobs.py +135 -0
  8. blaxel/client/api/jobs/update_job.py +179 -0
  9. blaxel/client/models/__init__.py +34 -0
  10. blaxel/client/models/job.py +129 -0
  11. blaxel/client/models/job_execution_config.py +79 -0
  12. blaxel/client/models/job_metrics.py +199 -0
  13. blaxel/client/models/job_metrics_executions_chart.py +45 -0
  14. blaxel/client/models/job_metrics_executions_total.py +45 -0
  15. blaxel/client/models/job_metrics_tasks_chart.py +45 -0
  16. blaxel/client/models/job_metrics_tasks_total.py +45 -0
  17. blaxel/client/models/job_spec.py +208 -0
  18. blaxel/client/models/jobs_chart.py +94 -0
  19. blaxel/client/models/jobs_chart_value.py +70 -0
  20. blaxel/client/models/jobs_executions.py +88 -0
  21. blaxel/client/models/jobs_network_chart.py +94 -0
  22. blaxel/client/models/jobs_success_failed_chart.py +139 -0
  23. blaxel/client/models/jobs_tasks.py +88 -0
  24. blaxel/client/models/jobs_total.py +97 -0
  25. blaxel/client/models/preview_spec.py +55 -1
  26. blaxel/client/models/preview_spec_request_headers.py +48 -0
  27. blaxel/{sandbox/client/models/get_process_identifier_logs_response_200.py → client/models/preview_spec_response_headers.py} +6 -6
  28. blaxel/client/models/runtime.py +18 -0
  29. blaxel/client/models/serverless_config.py +9 -0
  30. blaxel/common/internal.py +0 -2
  31. blaxel/common/logger.py +2 -0
  32. blaxel/instrumentation/manager.py +1 -1
  33. blaxel/jobs/__init__.py +4 -8
  34. blaxel/sandbox/client/api/filesystem/delete_filesystem_path.py +4 -0
  35. blaxel/sandbox/client/api/filesystem/get_filesystem_path.py +4 -0
  36. blaxel/sandbox/client/api/filesystem/get_watch_filesystem_path.py +22 -1
  37. blaxel/sandbox/client/api/filesystem/put_filesystem_path.py +8 -4
  38. blaxel/sandbox/client/api/network/delete_network_process_pid_monitor.py +4 -0
  39. blaxel/sandbox/client/api/network/get_network_process_pid_ports.py +4 -0
  40. blaxel/sandbox/client/api/network/post_network_process_pid_monitor.py +4 -0
  41. blaxel/sandbox/client/api/process/delete_process_identifier.py +4 -0
  42. blaxel/sandbox/client/api/process/delete_process_identifier_kill.py +4 -0
  43. blaxel/sandbox/client/api/process/get_process_identifier_logs.py +16 -16
  44. blaxel/sandbox/client/api/process/get_process_identifier_logs_stream.py +4 -0
  45. blaxel/sandbox/client/api/process/get_ws_process_identifier_logs_stream.py +8 -8
  46. blaxel/sandbox/client/api/process/post_process.py +4 -0
  47. blaxel/sandbox/client/models/__init__.py +4 -2
  48. blaxel/sandbox/client/models/directory.py +9 -0
  49. blaxel/sandbox/client/models/file.py +9 -0
  50. blaxel/sandbox/client/models/file_with_content.py +9 -0
  51. blaxel/sandbox/client/models/process_logs.py +78 -0
  52. blaxel/sandbox/client/models/process_response.py +12 -4
  53. blaxel/sandbox/client/models/process_response_status.py +12 -0
  54. blaxel/sandbox/client/models/subdirectory.py +9 -0
  55. blaxel/sandbox/preview.py +13 -17
  56. blaxel/sandbox/process.py +8 -9
  57. {blaxel-0.1.16rc60.dist-info → blaxel-0.1.18rc61.dist-info}/METADATA +1 -1
  58. {blaxel-0.1.16rc60.dist-info → blaxel-0.1.18rc61.dist-info}/RECORD +60 -37
  59. {blaxel-0.1.16rc60.dist-info → blaxel-0.1.18rc61.dist-info}/WHEEL +0 -0
  60. {blaxel-0.1.16rc60.dist-info → blaxel-0.1.18rc61.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,70 @@
1
+ from typing import Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ T = TypeVar("T", bound="JobsChartValue")
9
+
10
+
11
+ @_attrs_define
12
+ class JobsChartValue:
13
+ """Jobs CPU usage
14
+
15
+ Attributes:
16
+ timestamp (Union[Unset, str]): Metric timestamp
17
+ value (Union[Unset, int]): Metric value
18
+ """
19
+
20
+ timestamp: Union[Unset, str] = UNSET
21
+ value: Union[Unset, int] = UNSET
22
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ timestamp = self.timestamp
26
+
27
+ value = self.value
28
+
29
+ field_dict: dict[str, Any] = {}
30
+ field_dict.update(self.additional_properties)
31
+ field_dict.update({})
32
+ if timestamp is not UNSET:
33
+ field_dict["timestamp"] = timestamp
34
+ if value is not UNSET:
35
+ field_dict["value"] = value
36
+
37
+ return field_dict
38
+
39
+ @classmethod
40
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
41
+ if not src_dict:
42
+ return None
43
+ d = src_dict.copy()
44
+ timestamp = d.pop("timestamp", UNSET)
45
+
46
+ value = d.pop("value", UNSET)
47
+
48
+ jobs_chart_value = cls(
49
+ timestamp=timestamp,
50
+ value=value,
51
+ )
52
+
53
+ jobs_chart_value.additional_properties = d
54
+ return jobs_chart_value
55
+
56
+ @property
57
+ def additional_keys(self) -> list[str]:
58
+ return list(self.additional_properties.keys())
59
+
60
+ def __getitem__(self, key: str) -> Any:
61
+ return self.additional_properties[key]
62
+
63
+ def __setitem__(self, key: str, value: Any) -> None:
64
+ self.additional_properties[key] = value
65
+
66
+ def __delitem__(self, key: str) -> None:
67
+ del self.additional_properties[key]
68
+
69
+ def __contains__(self, key: str) -> bool:
70
+ return key in self.additional_properties
@@ -0,0 +1,88 @@
1
+ from typing import Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ T = TypeVar("T", bound="JobsExecutions")
9
+
10
+
11
+ @_attrs_define
12
+ class JobsExecutions:
13
+ """Jobs executions
14
+
15
+ Attributes:
16
+ failed (Union[Unset, int]): Failed executions
17
+ running (Union[Unset, int]): Running executions
18
+ success (Union[Unset, int]): Success executions
19
+ total (Union[Unset, int]): Total executions
20
+ """
21
+
22
+ failed: Union[Unset, int] = UNSET
23
+ running: Union[Unset, int] = UNSET
24
+ success: Union[Unset, int] = UNSET
25
+ total: Union[Unset, int] = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ failed = self.failed
30
+
31
+ running = self.running
32
+
33
+ success = self.success
34
+
35
+ total = self.total
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update({})
40
+ if failed is not UNSET:
41
+ field_dict["failed"] = failed
42
+ if running is not UNSET:
43
+ field_dict["running"] = running
44
+ if success is not UNSET:
45
+ field_dict["success"] = success
46
+ if total is not UNSET:
47
+ field_dict["total"] = total
48
+
49
+ return field_dict
50
+
51
+ @classmethod
52
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
53
+ if not src_dict:
54
+ return None
55
+ d = src_dict.copy()
56
+ failed = d.pop("failed", UNSET)
57
+
58
+ running = d.pop("running", UNSET)
59
+
60
+ success = d.pop("success", UNSET)
61
+
62
+ total = d.pop("total", UNSET)
63
+
64
+ jobs_executions = cls(
65
+ failed=failed,
66
+ running=running,
67
+ success=success,
68
+ total=total,
69
+ )
70
+
71
+ jobs_executions.additional_properties = d
72
+ return jobs_executions
73
+
74
+ @property
75
+ def additional_keys(self) -> list[str]:
76
+ return list(self.additional_properties.keys())
77
+
78
+ def __getitem__(self, key: str) -> Any:
79
+ return self.additional_properties[key]
80
+
81
+ def __setitem__(self, key: str, value: Any) -> None:
82
+ self.additional_properties[key] = value
83
+
84
+ def __delitem__(self, key: str) -> None:
85
+ del self.additional_properties[key]
86
+
87
+ def __contains__(self, key: str) -> bool:
88
+ return key in self.additional_properties
@@ -0,0 +1,94 @@
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ if TYPE_CHECKING:
9
+ from ..models.jobs_chart_value import JobsChartValue
10
+
11
+
12
+ T = TypeVar("T", bound="JobsNetworkChart")
13
+
14
+
15
+ @_attrs_define
16
+ class JobsNetworkChart:
17
+ """Jobs chart
18
+
19
+ Attributes:
20
+ received (Union[Unset, JobsChartValue]): Jobs CPU usage
21
+ sent (Union[Unset, JobsChartValue]): Jobs CPU usage
22
+ """
23
+
24
+ received: Union[Unset, "JobsChartValue"] = UNSET
25
+ sent: Union[Unset, "JobsChartValue"] = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ received: Union[Unset, dict[str, Any]] = UNSET
30
+ if self.received and not isinstance(self.received, Unset) and not isinstance(self.received, dict):
31
+ received = self.received.to_dict()
32
+ elif self.received and isinstance(self.received, dict):
33
+ received = self.received
34
+
35
+ sent: Union[Unset, dict[str, Any]] = UNSET
36
+ if self.sent and not isinstance(self.sent, Unset) and not isinstance(self.sent, dict):
37
+ sent = self.sent.to_dict()
38
+ elif self.sent and isinstance(self.sent, dict):
39
+ sent = self.sent
40
+
41
+ field_dict: dict[str, Any] = {}
42
+ field_dict.update(self.additional_properties)
43
+ field_dict.update({})
44
+ if received is not UNSET:
45
+ field_dict["received"] = received
46
+ if sent is not UNSET:
47
+ field_dict["sent"] = sent
48
+
49
+ return field_dict
50
+
51
+ @classmethod
52
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
53
+ from ..models.jobs_chart_value import JobsChartValue
54
+
55
+ if not src_dict:
56
+ return None
57
+ d = src_dict.copy()
58
+ _received = d.pop("received", UNSET)
59
+ received: Union[Unset, JobsChartValue]
60
+ if isinstance(_received, Unset):
61
+ received = UNSET
62
+ else:
63
+ received = JobsChartValue.from_dict(_received)
64
+
65
+ _sent = d.pop("sent", UNSET)
66
+ sent: Union[Unset, JobsChartValue]
67
+ if isinstance(_sent, Unset):
68
+ sent = UNSET
69
+ else:
70
+ sent = JobsChartValue.from_dict(_sent)
71
+
72
+ jobs_network_chart = cls(
73
+ received=received,
74
+ sent=sent,
75
+ )
76
+
77
+ jobs_network_chart.additional_properties = d
78
+ return jobs_network_chart
79
+
80
+ @property
81
+ def additional_keys(self) -> list[str]:
82
+ return list(self.additional_properties.keys())
83
+
84
+ def __getitem__(self, key: str) -> Any:
85
+ return self.additional_properties[key]
86
+
87
+ def __setitem__(self, key: str, value: Any) -> None:
88
+ self.additional_properties[key] = value
89
+
90
+ def __delitem__(self, key: str) -> None:
91
+ del self.additional_properties[key]
92
+
93
+ def __contains__(self, key: str) -> bool:
94
+ return key in self.additional_properties
@@ -0,0 +1,139 @@
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ if TYPE_CHECKING:
9
+ from ..models.jobs_chart_value import JobsChartValue
10
+
11
+
12
+ T = TypeVar("T", bound="JobsSuccessFailedChart")
13
+
14
+
15
+ @_attrs_define
16
+ class JobsSuccessFailedChart:
17
+ """Jobs chart
18
+
19
+ Attributes:
20
+ failed (Union[Unset, JobsChartValue]): Jobs CPU usage
21
+ retried (Union[Unset, JobsChartValue]): Jobs CPU usage
22
+ success (Union[Unset, JobsChartValue]): Jobs CPU usage
23
+ timestamp (Union[Unset, str]): Metric timestamp
24
+ total (Union[Unset, JobsChartValue]): Jobs CPU usage
25
+ """
26
+
27
+ failed: Union[Unset, "JobsChartValue"] = UNSET
28
+ retried: Union[Unset, "JobsChartValue"] = UNSET
29
+ success: Union[Unset, "JobsChartValue"] = UNSET
30
+ timestamp: Union[Unset, str] = UNSET
31
+ total: Union[Unset, "JobsChartValue"] = UNSET
32
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
+
34
+ def to_dict(self) -> dict[str, Any]:
35
+ failed: Union[Unset, dict[str, Any]] = UNSET
36
+ if self.failed and not isinstance(self.failed, Unset) and not isinstance(self.failed, dict):
37
+ failed = self.failed.to_dict()
38
+ elif self.failed and isinstance(self.failed, dict):
39
+ failed = self.failed
40
+
41
+ retried: Union[Unset, dict[str, Any]] = UNSET
42
+ if self.retried and not isinstance(self.retried, Unset) and not isinstance(self.retried, dict):
43
+ retried = self.retried.to_dict()
44
+ elif self.retried and isinstance(self.retried, dict):
45
+ retried = self.retried
46
+
47
+ success: Union[Unset, dict[str, Any]] = UNSET
48
+ if self.success and not isinstance(self.success, Unset) and not isinstance(self.success, dict):
49
+ success = self.success.to_dict()
50
+ elif self.success and isinstance(self.success, dict):
51
+ success = self.success
52
+
53
+ timestamp = self.timestamp
54
+
55
+ total: Union[Unset, dict[str, Any]] = UNSET
56
+ if self.total and not isinstance(self.total, Unset) and not isinstance(self.total, dict):
57
+ total = self.total.to_dict()
58
+ elif self.total and isinstance(self.total, dict):
59
+ total = self.total
60
+
61
+ field_dict: dict[str, Any] = {}
62
+ field_dict.update(self.additional_properties)
63
+ field_dict.update({})
64
+ if failed is not UNSET:
65
+ field_dict["failed"] = failed
66
+ if retried is not UNSET:
67
+ field_dict["retried"] = retried
68
+ if success is not UNSET:
69
+ field_dict["success"] = success
70
+ if timestamp is not UNSET:
71
+ field_dict["timestamp"] = timestamp
72
+ if total is not UNSET:
73
+ field_dict["total"] = total
74
+
75
+ return field_dict
76
+
77
+ @classmethod
78
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
79
+ from ..models.jobs_chart_value import JobsChartValue
80
+
81
+ if not src_dict:
82
+ return None
83
+ d = src_dict.copy()
84
+ _failed = d.pop("failed", UNSET)
85
+ failed: Union[Unset, JobsChartValue]
86
+ if isinstance(_failed, Unset):
87
+ failed = UNSET
88
+ else:
89
+ failed = JobsChartValue.from_dict(_failed)
90
+
91
+ _retried = d.pop("retried", UNSET)
92
+ retried: Union[Unset, JobsChartValue]
93
+ if isinstance(_retried, Unset):
94
+ retried = UNSET
95
+ else:
96
+ retried = JobsChartValue.from_dict(_retried)
97
+
98
+ _success = d.pop("success", UNSET)
99
+ success: Union[Unset, JobsChartValue]
100
+ if isinstance(_success, Unset):
101
+ success = UNSET
102
+ else:
103
+ success = JobsChartValue.from_dict(_success)
104
+
105
+ timestamp = d.pop("timestamp", UNSET)
106
+
107
+ _total = d.pop("total", UNSET)
108
+ total: Union[Unset, JobsChartValue]
109
+ if isinstance(_total, Unset):
110
+ total = UNSET
111
+ else:
112
+ total = JobsChartValue.from_dict(_total)
113
+
114
+ jobs_success_failed_chart = cls(
115
+ failed=failed,
116
+ retried=retried,
117
+ success=success,
118
+ timestamp=timestamp,
119
+ total=total,
120
+ )
121
+
122
+ jobs_success_failed_chart.additional_properties = d
123
+ return jobs_success_failed_chart
124
+
125
+ @property
126
+ def additional_keys(self) -> list[str]:
127
+ return list(self.additional_properties.keys())
128
+
129
+ def __getitem__(self, key: str) -> Any:
130
+ return self.additional_properties[key]
131
+
132
+ def __setitem__(self, key: str, value: Any) -> None:
133
+ self.additional_properties[key] = value
134
+
135
+ def __delitem__(self, key: str) -> None:
136
+ del self.additional_properties[key]
137
+
138
+ def __contains__(self, key: str) -> bool:
139
+ return key in self.additional_properties
@@ -0,0 +1,88 @@
1
+ from typing import Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ T = TypeVar("T", bound="JobsTasks")
9
+
10
+
11
+ @_attrs_define
12
+ class JobsTasks:
13
+ """Jobs tasks
14
+
15
+ Attributes:
16
+ failed (Union[Unset, int]): Failed executions
17
+ running (Union[Unset, int]): Running executions
18
+ success (Union[Unset, int]): Success executions
19
+ total (Union[Unset, int]): Total executions
20
+ """
21
+
22
+ failed: Union[Unset, int] = UNSET
23
+ running: Union[Unset, int] = UNSET
24
+ success: Union[Unset, int] = UNSET
25
+ total: Union[Unset, int] = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ failed = self.failed
30
+
31
+ running = self.running
32
+
33
+ success = self.success
34
+
35
+ total = self.total
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update({})
40
+ if failed is not UNSET:
41
+ field_dict["failed"] = failed
42
+ if running is not UNSET:
43
+ field_dict["running"] = running
44
+ if success is not UNSET:
45
+ field_dict["success"] = success
46
+ if total is not UNSET:
47
+ field_dict["total"] = total
48
+
49
+ return field_dict
50
+
51
+ @classmethod
52
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
53
+ if not src_dict:
54
+ return None
55
+ d = src_dict.copy()
56
+ failed = d.pop("failed", UNSET)
57
+
58
+ running = d.pop("running", UNSET)
59
+
60
+ success = d.pop("success", UNSET)
61
+
62
+ total = d.pop("total", UNSET)
63
+
64
+ jobs_tasks = cls(
65
+ failed=failed,
66
+ running=running,
67
+ success=success,
68
+ total=total,
69
+ )
70
+
71
+ jobs_tasks.additional_properties = d
72
+ return jobs_tasks
73
+
74
+ @property
75
+ def additional_keys(self) -> list[str]:
76
+ return list(self.additional_properties.keys())
77
+
78
+ def __getitem__(self, key: str) -> Any:
79
+ return self.additional_properties[key]
80
+
81
+ def __setitem__(self, key: str, value: Any) -> None:
82
+ self.additional_properties[key] = value
83
+
84
+ def __delitem__(self, key: str) -> None:
85
+ del self.additional_properties[key]
86
+
87
+ def __contains__(self, key: str) -> bool:
88
+ return key in self.additional_properties
@@ -0,0 +1,97 @@
1
+ from typing import Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ T = TypeVar("T", bound="JobsTotal")
9
+
10
+
11
+ @_attrs_define
12
+ class JobsTotal:
13
+ """Jobs executions
14
+
15
+ Attributes:
16
+ failed (Union[Unset, int]): Failed executions
17
+ retried (Union[Unset, int]): Retried executions
18
+ running (Union[Unset, int]): Running executions
19
+ success (Union[Unset, int]): Success executions
20
+ total (Union[Unset, int]): Total executions
21
+ """
22
+
23
+ failed: Union[Unset, int] = UNSET
24
+ retried: Union[Unset, int] = UNSET
25
+ running: Union[Unset, int] = UNSET
26
+ success: Union[Unset, int] = UNSET
27
+ total: Union[Unset, int] = UNSET
28
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ failed = self.failed
32
+
33
+ retried = self.retried
34
+
35
+ running = self.running
36
+
37
+ success = self.success
38
+
39
+ total = self.total
40
+
41
+ field_dict: dict[str, Any] = {}
42
+ field_dict.update(self.additional_properties)
43
+ field_dict.update({})
44
+ if failed is not UNSET:
45
+ field_dict["failed"] = failed
46
+ if retried is not UNSET:
47
+ field_dict["retried"] = retried
48
+ if running is not UNSET:
49
+ field_dict["running"] = running
50
+ if success is not UNSET:
51
+ field_dict["success"] = success
52
+ if total is not UNSET:
53
+ field_dict["total"] = total
54
+
55
+ return field_dict
56
+
57
+ @classmethod
58
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
59
+ if not src_dict:
60
+ return None
61
+ d = src_dict.copy()
62
+ failed = d.pop("failed", UNSET)
63
+
64
+ retried = d.pop("retried", UNSET)
65
+
66
+ running = d.pop("running", UNSET)
67
+
68
+ success = d.pop("success", UNSET)
69
+
70
+ total = d.pop("total", UNSET)
71
+
72
+ jobs_total = cls(
73
+ failed=failed,
74
+ retried=retried,
75
+ running=running,
76
+ success=success,
77
+ total=total,
78
+ )
79
+
80
+ jobs_total.additional_properties = d
81
+ return jobs_total
82
+
83
+ @property
84
+ def additional_keys(self) -> list[str]:
85
+ return list(self.additional_properties.keys())
86
+
87
+ def __getitem__(self, key: str) -> Any:
88
+ return self.additional_properties[key]
89
+
90
+ def __setitem__(self, key: str, value: Any) -> None:
91
+ self.additional_properties[key] = value
92
+
93
+ def __delitem__(self, key: str) -> None:
94
+ del self.additional_properties[key]
95
+
96
+ def __contains__(self, key: str) -> bool:
97
+ return key in self.additional_properties
@@ -1,10 +1,15 @@
1
- from typing import Any, TypeVar, Union
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
5
5
 
6
6
  from ..types import UNSET, Unset
7
7
 
8
+ if TYPE_CHECKING:
9
+ from ..models.preview_spec_request_headers import PreviewSpecRequestHeaders
10
+ from ..models.preview_spec_response_headers import PreviewSpecResponseHeaders
11
+
12
+
8
13
  T = TypeVar("T", bound="PreviewSpec")
9
14
 
10
15
 
@@ -16,12 +21,18 @@ class PreviewSpec:
16
21
  port (Union[Unset, int]): Port of the preview
17
22
  prefix_url (Union[Unset, str]): Prefix URL
18
23
  public (Union[Unset, bool]): Whether the preview is public
24
+ request_headers (Union[Unset, PreviewSpecRequestHeaders]): Those headers will be set in all requests to your
25
+ preview. This is especially useful to set the Authorization header.
26
+ response_headers (Union[Unset, PreviewSpecResponseHeaders]): Those headers will be set in all responses of your
27
+ preview. This is especially useful to set the CORS headers.
19
28
  url (Union[Unset, str]): URL of the preview
20
29
  """
21
30
 
22
31
  port: Union[Unset, int] = UNSET
23
32
  prefix_url: Union[Unset, str] = UNSET
24
33
  public: Union[Unset, bool] = UNSET
34
+ request_headers: Union[Unset, "PreviewSpecRequestHeaders"] = UNSET
35
+ response_headers: Union[Unset, "PreviewSpecResponseHeaders"] = UNSET
25
36
  url: Union[Unset, str] = UNSET
26
37
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
38
 
@@ -32,6 +43,26 @@ class PreviewSpec:
32
43
 
33
44
  public = self.public
34
45
 
46
+ request_headers: Union[Unset, dict[str, Any]] = UNSET
47
+ if (
48
+ self.request_headers
49
+ and not isinstance(self.request_headers, Unset)
50
+ and not isinstance(self.request_headers, dict)
51
+ ):
52
+ request_headers = self.request_headers.to_dict()
53
+ elif self.request_headers and isinstance(self.request_headers, dict):
54
+ request_headers = self.request_headers
55
+
56
+ response_headers: Union[Unset, dict[str, Any]] = UNSET
57
+ if (
58
+ self.response_headers
59
+ and not isinstance(self.response_headers, Unset)
60
+ and not isinstance(self.response_headers, dict)
61
+ ):
62
+ response_headers = self.response_headers.to_dict()
63
+ elif self.response_headers and isinstance(self.response_headers, dict):
64
+ response_headers = self.response_headers
65
+
35
66
  url = self.url
36
67
 
37
68
  field_dict: dict[str, Any] = {}
@@ -43,6 +74,10 @@ class PreviewSpec:
43
74
  field_dict["prefixUrl"] = prefix_url
44
75
  if public is not UNSET:
45
76
  field_dict["public"] = public
77
+ if request_headers is not UNSET:
78
+ field_dict["requestHeaders"] = request_headers
79
+ if response_headers is not UNSET:
80
+ field_dict["responseHeaders"] = response_headers
46
81
  if url is not UNSET:
47
82
  field_dict["url"] = url
48
83
 
@@ -50,6 +85,9 @@ class PreviewSpec:
50
85
 
51
86
  @classmethod
52
87
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
88
+ from ..models.preview_spec_request_headers import PreviewSpecRequestHeaders
89
+ from ..models.preview_spec_response_headers import PreviewSpecResponseHeaders
90
+
53
91
  if not src_dict:
54
92
  return None
55
93
  d = src_dict.copy()
@@ -59,12 +97,28 @@ class PreviewSpec:
59
97
 
60
98
  public = d.pop("public", UNSET)
61
99
 
100
+ _request_headers = d.pop("requestHeaders", UNSET)
101
+ request_headers: Union[Unset, PreviewSpecRequestHeaders]
102
+ if isinstance(_request_headers, Unset):
103
+ request_headers = UNSET
104
+ else:
105
+ request_headers = PreviewSpecRequestHeaders.from_dict(_request_headers)
106
+
107
+ _response_headers = d.pop("responseHeaders", UNSET)
108
+ response_headers: Union[Unset, PreviewSpecResponseHeaders]
109
+ if isinstance(_response_headers, Unset):
110
+ response_headers = UNSET
111
+ else:
112
+ response_headers = PreviewSpecResponseHeaders.from_dict(_response_headers)
113
+
62
114
  url = d.pop("url", UNSET)
63
115
 
64
116
  preview_spec = cls(
65
117
  port=port,
66
118
  prefix_url=prefix_url,
67
119
  public=public,
120
+ request_headers=request_headers,
121
+ response_headers=response_headers,
68
122
  url=url,
69
123
  )
70
124