beamlit 0.0.24rc20__py3-none-any.whl → 0.0.24rc21__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. beamlit/agents/chat.py +37 -11
  2. beamlit/agents/decorator.py +97 -65
  3. beamlit/api/agents/create_agent.py +9 -14
  4. beamlit/api/agents/delete_agent.py +22 -1
  5. beamlit/api/agents/delete_agent_history.py +2 -6
  6. beamlit/api/agents/get_agent.py +22 -1
  7. beamlit/api/agents/get_agent_environment_logs.py +11 -11
  8. beamlit/api/agents/get_agent_history.py +2 -6
  9. beamlit/api/agents/get_agent_metrics.py +22 -1
  10. beamlit/api/agents/list_agent_history.py +11 -11
  11. beamlit/api/agents/list_agents.py +36 -4
  12. beamlit/api/agents/put_agent_history.py +2 -6
  13. beamlit/api/agents/update_agent.py +9 -14
  14. beamlit/api/functions/create_function.py +9 -14
  15. beamlit/api/functions/delete_function.py +22 -1
  16. beamlit/api/functions/get_function.py +22 -1
  17. beamlit/api/functions/get_function_environment_logs.py +11 -11
  18. beamlit/api/functions/get_function_metrics.py +22 -1
  19. beamlit/api/functions/list_functions.py +36 -4
  20. beamlit/api/functions/update_function.py +9 -14
  21. beamlit/api/history/get_agents_history.py +12 -12
  22. beamlit/api/history/list_agents_history.py +12 -12
  23. beamlit/api/integrations/get_integration_connection.py +16 -12
  24. beamlit/api/integrations/get_integration_connection_model.py +8 -1
  25. beamlit/api/integrations/get_integration_model.py +8 -1
  26. beamlit/api/locations/list_locations.py +12 -12
  27. beamlit/api/models/create_model.py +13 -14
  28. beamlit/api/models/delete_model.py +22 -1
  29. beamlit/api/models/get_model.py +22 -1
  30. beamlit/api/models/get_model_environment_logs.py +11 -11
  31. beamlit/api/models/get_model_metrics.py +38 -13
  32. beamlit/api/models/list_models.py +36 -4
  33. beamlit/api/models/update_model.py +13 -14
  34. beamlit/api/privateclusters/__init__.py +0 -0
  35. beamlit/api/{agents/get_agent_deployment_metrics.py → privateclusters/create_private_cluster.py} +28 -55
  36. beamlit/api/{functions/list_function_deployments.py → privateclusters/delete_private_cluster.py} +38 -37
  37. beamlit/api/{agents/get_agent_deployment.py → privateclusters/get_private_cluster.py} +40 -44
  38. beamlit/api/privateclusters/get_private_cluster_health.py +97 -0
  39. beamlit/api/{agents/list_agent_deployments.py → privateclusters/list_private_clusters.py} +30 -45
  40. beamlit/api/{models/list_model_deployments.py → privateclusters/update_private_cluster.py} +38 -45
  41. beamlit/api/privateclusters/update_private_cluster_health.py +97 -0
  42. beamlit/authentication/device_mode.py +3 -9
  43. beamlit/common/generate.py +47 -34
  44. beamlit/common/settings.py +29 -27
  45. beamlit/deploy/deploy.py +101 -342
  46. beamlit/deploy/format.py +70 -0
  47. beamlit/deploy/parser.py +175 -0
  48. beamlit/functions/decorator.py +8 -11
  49. beamlit/models/__init__.py +64 -78
  50. beamlit/models/acl.py +4 -22
  51. beamlit/models/agent.py +34 -95
  52. beamlit/models/agent_history.py +7 -5
  53. beamlit/models/agent_history_event.py +11 -9
  54. beamlit/models/agent_metadata.py +5 -3
  55. beamlit/models/agent_spec.py +54 -45
  56. beamlit/models/api_key.py +14 -14
  57. beamlit/models/configuration.py +11 -0
  58. beamlit/models/core_spec.py +45 -32
  59. beamlit/models/{model_deployment_metrics_query_per_second_per_region_per_code.py → core_spec_configurations.py} +22 -22
  60. beamlit/models/environment.py +33 -105
  61. beamlit/models/environment_metadata.py +146 -0
  62. beamlit/models/environment_spec.py +8 -6
  63. beamlit/models/function.py +34 -95
  64. beamlit/models/function_metadata.py +5 -3
  65. beamlit/models/function_spec.py +53 -40
  66. beamlit/models/integration_connection.py +31 -137
  67. beamlit/models/integration_connection_spec.py +6 -4
  68. beamlit/models/metadata.py +5 -3
  69. beamlit/models/metadata_labels.py +4 -2
  70. beamlit/models/model.py +33 -94
  71. beamlit/models/model_metadata.py +5 -3
  72. beamlit/models/{function_provider_ref.py → model_private_cluster.py} +23 -14
  73. beamlit/models/model_provider.py +27 -43
  74. beamlit/models/model_spec.py +45 -32
  75. beamlit/models/owner_fields.py +4 -2
  76. beamlit/models/pending_invitation.py +14 -14
  77. beamlit/models/pod_template_spec.py +4 -2
  78. beamlit/models/policy.py +33 -159
  79. beamlit/models/policy_spec.py +24 -28
  80. beamlit/models/private_cluster.py +183 -0
  81. beamlit/models/{model_provider_ref.py → private_location.py} +7 -16
  82. beamlit/models/resource_deployment_metrics.py +0 -108
  83. beamlit/models/resource_environment_metrics.py +143 -71
  84. beamlit/models/{resource_deployment_metrics_inference_per_region.py → resource_environment_metrics_inference_per_region.py} +5 -5
  85. beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +9 -11
  86. beamlit/models/{resource_deployment_metrics_query_per_region_per_code.py → resource_environment_metrics_query_per_region_per_code.py} +5 -5
  87. beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +5 -3
  88. beamlit/models/resource_log.py +4 -2
  89. beamlit/models/runtime.py +20 -2
  90. beamlit/models/serverless_config.py +28 -21
  91. beamlit/models/spec_configuration.py +7 -5
  92. beamlit/models/store_agent.py +14 -14
  93. beamlit/models/store_function.py +14 -14
  94. beamlit/models/time_fields.py +4 -2
  95. beamlit/models/websocket_channel.py +4 -2
  96. beamlit/models/workspace.py +23 -14
  97. beamlit/run.py +0 -1
  98. beamlit/serve/app.py +1 -0
  99. beamlit/serve/middlewares/accesslog.py +3 -1
  100. {beamlit-0.0.24rc20.dist-info → beamlit-0.0.24rc21.dist-info}/METADATA +1 -1
  101. beamlit-0.0.24rc21.dist-info/RECORD +243 -0
  102. beamlit/api/agents/delete_agent_deployment.py +0 -163
  103. beamlit/api/agents/delete_agent_deployment_history.py +0 -172
  104. beamlit/api/agents/get_agent_deployment_history.py +0 -172
  105. beamlit/api/agents/get_agent_deployment_logs.py +0 -164
  106. beamlit/api/agents/list_agent_deployment_history.py +0 -164
  107. beamlit/api/agents/put_agent_deployment.py +0 -185
  108. beamlit/api/agents/put_agent_deployment_history.py +0 -198
  109. beamlit/api/functions/delete_function_deployment.py +0 -163
  110. beamlit/api/functions/get_function_deployment.py +0 -163
  111. beamlit/api/functions/get_function_deployment_logs.py +0 -164
  112. beamlit/api/functions/get_function_deployment_metrics.py +0 -159
  113. beamlit/api/functions/put_function_deployment.py +0 -185
  114. beamlit/api/models/delete_model_deployment.py +0 -171
  115. beamlit/api/models/get_model_deployment.py +0 -171
  116. beamlit/api/models/get_model_deployment_logs.py +0 -168
  117. beamlit/api/models/get_model_deployment_metrics.py +0 -163
  118. beamlit/api/models/put_model_deployment.py +0 -193
  119. beamlit/models/agent_configuration.py +0 -70
  120. beamlit/models/agent_deployment.py +0 -340
  121. beamlit/models/agent_deployment_configuration.py +0 -45
  122. beamlit/models/agent_deployment_configuration_type_0.py +0 -43
  123. beamlit/models/agent_deployment_history.py +0 -185
  124. beamlit/models/agent_deployment_history_event.py +0 -133
  125. beamlit/models/agent_deployment_pod_template.py +0 -45
  126. beamlit/models/agent_deployment_pod_template_type_0.py +0 -43
  127. beamlit/models/agent_with_deployments.py +0 -176
  128. beamlit/models/authentication_provider_model.py +0 -144
  129. beamlit/models/authentication_provider_organization.py +0 -88
  130. beamlit/models/deployment_configuration.py +0 -70
  131. beamlit/models/deployment_configurations.py +0 -58
  132. beamlit/models/deployment_serverless_config.py +0 -131
  133. beamlit/models/deployment_serverless_config_type_0.py +0 -220
  134. beamlit/models/function_configuration.py +0 -70
  135. beamlit/models/function_deployment.py +0 -340
  136. beamlit/models/function_deployment_configuration.py +0 -45
  137. beamlit/models/function_deployment_configuration_type_0.py +0 -43
  138. beamlit/models/function_deployment_pod_template.py +0 -45
  139. beamlit/models/function_deployment_pod_template_type_0.py +0 -43
  140. beamlit/models/function_with_deployments.py +0 -176
  141. beamlit/models/integration.py +0 -198
  142. beamlit/models/integration_config.py +0 -45
  143. beamlit/models/integration_secret.py +0 -61
  144. beamlit/models/labels_type_0.py +0 -45
  145. beamlit/models/location.py +0 -122
  146. beamlit/models/model_deployment.py +0 -296
  147. beamlit/models/model_deployment_log.py +0 -70
  148. beamlit/models/model_deployment_metrics.py +0 -172
  149. beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +0 -77
  150. beamlit/models/model_deployment_pod_template.py +0 -45
  151. beamlit/models/model_deployment_pod_template_type_0.py +0 -43
  152. beamlit/models/model_metrics.py +0 -96
  153. beamlit/models/model_with_deployments.py +0 -176
  154. beamlit/models/resource_deployment_log.py +0 -70
  155. beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +0 -79
  156. beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +0 -79
  157. beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +0 -73
  158. beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py +0 -73
  159. beamlit/models/runtime_readiness_probe_type_0.py +0 -43
  160. beamlit/models/runtime_type_0.py +0 -111
  161. beamlit/models/runtime_type_0_readiness_probe.py +0 -43
  162. beamlit/models/runtime_type_0_readiness_probe_type_0.py +0 -43
  163. beamlit/models/runtime_type_0_resources.py +0 -59
  164. beamlit/models/standard_fields_dynamo_db.py +0 -88
  165. beamlit/models/store_agent_configuration.py +0 -97
  166. beamlit/models/store_agent_labels_type_0.py +0 -43
  167. beamlit/models/store_function_configuration.py +0 -97
  168. beamlit/models/store_function_labels_type_0.py +0 -43
  169. beamlit-0.0.24rc20.dist-info/RECORD +0 -303
  170. {beamlit-0.0.24rc20.dist-info → beamlit-0.0.24rc21.dist-info}/WHEEL +0 -0
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -6,11 +6,12 @@ from attrs import field as _attrs_field
6
6
  from ..types import UNSET, Unset
7
7
 
8
8
  if TYPE_CHECKING:
9
+ from ..models.core_spec_configurations import CoreSpecConfigurations
9
10
  from ..models.flavor import Flavor
11
+ from ..models.model_private_cluster import ModelPrivateCluster
10
12
  from ..models.pod_template_spec import PodTemplateSpec
11
13
  from ..models.runtime import Runtime
12
14
  from ..models.serverless_config import ServerlessConfig
13
- from ..models.spec_configuration import SpecConfiguration
14
15
 
15
16
 
16
17
  T = TypeVar("T", bound="CoreSpec")
@@ -21,60 +22,63 @@ class CoreSpec:
21
22
  """Core specification
22
23
 
23
24
  Attributes:
24
- configurations (Union[Unset, SpecConfiguration]): Agent configuration, this is a key value storage. In your
25
- agent you can retrieve the value with config[key]
25
+ configurations (Union[Unset, CoreSpecConfigurations]): Optional configurations for the object
26
26
  enabled (Union[Unset, bool]): Enable or disable the agent
27
- flavors (Union[Unset, List['Flavor']]): Types of hardware available for deployments
28
- integration_connections (Union[Unset, List[str]]):
27
+ flavors (Union[Unset, list['Flavor']]): Types of hardware available for deployments
28
+ integration_connections (Union[Unset, list[str]]):
29
29
  pod_template (Union[Unset, PodTemplateSpec]): Pod template specification
30
- policies (Union[Unset, List[str]]):
30
+ policies (Union[Unset, list[str]]):
31
+ private_clusters (Union[Unset, ModelPrivateCluster]): Private cluster where the model deployment is deployed
31
32
  runtime (Union[Unset, Runtime]): Set of configurations for a deployment
32
33
  serverless_config (Union[Unset, ServerlessConfig]): Configuration for a serverless deployment
33
34
  """
34
35
 
35
- configurations: Union[Unset, "SpecConfiguration"] = UNSET
36
+ configurations: Union[Unset, "CoreSpecConfigurations"] = UNSET
36
37
  enabled: Union[Unset, bool] = UNSET
37
- flavors: Union[Unset, List["Flavor"]] = UNSET
38
- integration_connections: Union[Unset, List[str]] = UNSET
38
+ flavors: Union[Unset, list["Flavor"]] = UNSET
39
+ integration_connections: Union[Unset, list[str]] = UNSET
39
40
  pod_template: Union[Unset, "PodTemplateSpec"] = UNSET
40
- policies: Union[Unset, List[str]] = UNSET
41
+ policies: Union[Unset, list[str]] = UNSET
42
+ private_clusters: Union[Unset, "ModelPrivateCluster"] = UNSET
41
43
  runtime: Union[Unset, "Runtime"] = UNSET
42
44
  serverless_config: Union[Unset, "ServerlessConfig"] = UNSET
43
45
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
44
46
 
45
47
  def to_dict(self) -> dict[str, Any]:
46
- configurations: Union[Unset, Dict[str, Any]] = UNSET
48
+ configurations: Union[Unset, dict[str, Any]] = UNSET
47
49
  if not isinstance(self.configurations, Unset):
48
50
  configurations = self.configurations.to_dict()
49
51
 
50
52
  enabled = self.enabled
51
53
 
52
- flavors: Union[Unset, List[Dict[str, Any]]] = UNSET
54
+ flavors: Union[Unset, list[dict[str, Any]]] = UNSET
53
55
  if not isinstance(self.flavors, Unset):
54
56
  flavors = []
55
57
  for componentsschemas_flavors_item_data in self.flavors:
56
- componentsschemas_flavors_item = (
57
- componentsschemas_flavors_item_data.to_dict()
58
- )
58
+ componentsschemas_flavors_item = componentsschemas_flavors_item_data.to_dict()
59
59
  flavors.append(componentsschemas_flavors_item)
60
60
 
61
- integration_connections: Union[Unset, List[str]] = UNSET
61
+ integration_connections: Union[Unset, list[str]] = UNSET
62
62
  if not isinstance(self.integration_connections, Unset):
63
63
  integration_connections = self.integration_connections
64
64
 
65
- pod_template: Union[Unset, Dict[str, Any]] = UNSET
65
+ pod_template: Union[Unset, dict[str, Any]] = UNSET
66
66
  if not isinstance(self.pod_template, Unset):
67
67
  pod_template = self.pod_template.to_dict()
68
68
 
69
- policies: Union[Unset, List[str]] = UNSET
69
+ policies: Union[Unset, list[str]] = UNSET
70
70
  if not isinstance(self.policies, Unset):
71
71
  policies = self.policies
72
72
 
73
- runtime: Union[Unset, Dict[str, Any]] = UNSET
73
+ private_clusters: Union[Unset, dict[str, Any]] = UNSET
74
+ if not isinstance(self.private_clusters, Unset):
75
+ private_clusters = self.private_clusters.to_dict()
76
+
77
+ runtime: Union[Unset, dict[str, Any]] = UNSET
74
78
  if not isinstance(self.runtime, Unset):
75
79
  runtime = self.runtime.to_dict()
76
80
 
77
- serverless_config: Union[Unset, Dict[str, Any]] = UNSET
81
+ serverless_config: Union[Unset, dict[str, Any]] = UNSET
78
82
  if not isinstance(self.serverless_config, Unset):
79
83
  serverless_config = self.serverless_config.to_dict()
80
84
 
@@ -93,6 +97,8 @@ class CoreSpec:
93
97
  field_dict["podTemplate"] = pod_template
94
98
  if policies is not UNSET:
95
99
  field_dict["policies"] = policies
100
+ if private_clusters is not UNSET:
101
+ field_dict["privateClusters"] = private_clusters
96
102
  if runtime is not UNSET:
97
103
  field_dict["runtime"] = runtime
98
104
  if serverless_config is not UNSET:
@@ -101,35 +107,34 @@ class CoreSpec:
101
107
  return field_dict
102
108
 
103
109
  @classmethod
104
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
110
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
111
+ from ..models.core_spec_configurations import CoreSpecConfigurations
105
112
  from ..models.flavor import Flavor
113
+ from ..models.model_private_cluster import ModelPrivateCluster
106
114
  from ..models.pod_template_spec import PodTemplateSpec
107
115
  from ..models.runtime import Runtime
108
116
  from ..models.serverless_config import ServerlessConfig
109
- from ..models.spec_configuration import SpecConfiguration
110
117
 
118
+ if not src_dict:
119
+ return None
111
120
  d = src_dict.copy()
112
121
  _configurations = d.pop("configurations", UNSET)
113
- configurations: Union[Unset, SpecConfiguration]
122
+ configurations: Union[Unset, CoreSpecConfigurations]
114
123
  if isinstance(_configurations, Unset):
115
124
  configurations = UNSET
116
125
  else:
117
- configurations = SpecConfiguration.from_dict(_configurations)
126
+ configurations = CoreSpecConfigurations.from_dict(_configurations)
118
127
 
119
128
  enabled = d.pop("enabled", UNSET)
120
129
 
121
130
  flavors = []
122
131
  _flavors = d.pop("flavors", UNSET)
123
132
  for componentsschemas_flavors_item_data in _flavors or []:
124
- componentsschemas_flavors_item = Flavor.from_dict(
125
- componentsschemas_flavors_item_data
126
- )
133
+ componentsschemas_flavors_item = Flavor.from_dict(componentsschemas_flavors_item_data)
127
134
 
128
135
  flavors.append(componentsschemas_flavors_item)
129
136
 
130
- integration_connections = cast(
131
- List[str], d.pop("integrationConnections", UNSET)
132
- )
137
+ integration_connections = cast(list[str], d.pop("integrationConnections", UNSET))
133
138
 
134
139
  _pod_template = d.pop("podTemplate", UNSET)
135
140
  pod_template: Union[Unset, PodTemplateSpec]
@@ -138,7 +143,14 @@ class CoreSpec:
138
143
  else:
139
144
  pod_template = PodTemplateSpec.from_dict(_pod_template)
140
145
 
141
- policies = cast(List[str], d.pop("policies", UNSET))
146
+ policies = cast(list[str], d.pop("policies", UNSET))
147
+
148
+ _private_clusters = d.pop("privateClusters", UNSET)
149
+ private_clusters: Union[Unset, ModelPrivateCluster]
150
+ if isinstance(_private_clusters, Unset):
151
+ private_clusters = UNSET
152
+ else:
153
+ private_clusters = ModelPrivateCluster.from_dict(_private_clusters)
142
154
 
143
155
  _runtime = d.pop("runtime", UNSET)
144
156
  runtime: Union[Unset, Runtime]
@@ -161,6 +173,7 @@ class CoreSpec:
161
173
  integration_connections=integration_connections,
162
174
  pod_template=pod_template,
163
175
  policies=policies,
176
+ private_clusters=private_clusters,
164
177
  runtime=runtime,
165
178
  serverless_config=serverless_config,
166
179
  )
@@ -6,57 +6,57 @@ from attrs import field as _attrs_field
6
6
  from ..types import UNSET, Unset
7
7
 
8
8
  if TYPE_CHECKING:
9
- from ..models.qps import QPS
9
+ from ..models.spec_configuration import SpecConfiguration
10
10
 
11
11
 
12
- T = TypeVar("T", bound="ModelDeploymentMetricsQueryPerSecondPerRegionPerCode")
12
+ T = TypeVar("T", bound="CoreSpecConfigurations")
13
13
 
14
14
 
15
15
  @_attrs_define
16
- class ModelDeploymentMetricsQueryPerSecondPerRegionPerCode:
17
- """RPS value (in last 24 hours) per response status code per location, for the model deployment
16
+ class CoreSpecConfigurations:
17
+ """Optional configurations for the object
18
18
 
19
19
  Attributes:
20
- region (Union[Unset, QPS]): Query per second per element, can be per response status code (e.g. 200, 400) or per
21
- location
20
+ key (Union[Unset, SpecConfiguration]): Configuration, this is a key value storage. In your object you can
21
+ retrieve the value with config[key]
22
22
  """
23
23
 
24
- region: Union[Unset, "QPS"] = UNSET
24
+ key: Union[Unset, "SpecConfiguration"] = UNSET
25
25
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
26
26
 
27
27
  def to_dict(self) -> dict[str, Any]:
28
- region: Union[Unset, dict[str, Any]] = UNSET
29
- if not isinstance(self.region, Unset):
30
- region = self.region.to_dict()
28
+ key: Union[Unset, dict[str, Any]] = UNSET
29
+ if not isinstance(self.key, Unset):
30
+ key = self.key.to_dict()
31
31
 
32
32
  field_dict: dict[str, Any] = {}
33
33
  field_dict.update(self.additional_properties)
34
34
  field_dict.update({})
35
- if region is not UNSET:
36
- field_dict["region"] = region
35
+ if key is not UNSET:
36
+ field_dict["key"] = key
37
37
 
38
38
  return field_dict
39
39
 
40
40
  @classmethod
41
41
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
42
- from ..models.qps import QPS
42
+ from ..models.spec_configuration import SpecConfiguration
43
43
 
44
44
  if not src_dict:
45
45
  return None
46
46
  d = src_dict.copy()
47
- _region = d.pop("region", UNSET)
48
- region: Union[Unset, QPS]
49
- if isinstance(_region, Unset):
50
- region = UNSET
47
+ _key = d.pop("key", UNSET)
48
+ key: Union[Unset, SpecConfiguration]
49
+ if isinstance(_key, Unset):
50
+ key = UNSET
51
51
  else:
52
- region = QPS.from_dict(_region)
52
+ key = SpecConfiguration.from_dict(_key)
53
53
 
54
- model_deployment_metrics_query_per_second_per_region_per_code = cls(
55
- region=region,
54
+ core_spec_configurations = cls(
55
+ key=key,
56
56
  )
57
57
 
58
- model_deployment_metrics_query_per_second_per_region_per_code.additional_properties = d
59
- return model_deployment_metrics_query_per_second_per_region_per_code
58
+ core_spec_configurations.additional_properties = d
59
+ return core_spec_configurations
60
60
 
61
61
  @property
62
62
  def additional_keys(self) -> list[str]:
@@ -1,4 +1,4 @@
1
- from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
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
@@ -6,7 +6,8 @@ from attrs import field as _attrs_field
6
6
  from ..types import UNSET, Unset
7
7
 
8
8
  if TYPE_CHECKING:
9
- from ..models.labels_type_0 import LabelsType0
9
+ from ..models.environment_spec import EnvironmentSpec
10
+ from ..models.metadata import Metadata
10
11
 
11
12
 
12
13
  T = TypeVar("T", bound="Environment")
@@ -17,131 +18,58 @@ class Environment:
17
18
  """Environment on which deployments will be made (e.g. development, production), enforcing multiple policies at once.
18
19
 
19
20
  Attributes:
20
- created_at (Union[Unset, str]): The date and time when the resource was created
21
- created_by (Union[Unset, str]): The user or service account who created the resource
22
- updated_at (Union[Unset, str]): The date and time when the resource was updated
23
- updated_by (Union[Unset, str]): The user or service account who updated the resource
24
- display_name (Union[Unset, str]): The display name of the environment
25
- labels (Union['LabelsType0', None, Unset]): Labels
26
- name (Union[Unset, str]): The name of the environment
27
- policies (Union[Unset, list[Any]]): The policies attached to the environment
28
- workspace (Union[Unset, str]): The workspace the environment belongs to
21
+ metadata (Union[Unset, Metadata]): Metadata
22
+ spec (Union[Unset, EnvironmentSpec]): Environment specification
29
23
  """
30
24
 
31
- created_at: Union[Unset, str] = UNSET
32
- created_by: Union[Unset, str] = UNSET
33
- updated_at: Union[Unset, str] = UNSET
34
- updated_by: Union[Unset, str] = UNSET
35
- display_name: Union[Unset, str] = UNSET
36
- labels: Union["LabelsType0", None, Unset] = UNSET
37
- name: Union[Unset, str] = UNSET
38
- policies: Union[Unset, list[Any]] = UNSET
39
- workspace: Union[Unset, str] = UNSET
25
+ metadata: Union[Unset, "Metadata"] = UNSET
26
+ spec: Union[Unset, "EnvironmentSpec"] = UNSET
40
27
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
41
28
 
42
29
  def to_dict(self) -> dict[str, Any]:
43
- from ..models.labels_type_0 import LabelsType0
30
+ metadata: Union[Unset, dict[str, Any]] = UNSET
31
+ if not isinstance(self.metadata, Unset):
32
+ metadata = self.metadata.to_dict()
44
33
 
45
- created_at = self.created_at
46
-
47
- created_by = self.created_by
48
-
49
- updated_at = self.updated_at
50
-
51
- updated_by = self.updated_by
52
-
53
- display_name = self.display_name
54
-
55
- labels: Union[None, Unset, dict[str, Any]]
56
- if isinstance(self.labels, Unset):
57
- labels = UNSET
58
- elif isinstance(self.labels, LabelsType0):
59
- labels = self.labels.to_dict()
60
- else:
61
- labels = self.labels
62
-
63
- name = self.name
64
-
65
- policies: Union[Unset, list[Any]] = UNSET
66
- if not isinstance(self.policies, Unset):
67
- policies = self.policies
68
-
69
- workspace = self.workspace
34
+ spec: Union[Unset, dict[str, Any]] = UNSET
35
+ if not isinstance(self.spec, Unset):
36
+ spec = self.spec.to_dict()
70
37
 
71
38
  field_dict: dict[str, Any] = {}
72
39
  field_dict.update(self.additional_properties)
73
40
  field_dict.update({})
74
- if created_at is not UNSET:
75
- field_dict["created_at"] = created_at
76
- if created_by is not UNSET:
77
- field_dict["created_by"] = created_by
78
- if updated_at is not UNSET:
79
- field_dict["updated_at"] = updated_at
80
- if updated_by is not UNSET:
81
- field_dict["updated_by"] = updated_by
82
- if display_name is not UNSET:
83
- field_dict["display_name"] = display_name
84
- if labels is not UNSET:
85
- field_dict["labels"] = labels
86
- if name is not UNSET:
87
- field_dict["name"] = name
88
- if policies is not UNSET:
89
- field_dict["policies"] = policies
90
- if workspace is not UNSET:
91
- field_dict["workspace"] = workspace
41
+ if metadata is not UNSET:
42
+ field_dict["metadata"] = metadata
43
+ if spec is not UNSET:
44
+ field_dict["spec"] = spec
92
45
 
93
46
  return field_dict
94
47
 
95
48
  @classmethod
96
49
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
97
- from ..models.labels_type_0 import LabelsType0
50
+ from ..models.environment_spec import EnvironmentSpec
51
+ from ..models.metadata import Metadata
98
52
 
99
53
  if not src_dict:
100
54
  return None
101
55
  d = src_dict.copy()
102
- created_at = d.pop("created_at", UNSET)
103
-
104
- created_by = d.pop("created_by", UNSET)
105
-
106
- updated_at = d.pop("updated_at", UNSET)
107
-
108
- updated_by = d.pop("updated_by", UNSET)
109
-
110
- display_name = d.pop("display_name", UNSET)
111
-
112
- def _parse_labels(data: object) -> Union["LabelsType0", None, Unset]:
113
- if data is None:
114
- return data
115
- if isinstance(data, Unset):
116
- return data
117
- try:
118
- if not isinstance(data, dict):
119
- raise TypeError()
120
- componentsschemas_labels_type_0 = LabelsType0.from_dict(data)
121
-
122
- return componentsschemas_labels_type_0
123
- except: # noqa: E722
124
- pass
125
- return cast(Union["LabelsType0", None, Unset], data)
126
-
127
- labels = _parse_labels(d.pop("labels", UNSET))
128
-
129
- name = d.pop("name", UNSET)
130
-
131
- policies = cast(list[Any], d.pop("policies", UNSET))
56
+ _metadata = d.pop("metadata", UNSET)
57
+ metadata: Union[Unset, Metadata]
58
+ if isinstance(_metadata, Unset):
59
+ metadata = UNSET
60
+ else:
61
+ metadata = Metadata.from_dict(_metadata)
132
62
 
133
- workspace = d.pop("workspace", UNSET)
63
+ _spec = d.pop("spec", UNSET)
64
+ spec: Union[Unset, EnvironmentSpec]
65
+ if isinstance(_spec, Unset):
66
+ spec = UNSET
67
+ else:
68
+ spec = EnvironmentSpec.from_dict(_spec)
134
69
 
135
70
  environment = cls(
136
- created_at=created_at,
137
- created_by=created_by,
138
- updated_at=updated_at,
139
- updated_by=updated_by,
140
- display_name=display_name,
141
- labels=labels,
142
- name=name,
143
- policies=policies,
144
- workspace=workspace,
71
+ metadata=metadata,
72
+ spec=spec,
145
73
  )
146
74
 
147
75
  environment.additional_properties = d
@@ -0,0 +1,146 @@
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.metadata_labels import MetadataLabels
10
+
11
+
12
+ T = TypeVar("T", bound="EnvironmentMetadata")
13
+
14
+
15
+ @_attrs_define
16
+ class EnvironmentMetadata:
17
+ """Environment metadata
18
+
19
+ Attributes:
20
+ created_at (Union[Unset, str]): The date and time when the resource was created
21
+ updated_at (Union[Unset, str]): The date and time when the resource was updated
22
+ created_by (Union[Unset, str]): The user or service account who created the resource
23
+ updated_by (Union[Unset, str]): The user or service account who updated the resource
24
+ display_name (Union[Unset, str]): Model display name
25
+ labels (Union[Unset, MetadataLabels]): Labels
26
+ name (Union[Unset, str]): Model name
27
+ workspace (Union[Unset, str]): Workspace name
28
+ environment (Union[Unset, str]): Environment name
29
+ """
30
+
31
+ created_at: Union[Unset, str] = UNSET
32
+ updated_at: Union[Unset, str] = UNSET
33
+ created_by: Union[Unset, str] = UNSET
34
+ updated_by: Union[Unset, str] = UNSET
35
+ display_name: Union[Unset, str] = UNSET
36
+ labels: Union[Unset, "MetadataLabels"] = UNSET
37
+ name: Union[Unset, str] = UNSET
38
+ workspace: Union[Unset, str] = UNSET
39
+ environment: Union[Unset, str] = UNSET
40
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
41
+
42
+ def to_dict(self) -> dict[str, Any]:
43
+ created_at = self.created_at
44
+
45
+ updated_at = self.updated_at
46
+
47
+ created_by = self.created_by
48
+
49
+ updated_by = self.updated_by
50
+
51
+ display_name = self.display_name
52
+
53
+ labels: Union[Unset, dict[str, Any]] = UNSET
54
+ if not isinstance(self.labels, Unset):
55
+ labels = self.labels.to_dict()
56
+
57
+ name = self.name
58
+
59
+ workspace = self.workspace
60
+
61
+ environment = self.environment
62
+
63
+ field_dict: dict[str, Any] = {}
64
+ field_dict.update(self.additional_properties)
65
+ field_dict.update({})
66
+ if created_at is not UNSET:
67
+ field_dict["createdAt"] = created_at
68
+ if updated_at is not UNSET:
69
+ field_dict["updatedAt"] = updated_at
70
+ if created_by is not UNSET:
71
+ field_dict["createdBy"] = created_by
72
+ if updated_by is not UNSET:
73
+ field_dict["updatedBy"] = updated_by
74
+ if display_name is not UNSET:
75
+ field_dict["displayName"] = display_name
76
+ if labels is not UNSET:
77
+ field_dict["labels"] = labels
78
+ if name is not UNSET:
79
+ field_dict["name"] = name
80
+ if workspace is not UNSET:
81
+ field_dict["workspace"] = workspace
82
+ if environment is not UNSET:
83
+ field_dict["environment"] = environment
84
+
85
+ return field_dict
86
+
87
+ @classmethod
88
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
89
+ from ..models.metadata_labels import MetadataLabels
90
+
91
+ if not src_dict:
92
+ return None
93
+ d = src_dict.copy()
94
+ created_at = d.pop("createdAt", UNSET)
95
+
96
+ updated_at = d.pop("updatedAt", UNSET)
97
+
98
+ created_by = d.pop("createdBy", UNSET)
99
+
100
+ updated_by = d.pop("updatedBy", UNSET)
101
+
102
+ display_name = d.pop("displayName", UNSET)
103
+
104
+ _labels = d.pop("labels", UNSET)
105
+ labels: Union[Unset, MetadataLabels]
106
+ if isinstance(_labels, Unset):
107
+ labels = UNSET
108
+ else:
109
+ labels = MetadataLabels.from_dict(_labels)
110
+
111
+ name = d.pop("name", UNSET)
112
+
113
+ workspace = d.pop("workspace", UNSET)
114
+
115
+ environment = d.pop("environment", UNSET)
116
+
117
+ environment_metadata = cls(
118
+ created_at=created_at,
119
+ updated_at=updated_at,
120
+ created_by=created_by,
121
+ updated_by=updated_by,
122
+ display_name=display_name,
123
+ labels=labels,
124
+ name=name,
125
+ workspace=workspace,
126
+ environment=environment,
127
+ )
128
+
129
+ environment_metadata.additional_properties = d
130
+ return environment_metadata
131
+
132
+ @property
133
+ def additional_keys(self) -> list[str]:
134
+ return list(self.additional_properties.keys())
135
+
136
+ def __getitem__(self, key: str) -> Any:
137
+ return self.additional_properties[key]
138
+
139
+ def __setitem__(self, key: str, value: Any) -> None:
140
+ self.additional_properties[key] = value
141
+
142
+ def __delitem__(self, key: str) -> None:
143
+ del self.additional_properties[key]
144
+
145
+ def __contains__(self, key: str) -> bool:
146
+ return key in self.additional_properties
@@ -1,4 +1,4 @@
1
- from typing import Any, List, Type, TypeVar, Union, cast
1
+ from typing import Any, TypeVar, Union, cast
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
@@ -13,14 +13,14 @@ class EnvironmentSpec:
13
13
  """Environment specification
14
14
 
15
15
  Attributes:
16
- policies (Union[Unset, List[str]]):
16
+ policies (Union[Unset, list[str]]):
17
17
  """
18
18
 
19
- policies: Union[Unset, List[str]] = UNSET
19
+ policies: Union[Unset, list[str]] = UNSET
20
20
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
21
 
22
22
  def to_dict(self) -> dict[str, Any]:
23
- policies: Union[Unset, List[str]] = UNSET
23
+ policies: Union[Unset, list[str]] = UNSET
24
24
  if not isinstance(self.policies, Unset):
25
25
  policies = self.policies
26
26
 
@@ -33,9 +33,11 @@ class EnvironmentSpec:
33
33
  return field_dict
34
34
 
35
35
  @classmethod
36
- def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
36
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
37
+ if not src_dict:
38
+ return None
37
39
  d = src_dict.copy()
38
- policies = cast(List[str], d.pop("policies", UNSET))
40
+ policies = cast(list[str], d.pop("policies", UNSET))
39
41
 
40
42
  environment_spec = cls(
41
43
  policies=policies,