platform-api-python-client 4.37.1__py3-none-any.whl → 4.41.0__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 (191) hide show
  1. platform_api_python_client/__init__.py +410 -177
  2. platform_api_python_client/api/external_api.py +41 -47
  3. platform_api_python_client/api_client.py +81 -36
  4. platform_api_python_client/configuration.py +262 -66
  5. platform_api_python_client/exceptions.py +24 -5
  6. platform_api_python_client/models/__init__.py +52 -26
  7. platform_api_python_client/models/admission.py +106 -0
  8. platform_api_python_client/models/autoscaling.py +120 -0
  9. platform_api_python_client/models/ccl_dynamo_pools.py +4 -3
  10. platform_api_python_client/models/ccl_main_pools.py +4 -3
  11. platform_api_python_client/models/ccluster_catalogs_cluster_base_argo_rollouts_chart_values.py +121 -0
  12. platform_api_python_client/models/ccluster_catalogs_cluster_base_argo_rollouts_controller.py +106 -0
  13. platform_api_python_client/models/ccluster_catalogs_cluster_base_argo_rollouts_values.py +110 -0
  14. platform_api_python_client/models/ccluster_catalogs_cluster_base_cert_manager_chart_values.py +117 -0
  15. platform_api_python_client/models/ccluster_catalogs_cluster_base_cert_manager_values.py +110 -0
  16. platform_api_python_client/models/ccluster_catalogs_cluster_base_gpu_operator_chart_values.py +152 -0
  17. platform_api_python_client/models/ccluster_catalogs_cluster_base_gpu_operator_values.py +121 -0
  18. platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_chart_values.py +110 -0
  19. platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_controller.py +121 -0
  20. platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_values.py +110 -0
  21. platform_api_python_client/models/ccluster_catalogs_cluster_base_istio_values.py +143 -0
  22. platform_api_python_client/models/ccluster_catalogs_cluster_base_kai_scheduler_chart_values.py +154 -0
  23. platform_api_python_client/models/ccluster_catalogs_cluster_base_kai_scheduler_values.py +121 -0
  24. platform_api_python_client/models/ccluster_catalogs_cluster_base_keda_chart_values.py +131 -0
  25. platform_api_python_client/models/ccluster_catalogs_cluster_base_keda_values.py +110 -0
  26. platform_api_python_client/models/ccluster_catalogs_cluster_base_kube_prometheus_stack_chart_values.py +121 -0
  27. platform_api_python_client/models/ccluster_catalogs_cluster_base_kube_prometheus_stack_values.py +121 -0
  28. platform_api_python_client/models/ccluster_catalogs_cluster_base_metrics_server_chart_values.py +106 -0
  29. platform_api_python_client/models/ccluster_catalogs_cluster_base_metrics_server_values.py +110 -0
  30. platform_api_python_client/models/{spire_crds.py → cdi.py} +36 -12
  31. platform_api_python_client/models/cluster_base_components.py +187 -0
  32. platform_api_python_client/models/cluster_capacity_response.py +5 -5
  33. platform_api_python_client/models/cluster_credential.py +4 -3
  34. platform_api_python_client/models/cluster_registration_request.py +4 -3
  35. platform_api_python_client/models/cluster_registration_response.py +4 -3
  36. platform_api_python_client/models/{istio_cni_overrides.py → cni.py} +29 -15
  37. platform_api_python_client/models/config_file_mount.py +6 -5
  38. platform_api_python_client/models/create_compute_deployment_request.py +10 -10
  39. platform_api_python_client/models/create_compute_deployment_response.py +4 -3
  40. platform_api_python_client/models/create_dynamo_deployment_request.py +29 -23
  41. platform_api_python_client/models/create_dynamo_deployment_response.py +4 -3
  42. platform_api_python_client/models/create_filesystem_volume_request.py +8 -7
  43. platform_api_python_client/models/create_hardware_instance_request.py +4 -3
  44. platform_api_python_client/models/create_inference_deployment_response.py +4 -3
  45. platform_api_python_client/models/create_inference_v3_deployment_request.py +14 -12
  46. platform_api_python_client/models/create_job_deployment_request.py +10 -10
  47. platform_api_python_client/models/create_job_deployment_response.py +4 -3
  48. platform_api_python_client/models/create_object_volume_request.py +10 -9
  49. platform_api_python_client/models/create_organization_request.py +4 -3
  50. platform_api_python_client/models/create_organization_response.py +4 -3
  51. platform_api_python_client/models/create_service_account_request.py +4 -3
  52. platform_api_python_client/models/create_service_account_response.py +4 -3
  53. platform_api_python_client/models/credits_response.py +4 -3
  54. platform_api_python_client/models/daily_bill_response.py +4 -3
  55. platform_api_python_client/models/{fluent_bit.py → dashboard.py} +29 -12
  56. platform_api_python_client/models/{prometheus_adapter.py → default_priorities.py} +29 -12
  57. platform_api_python_client/models/default_queue.py +106 -0
  58. platform_api_python_client/models/delete_user_vault_item_request.py +4 -3
  59. platform_api_python_client/models/deployment_log_event_v4.py +4 -3
  60. platform_api_python_client/models/deployment_status_request.py +4 -3
  61. platform_api_python_client/models/deployment_status_response.py +4 -3
  62. platform_api_python_client/models/deployment_status_v3_response.py +5 -5
  63. platform_api_python_client/models/deployment_usage.py +5 -5
  64. platform_api_python_client/models/deployment_usage_value.py +4 -3
  65. platform_api_python_client/models/dynamo_communications_input.py +4 -3
  66. platform_api_python_client/models/dynamo_frontend_config.py +105 -0
  67. platform_api_python_client/models/dynamo_frontend_config_response.py +105 -0
  68. platform_api_python_client/models/dynamo_image.py +6 -5
  69. platform_api_python_client/models/dynamo_kv_transfer_configuration.py +4 -3
  70. platform_api_python_client/models/dynamo_weight_transfer_configuration.py +4 -3
  71. platform_api_python_client/models/dynamo_worker_pool_config.py +5 -4
  72. platform_api_python_client/models/dynamo_worker_pools.py +4 -3
  73. platform_api_python_client/models/env.py +4 -3
  74. platform_api_python_client/models/generate_service_account_secret_response.py +4 -3
  75. platform_api_python_client/models/get_cluster_response.py +4 -3
  76. platform_api_python_client/models/get_compute_deployment_response.py +8 -8
  77. platform_api_python_client/models/get_deployment_log_response.py +4 -3
  78. platform_api_python_client/models/get_deployment_log_v4_response.py +5 -5
  79. platform_api_python_client/models/get_deployment_pods_response.py +4 -3
  80. platform_api_python_client/models/get_deployment_response.py +7 -7
  81. platform_api_python_client/models/get_deployment_revision_response.py +4 -3
  82. platform_api_python_client/models/get_deployment_usage_response.py +5 -5
  83. platform_api_python_client/models/get_dynamo_deployment_response.py +23 -17
  84. platform_api_python_client/models/get_filesystem_volume_response.py +4 -3
  85. platform_api_python_client/models/get_inference_deployment_response.py +7 -7
  86. platform_api_python_client/models/get_inference_v3_deployment_response.py +11 -9
  87. platform_api_python_client/models/get_job_deployment_response.py +8 -8
  88. platform_api_python_client/models/get_object_volume_response.py +4 -3
  89. platform_api_python_client/models/gpu_type_capacity.py +4 -3
  90. platform_api_python_client/models/hardware_instance_response.py +4 -3
  91. platform_api_python_client/models/hardware_preset_response.py +4 -3
  92. platform_api_python_client/models/http_validation_error.py +5 -5
  93. platform_api_python_client/models/image.py +6 -5
  94. platform_api_python_client/models/image_pull_secret_credentials.py +4 -3
  95. platform_api_python_client/models/ingress.py +4 -3
  96. platform_api_python_client/models/insight_list_item_response.py +4 -3
  97. platform_api_python_client/models/insight_resource.py +4 -3
  98. platform_api_python_client/models/insight_response.py +5 -5
  99. platform_api_python_client/models/insight_status_change_response.py +4 -3
  100. platform_api_python_client/models/invite_user_request.py +4 -3
  101. platform_api_python_client/models/istio_base.py +106 -0
  102. platform_api_python_client/models/istio_cni.py +124 -0
  103. platform_api_python_client/models/{argo_rollouts.py → istio_gateway.py} +29 -12
  104. platform_api_python_client/models/{istio_cni_subchart_overrides.py → istiod.py} +31 -17
  105. platform_api_python_client/models/list_cluster_capacity_response.py +5 -5
  106. platform_api_python_client/models/list_daily_bill_response.py +5 -5
  107. platform_api_python_client/models/list_deployment_revisions_response.py +5 -5
  108. platform_api_python_client/models/list_get_cluster_response.py +5 -5
  109. platform_api_python_client/models/list_get_deployment_response.py +5 -5
  110. platform_api_python_client/models/list_hardware_instance_response.py +5 -5
  111. platform_api_python_client/models/list_hardware_preset_response.py +5 -5
  112. platform_api_python_client/models/list_insights_response.py +5 -5
  113. platform_api_python_client/models/list_organization_gpu_quota_response.py +5 -5
  114. platform_api_python_client/models/list_prebuilt_image_response.py +5 -5
  115. platform_api_python_client/models/list_service_accounts_response.py +5 -5
  116. platform_api_python_client/models/list_user_vault_items_response.py +5 -5
  117. platform_api_python_client/models/list_volumes_response.py +5 -5
  118. platform_api_python_client/models/{validation_error_loc_inner.py → location_inner.py} +6 -6
  119. platform_api_python_client/models/metrics.py +117 -0
  120. platform_api_python_client/models/metrics_config.py +6 -5
  121. platform_api_python_client/models/{istio_overrides.py → mig.py} +28 -18
  122. platform_api_python_client/models/operator.py +117 -0
  123. platform_api_python_client/models/organization_gpu_quota_request.py +4 -3
  124. platform_api_python_client/models/organization_gpu_quota_response.py +4 -3
  125. platform_api_python_client/models/pilot.py +106 -0
  126. platform_api_python_client/models/pod_details.py +4 -3
  127. platform_api_python_client/models/pool.py +4 -3
  128. platform_api_python_client/models/prebuilt_image_response.py +4 -3
  129. platform_api_python_client/models/prometheus.py +110 -0
  130. platform_api_python_client/models/prometheus_rules.py +120 -0
  131. platform_api_python_client/models/prometheus_spec.py +113 -0
  132. platform_api_python_client/models/prometheus_values.py +117 -0
  133. platform_api_python_client/models/quota.py +106 -0
  134. platform_api_python_client/models/replicas.py +106 -0
  135. platform_api_python_client/models/resource_list.py +113 -0
  136. platform_api_python_client/models/resource_requirements.py +120 -0
  137. platform_api_python_client/models/revision_pod_details.py +5 -5
  138. platform_api_python_client/models/rollout_strategy_params.py +4 -3
  139. platform_api_python_client/models/scheduler.py +117 -0
  140. platform_api_python_client/models/service_account_response.py +4 -3
  141. platform_api_python_client/models/{istio.py → toggle.py} +27 -19
  142. platform_api_python_client/models/toleration.py +134 -0
  143. platform_api_python_client/models/unified_get_compute_deployment_response.py +8 -8
  144. platform_api_python_client/models/unified_get_deployment_logs_response.py +5 -5
  145. platform_api_python_client/models/unified_get_deployment_pods_response.py +4 -3
  146. platform_api_python_client/models/unified_get_deployment_revision_response.py +4 -3
  147. platform_api_python_client/models/unified_get_deployment_rollout_response.py +4 -3
  148. platform_api_python_client/models/unified_get_deployment_usage_response.py +5 -5
  149. platform_api_python_client/models/unified_get_dynamo_deployment_response.py +13 -13
  150. platform_api_python_client/models/unified_get_inference_v3_deployment_response.py +9 -9
  151. platform_api_python_client/models/unified_get_job_deployment_response.py +8 -8
  152. platform_api_python_client/models/unified_list_deployment_revisions_response.py +5 -5
  153. platform_api_python_client/models/unified_update_deployment_rollout_request.py +4 -3
  154. platform_api_python_client/models/unified_write_compute_deployment_request.py +8 -8
  155. platform_api_python_client/models/unified_write_deployment_response.py +4 -3
  156. platform_api_python_client/models/unified_write_dynamo_deployment_request.py +11 -11
  157. platform_api_python_client/models/unified_write_inference_v3_deployment_request.py +9 -9
  158. platform_api_python_client/models/unified_write_job_deployment_request.py +8 -8
  159. platform_api_python_client/models/update_cluster_metadata_request.py +4 -3
  160. platform_api_python_client/models/{cluster_config.py → update_cluster_request.py} +11 -10
  161. platform_api_python_client/models/update_deployment_response.py +4 -3
  162. platform_api_python_client/models/update_deployment_status_v3_request.py +4 -3
  163. platform_api_python_client/models/update_insight_status_request.py +7 -6
  164. platform_api_python_client/models/update_service_account_request.py +4 -3
  165. platform_api_python_client/models/upsert_user_vault_item_request.py +4 -3
  166. platform_api_python_client/models/user_vault_item.py +4 -3
  167. platform_api_python_client/models/validation_error.py +8 -8
  168. platform_api_python_client/models/volume_mount.py +4 -3
  169. platform_api_python_client/models/volume_status_response.py +4 -3
  170. platform_api_python_client/models/{dynamo_communications_output.py → workload.py} +34 -15
  171. platform_api_python_client/rest.py +87 -10
  172. platform_api_python_client-4.41.0.dist-info/METADATA +418 -0
  173. platform_api_python_client-4.41.0.dist-info/RECORD +206 -0
  174. platform_api_python_client/models/cert_manager.py +0 -89
  175. platform_api_python_client/models/cluster_components.py +0 -193
  176. platform_api_python_client/models/external_dns.py +0 -89
  177. platform_api_python_client/models/final_stack.py +0 -89
  178. platform_api_python_client/models/gpu_operator.py +0 -89
  179. platform_api_python_client/models/ingress_nginx.py +0 -89
  180. platform_api_python_client/models/keda.py +0 -89
  181. platform_api_python_client/models/kube_prometheus_stack.py +0 -89
  182. platform_api_python_client/models/longhorn.py +0 -89
  183. platform_api_python_client/models/metrics_server.py +0 -89
  184. platform_api_python_client/models/network_operator.py +0 -89
  185. platform_api_python_client/models/opentelemetry_collector.py +0 -89
  186. platform_api_python_client/models/spire.py +0 -89
  187. platform_api_python_client/models/teleport_kube_agent.py +0 -89
  188. platform_api_python_client-4.37.1.dist-info/METADATA +0 -23
  189. platform_api_python_client-4.37.1.dist-info/RECORD +0 -180
  190. {platform_api_python_client-4.37.1.dist-info → platform_api_python_client-4.41.0.dist-info}/WHEEL +0 -0
  191. {platform_api_python_client-4.37.1.dist-info → platform_api_python_client-4.41.0.dist-info}/top_level.txt +0 -0
@@ -19,15 +19,16 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
- from platform_api_python_client.models.validation_error_loc_inner import ValidationErrorLocInner
22
+ from platform_api_python_client.models.location_inner import LocationInner
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
25
26
 
26
27
  class ValidationError(BaseModel):
27
28
  """
28
29
  ValidationError
29
30
  """ # noqa: E501
30
- loc: List[ValidationErrorLocInner]
31
+ loc: List[LocationInner]
31
32
  msg: StrictStr
32
33
  type: StrictStr
33
34
  input: Optional[Any] = None
@@ -35,7 +36,8 @@ class ValidationError(BaseModel):
35
36
  __properties: ClassVar[List[str]] = ["loc", "msg", "type", "input", "ctx"]
36
37
 
37
38
  model_config = ConfigDict(
38
- populate_by_name=True,
39
+ validate_by_name=True,
40
+ validate_by_alias=True,
39
41
  validate_assignment=True,
40
42
  protected_namespaces=(),
41
43
  )
@@ -47,8 +49,7 @@ class ValidationError(BaseModel):
47
49
 
48
50
  def to_json(self) -> str:
49
51
  """Returns the JSON representation of the model using alias"""
50
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
- return json.dumps(self.to_dict())
52
+ return json.dumps(to_jsonable_python(self.to_dict()))
52
53
 
53
54
  @classmethod
54
55
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -77,8 +78,7 @@ class ValidationError(BaseModel):
77
78
  _items = []
78
79
  if self.loc:
79
80
  for _item_loc in self.loc:
80
- if _item_loc:
81
- _items.append(_item_loc.to_dict())
81
+ _items.append(_item_loc.to_dict() if _item_loc is not None else None)
82
82
  _dict['loc'] = _items
83
83
  # set to None if input (nullable) is None
84
84
  # and model_fields_set contains the field
@@ -97,7 +97,7 @@ class ValidationError(BaseModel):
97
97
  return cls.model_validate(obj)
98
98
 
99
99
  _obj = cls.model_validate({
100
- "loc": [ValidationErrorLocInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None,
100
+ "loc": [LocationInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None,
101
101
  "msg": obj.get("msg"),
102
102
  "type": obj.get("type"),
103
103
  "input": obj.get("input"),
@@ -22,6 +22,7 @@ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing_extensions import Annotated
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
25
26
 
26
27
  class VolumeMount(BaseModel):
27
28
  """
@@ -33,7 +34,8 @@ class VolumeMount(BaseModel):
33
34
  __properties: ClassVar[List[str]] = ["volume_id", "mount_path", "read_only"]
34
35
 
35
36
  model_config = ConfigDict(
36
- populate_by_name=True,
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
37
39
  validate_assignment=True,
38
40
  protected_namespaces=(),
39
41
  )
@@ -45,8 +47,7 @@ class VolumeMount(BaseModel):
45
47
 
46
48
  def to_json(self) -> str:
47
49
  """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
51
 
51
52
  @classmethod
52
53
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -24,6 +24,7 @@ from platform_api_python_client.models.volume_backend import VolumeBackend
24
24
  from platform_api_python_client.models.volume_status import VolumeStatus
25
25
  from typing import Optional, Set
26
26
  from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
27
28
 
28
29
  class VolumeStatusResponse(BaseModel):
29
30
  """
@@ -37,7 +38,8 @@ class VolumeStatusResponse(BaseModel):
37
38
  __properties: ClassVar[List[str]] = ["id", "backend", "status", "service_status", "error_message"]
38
39
 
39
40
  model_config = ConfigDict(
40
- populate_by_name=True,
41
+ validate_by_name=True,
42
+ validate_by_alias=True,
41
43
  validate_assignment=True,
42
44
  protected_namespaces=(),
43
45
  )
@@ -49,8 +51,7 @@ class VolumeStatusResponse(BaseModel):
49
51
 
50
52
  def to_json(self) -> str:
51
53
  """Returns the JSON representation of the model using alias"""
52
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
- return json.dumps(self.to_dict())
54
+ return json.dumps(to_jsonable_python(self.to_dict()))
54
55
 
55
56
  @classmethod
56
57
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,20 +18,23 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict
21
- from typing import Any, ClassVar, Dict, List
22
- from platform_api_python_client.models.dynamo_kv_transfer_configuration import DynamoKvTransferConfiguration
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from platform_api_python_client.models.resource_requirements import ResourceRequirements
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
25
26
 
26
- class DynamoCommunicationsOutput(BaseModel):
27
+ class Workload(BaseModel):
27
28
  """
28
- DynamoCommunicationsOutput
29
+ Workload is a KAI component's resources.
29
30
  """ # noqa: E501
30
- kv_transfer: DynamoKvTransferConfiguration
31
- __properties: ClassVar[List[str]] = ["kv_transfer"]
31
+ resources: Optional[ResourceRequirements] = None
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["resources"]
32
34
 
33
35
  model_config = ConfigDict(
34
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
35
38
  validate_assignment=True,
36
39
  protected_namespaces=(),
37
40
  )
@@ -43,12 +46,11 @@ class DynamoCommunicationsOutput(BaseModel):
43
46
 
44
47
  def to_json(self) -> str:
45
48
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
49
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
50
 
49
51
  @classmethod
50
52
  def from_json(cls, json_str: str) -> Optional[Self]:
51
- """Create an instance of DynamoCommunicationsOutput from a JSON string"""
53
+ """Create an instance of Workload from a JSON string"""
52
54
  return cls.from_dict(json.loads(json_str))
53
55
 
54
56
  def to_dict(self) -> Dict[str, Any]:
@@ -60,8 +62,10 @@ class DynamoCommunicationsOutput(BaseModel):
60
62
  * `None` is only added to the output dict for nullable fields that
61
63
  were set at model initialization. Other fields with value `None`
62
64
  are ignored.
65
+ * Fields in `self.additional_properties` are added to the output dict.
63
66
  """
64
67
  excluded_fields: Set[str] = set([
68
+ "additional_properties",
65
69
  ])
66
70
 
67
71
  _dict = self.model_dump(
@@ -69,14 +73,24 @@ class DynamoCommunicationsOutput(BaseModel):
69
73
  exclude=excluded_fields,
70
74
  exclude_none=True,
71
75
  )
72
- # override the default output from pydantic by calling `to_dict()` of kv_transfer
73
- if self.kv_transfer:
74
- _dict['kv_transfer'] = self.kv_transfer.to_dict()
76
+ # override the default output from pydantic by calling `to_dict()` of resources
77
+ if self.resources:
78
+ _dict['resources'] = self.resources.to_dict()
79
+ # puts key-value pairs in additional_properties in the top level
80
+ if self.additional_properties is not None:
81
+ for _key, _value in self.additional_properties.items():
82
+ _dict[_key] = _value
83
+
84
+ # set to None if resources (nullable) is None
85
+ # and model_fields_set contains the field
86
+ if self.resources is None and "resources" in self.model_fields_set:
87
+ _dict['resources'] = None
88
+
75
89
  return _dict
76
90
 
77
91
  @classmethod
78
92
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
- """Create an instance of DynamoCommunicationsOutput from a dict"""
93
+ """Create an instance of Workload from a dict"""
80
94
  if obj is None:
81
95
  return None
82
96
 
@@ -84,8 +98,13 @@ class DynamoCommunicationsOutput(BaseModel):
84
98
  return cls.model_validate(obj)
85
99
 
86
100
  _obj = cls.model_validate({
87
- "kv_transfer": DynamoKvTransferConfiguration.from_dict(obj["kv_transfer"]) if obj.get("kv_transfer") is not None else None
101
+ "resources": ResourceRequirements.from_dict(obj["resources"]) if obj.get("resources") is not None else None
88
102
  })
103
+ # store additional fields in additional_properties
104
+ for _key in obj.keys():
105
+ if _key not in cls.__properties:
106
+ _obj.additional_properties[_key] = obj.get(_key)
107
+
89
108
  return _obj
90
109
 
91
110
 
@@ -12,10 +12,12 @@
12
12
  """ # noqa: E501
13
13
 
14
14
 
15
+ import ipaddress
15
16
  import io
16
17
  import json
17
18
  import re
18
19
  import ssl
20
+ from urllib.parse import urlparse
19
21
 
20
22
  import urllib3
21
23
 
@@ -34,6 +36,59 @@ def is_socks_proxy_url(url):
34
36
  else:
35
37
  return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
36
38
 
39
+ def contenttype_matches(contenttype, maintype, subtype):
40
+ """Matches the given contenttype against the given type and subtype
41
+
42
+ :param contenttype: the content type to match
43
+ :param maintype: the expected maintype
44
+ :param subtype: the expected subtype
45
+ :return: `true` when the given content type matches the given type and subtype,
46
+ regardless of the presence of mime type parameters, otherwise returns `false`.
47
+ :rtype: bool
48
+ """
49
+ pattern = '{type}/(?:[^+;]+\\+)?{subtype}(?:[ \t]*;.*)?'.format(
50
+ type = re.escape(maintype),
51
+ subtype = re.escape(subtype),
52
+ )
53
+ return re.fullmatch(pattern, contenttype, re.IGNORECASE) is not None
54
+
55
+ def should_bypass_proxies(url: str, no_proxy: str) -> bool:
56
+ """Return whether ``url`` matches the comma-separated ``no_proxy`` rules."""
57
+ parsed_url = urlparse(url)
58
+ if not parsed_url.hostname:
59
+ return True
60
+
61
+ host = parsed_url.hostname.lower()
62
+ host_and_port = parsed_url.netloc.lower()
63
+ try:
64
+ host_ip = ipaddress.ip_address(host)
65
+ except ValueError:
66
+ host_ip = None
67
+
68
+ for entry in (entry.strip().lower() for entry in no_proxy.split(',')):
69
+ if not entry:
70
+ continue
71
+ if entry == '*':
72
+ return True
73
+
74
+ if host_ip is not None:
75
+ try:
76
+ if host_ip in ipaddress.ip_network(entry, strict=False):
77
+ return True
78
+ except ValueError:
79
+ pass
80
+
81
+ entry = entry.lstrip('.')
82
+ if (
83
+ host == entry
84
+ or host.endswith('.' + entry)
85
+ or host_and_port == entry
86
+ or host_and_port.endswith('.' + entry)
87
+ ):
88
+ return True
89
+
90
+ return False
91
+
37
92
 
38
93
  class RESTResponse(io.IOBase):
39
94
 
@@ -48,12 +103,17 @@ class RESTResponse(io.IOBase):
48
103
  self.data = self.response.data
49
104
  return self.data
50
105
 
106
+ @property
107
+ def headers(self):
108
+ """Returns a dictionary of response headers."""
109
+ return self.response.headers
110
+
51
111
  def getheaders(self):
52
- """Returns a dictionary of the response headers."""
112
+ """Returns a dictionary of the response headers; use ``headers`` instead."""
53
113
  return self.response.headers
54
114
 
55
115
  def getheader(self, name, default=None):
56
- """Returns a given response header."""
116
+ """Returns a given response header; use ``headers.get()`` instead."""
57
117
  return self.response.headers.get(name, default)
58
118
 
59
119
 
@@ -76,6 +136,7 @@ class RESTClientObject:
76
136
  "ca_certs": configuration.ssl_ca_cert,
77
137
  "cert_file": configuration.cert_file,
78
138
  "key_file": configuration.key_file,
139
+ "ca_cert_data": configuration.ca_cert_data,
79
140
  }
80
141
  if configuration.assert_hostname is not None:
81
142
  pool_args['assert_hostname'] = (
@@ -98,7 +159,9 @@ class RESTClientObject:
98
159
  # https pool manager
99
160
  self.pool_manager: urllib3.PoolManager
100
161
 
101
- if configuration.proxy:
162
+ if configuration.proxy and not should_bypass_proxies(
163
+ configuration.host, configuration.no_proxy or ''
164
+ ):
102
165
  if is_socks_proxy_url(configuration.proxy):
103
166
  from urllib3.contrib.socks import SOCKSProxyManager
104
167
  pool_args["proxy_url"] = configuration.proxy
@@ -107,6 +170,8 @@ class RESTClientObject:
107
170
  else:
108
171
  pool_args["proxy_url"] = configuration.proxy
109
172
  pool_args["proxy_headers"] = configuration.proxy_headers
173
+ if configuration.proxy_ssl_context is not None:
174
+ pool_args["proxy_ssl_context"] = configuration.proxy_ssl_context
110
175
  self.pool_manager = urllib3.ProxyManager(**pool_args)
111
176
  else:
112
177
  self.pool_manager = urllib3.PoolManager(**pool_args)
@@ -170,12 +235,24 @@ class RESTClientObject:
170
235
  # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
171
236
  if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
172
237
 
173
- # no content type provided or payload is json
174
238
  content_type = headers.get('Content-Type')
175
- if (
239
+ is_json = (
176
240
  not content_type
177
- or re.search('json', content_type, re.IGNORECASE)
178
- ):
241
+ or contenttype_matches(content_type, 'application', 'json')
242
+ )
243
+ # JSON is valid YAML 1.2, so structured YAML bodies can use
244
+ # the existing JSON serializer:
245
+ # https://yaml.org/spec/1.2.2/#13-relation-to-json
246
+ is_structured_yaml = (
247
+ content_type
248
+ and (
249
+ contenttype_matches(content_type, 'application', 'yaml')
250
+ or contenttype_matches(content_type, 'text', 'yaml')
251
+ or contenttype_matches(content_type, 'text', 'x-yaml')
252
+ )
253
+ and not isinstance(body, (str, bytes))
254
+ )
255
+ if is_json or is_structured_yaml:
179
256
  request_body = None
180
257
  if body is not None:
181
258
  request_body = json.dumps(body)
@@ -187,7 +264,7 @@ class RESTClientObject:
187
264
  headers=headers,
188
265
  preload_content=False
189
266
  )
190
- elif content_type == 'application/x-www-form-urlencoded':
267
+ elif contenttype_matches(content_type, 'application', 'x-www-form-urlencoded'):
191
268
  r = self.pool_manager.request(
192
269
  method,
193
270
  url,
@@ -197,7 +274,7 @@ class RESTClientObject:
197
274
  headers=headers,
198
275
  preload_content=False
199
276
  )
200
- elif content_type == 'multipart/form-data':
277
+ elif contenttype_matches(content_type, 'multipart', 'form-data'):
201
278
  # must del headers['Content-Type'], or the correct
202
279
  # Content-Type which generated by urllib3 will be
203
280
  # overwritten.
@@ -225,7 +302,7 @@ class RESTClientObject:
225
302
  headers=headers,
226
303
  preload_content=False
227
304
  )
228
- elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
305
+ elif content_type.startswith('text/') and isinstance(body, bool):
229
306
  request_body = "true" if body else "false"
230
307
  r = self.pool_manager.request(
231
308
  method,