platform-api-python-client 4.31.0__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.
- platform_api_python_client/__init__.py +410 -148
- platform_api_python_client/api/external_api.py +6466 -1215
- platform_api_python_client/api_client.py +81 -36
- platform_api_python_client/configuration.py +262 -66
- platform_api_python_client/exceptions.py +24 -5
- platform_api_python_client/models/__init__.py +90 -35
- platform_api_python_client/models/admission.py +106 -0
- platform_api_python_client/models/autoscaling.py +120 -0
- platform_api_python_client/models/ccl_dynamo_pools.py +117 -0
- platform_api_python_client/models/{create_c_serve_v2_deployment_response.py → ccl_main_pools.py} +16 -16
- platform_api_python_client/models/ccluster_catalogs_cluster_base_argo_rollouts_chart_values.py +121 -0
- platform_api_python_client/models/{c_serve_v2_recipe.py → ccluster_catalogs_cluster_base_argo_rollouts_controller.py} +15 -18
- platform_api_python_client/models/ccluster_catalogs_cluster_base_argo_rollouts_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_cert_manager_chart_values.py +117 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_cert_manager_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_gpu_operator_chart_values.py +152 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_gpu_operator_values.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_chart_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_controller.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_istio_values.py +143 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_kai_scheduler_chart_values.py +154 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_kai_scheduler_values.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_keda_chart_values.py +131 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_keda_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_kube_prometheus_stack_chart_values.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_kube_prometheus_stack_values.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_metrics_server_chart_values.py +106 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_metrics_server_values.py +110 -0
- platform_api_python_client/models/cdi.py +113 -0
- platform_api_python_client/models/cluster_base_components.py +187 -0
- platform_api_python_client/models/cluster_capacity_response.py +5 -5
- platform_api_python_client/models/cluster_credential.py +6 -5
- platform_api_python_client/models/cluster_registration_request.py +4 -3
- platform_api_python_client/models/cluster_registration_response.py +4 -3
- platform_api_python_client/models/{istio_cni_overrides.py → cni.py} +29 -15
- platform_api_python_client/models/config_file_mount.py +6 -5
- platform_api_python_client/models/create_compute_deployment_request.py +35 -9
- platform_api_python_client/models/create_compute_deployment_response.py +4 -3
- platform_api_python_client/models/create_dynamo_deployment_request.py +67 -20
- platform_api_python_client/models/create_dynamo_deployment_response.py +4 -3
- platform_api_python_client/models/create_filesystem_volume_request.py +8 -20
- platform_api_python_client/models/create_hardware_instance_request.py +4 -3
- platform_api_python_client/models/create_inference_deployment_response.py +4 -3
- platform_api_python_client/models/create_inference_v3_deployment_request.py +52 -10
- platform_api_python_client/models/create_job_deployment_request.py +35 -9
- platform_api_python_client/models/create_job_deployment_response.py +4 -3
- platform_api_python_client/models/create_object_volume_request.py +10 -22
- platform_api_python_client/models/create_organization_request.py +4 -3
- platform_api_python_client/models/create_organization_response.py +4 -3
- platform_api_python_client/models/create_service_account_request.py +4 -3
- platform_api_python_client/models/create_service_account_response.py +4 -3
- platform_api_python_client/models/credits_response.py +4 -3
- platform_api_python_client/models/daily_bill_response.py +4 -3
- platform_api_python_client/models/{fluent_bit.py → dashboard.py} +29 -12
- platform_api_python_client/models/{prometheus_adapter.py → default_priorities.py} +29 -12
- platform_api_python_client/models/default_queue.py +106 -0
- platform_api_python_client/models/delete_user_vault_item_request.py +4 -3
- platform_api_python_client/models/deployment_log_event_v4.py +4 -3
- platform_api_python_client/models/deployment_response.py +12 -27
- platform_api_python_client/models/deployment_status_request.py +4 -3
- platform_api_python_client/models/deployment_status_response.py +4 -3
- platform_api_python_client/models/deployment_status_v3_response.py +5 -5
- platform_api_python_client/models/deployment_type.py +14 -0
- platform_api_python_client/models/deployment_usage.py +5 -5
- platform_api_python_client/models/deployment_usage_value.py +4 -3
- platform_api_python_client/models/dynamo_communications_input.py +4 -16
- platform_api_python_client/models/dynamo_frontend_config.py +105 -0
- platform_api_python_client/models/dynamo_frontend_config_response.py +105 -0
- platform_api_python_client/models/dynamo_image.py +106 -0
- platform_api_python_client/models/dynamo_kv_transfer_configuration.py +4 -16
- platform_api_python_client/models/{external_dns.py → dynamo_weight_transfer_configuration.py} +13 -13
- platform_api_python_client/models/dynamo_weight_transfer_policy.py +36 -0
- platform_api_python_client/models/dynamo_worker_pool_config.py +6 -18
- platform_api_python_client/models/dynamo_worker_pools.py +4 -16
- platform_api_python_client/models/{keda.py → env.py} +14 -13
- platform_api_python_client/models/generate_service_account_secret_response.py +4 -3
- platform_api_python_client/models/get_cluster_response.py +8 -5
- platform_api_python_client/models/get_compute_deployment_response.py +35 -8
- platform_api_python_client/models/get_deployment_log_response.py +4 -3
- platform_api_python_client/models/get_deployment_log_v4_response.py +5 -5
- platform_api_python_client/models/get_deployment_pods_response.py +4 -3
- platform_api_python_client/models/get_deployment_response.py +7 -7
- platform_api_python_client/models/get_deployment_revision_response.py +4 -3
- platform_api_python_client/models/get_deployment_usage_response.py +24 -9
- platform_api_python_client/models/get_dynamo_deployment_response.py +63 -15
- platform_api_python_client/models/get_filesystem_volume_response.py +4 -3
- platform_api_python_client/models/get_inference_deployment_response.py +7 -7
- platform_api_python_client/models/get_inference_v3_deployment_response.py +51 -8
- platform_api_python_client/models/get_job_deployment_response.py +35 -8
- platform_api_python_client/models/get_object_volume_response.py +4 -3
- platform_api_python_client/models/gpu_type_capacity.py +4 -3
- platform_api_python_client/models/hardware_instance_response.py +10 -5
- platform_api_python_client/models/hardware_preset_response.py +4 -3
- platform_api_python_client/models/http_validation_error.py +5 -5
- platform_api_python_client/models/image.py +113 -0
- platform_api_python_client/models/image_pull_secret_credentials.py +4 -3
- platform_api_python_client/models/{istio_cni_subchart_overrides.py → ingress.py} +26 -18
- platform_api_python_client/models/{c_serve_recipe_response.py → insight_list_item_response.py} +33 -27
- platform_api_python_client/models/{create_c_serve_v3_deployment_response.py → insight_resource.py} +20 -14
- platform_api_python_client/models/insight_resource_type.py +37 -0
- platform_api_python_client/models/insight_response.py +133 -0
- platform_api_python_client/models/insight_severity.py +40 -0
- platform_api_python_client/models/insight_status.py +39 -0
- platform_api_python_client/models/insight_status_change_response.py +108 -0
- platform_api_python_client/models/invite_user_request.py +4 -3
- platform_api_python_client/models/istio_base.py +106 -0
- platform_api_python_client/models/istio_cni.py +124 -0
- platform_api_python_client/models/{ingress_nginx.py → istio_gateway.py} +29 -12
- platform_api_python_client/models/{dynamo_communications_output.py → istiod.py} +21 -15
- platform_api_python_client/models/list_cluster_capacity_response.py +5 -5
- platform_api_python_client/models/list_daily_bill_response.py +5 -5
- platform_api_python_client/models/list_deployment_revisions_response.py +5 -5
- platform_api_python_client/models/list_get_cluster_response.py +5 -5
- platform_api_python_client/models/list_get_deployment_response.py +5 -5
- platform_api_python_client/models/list_hardware_instance_response.py +5 -5
- platform_api_python_client/models/list_hardware_preset_response.py +5 -5
- platform_api_python_client/models/{istio_overrides.py → list_insights_response.py} +19 -20
- platform_api_python_client/models/list_organization_gpu_quota_response.py +5 -5
- platform_api_python_client/models/list_prebuilt_image_response.py +5 -5
- platform_api_python_client/models/list_service_accounts_response.py +5 -5
- platform_api_python_client/models/list_user_vault_items_response.py +5 -5
- platform_api_python_client/models/list_volumes_response.py +5 -5
- platform_api_python_client/models/{validation_error_loc_inner.py → location_inner.py} +6 -6
- platform_api_python_client/models/metric.py +13 -0
- platform_api_python_client/models/metrics.py +117 -0
- platform_api_python_client/models/metrics_config.py +6 -5
- platform_api_python_client/models/mig.py +106 -0
- platform_api_python_client/models/operator.py +117 -0
- platform_api_python_client/models/organization_gpu_quota_request.py +4 -3
- platform_api_python_client/models/organization_gpu_quota_response.py +4 -3
- platform_api_python_client/models/pilot.py +106 -0
- platform_api_python_client/models/pod_details.py +4 -3
- platform_api_python_client/models/pool.py +117 -0
- platform_api_python_client/models/prebuilt_image_response.py +4 -3
- platform_api_python_client/models/prometheus.py +110 -0
- platform_api_python_client/models/prometheus_rules.py +120 -0
- platform_api_python_client/models/prometheus_spec.py +113 -0
- platform_api_python_client/models/prometheus_values.py +117 -0
- platform_api_python_client/models/quota.py +106 -0
- platform_api_python_client/models/replicas.py +106 -0
- platform_api_python_client/models/resource_list.py +113 -0
- platform_api_python_client/models/resource_requirements.py +120 -0
- platform_api_python_client/models/revision_pod_details.py +5 -5
- platform_api_python_client/models/rollout_strategy_params.py +4 -3
- platform_api_python_client/models/scheduler.py +117 -0
- platform_api_python_client/models/service_account_response.py +4 -3
- platform_api_python_client/models/{istio.py → toggle.py} +27 -19
- platform_api_python_client/models/toleration.py +134 -0
- platform_api_python_client/models/unified_get_compute_deployment_response.py +177 -0
- platform_api_python_client/models/{c_serve_recipe_perf.py → unified_get_deployment_logs_response.py} +19 -22
- platform_api_python_client/models/{longhorn.py → unified_get_deployment_pods_response.py} +13 -14
- platform_api_python_client/models/unified_get_deployment_response.py +164 -0
- platform_api_python_client/models/unified_get_deployment_revision_response.py +110 -0
- platform_api_python_client/models/{argo_rollouts.py → unified_get_deployment_rollout_response.py} +15 -13
- platform_api_python_client/models/unified_get_deployment_usage_response.py +110 -0
- platform_api_python_client/models/unified_get_dynamo_deployment_response.py +218 -0
- platform_api_python_client/models/unified_get_inference_v3_deployment_response.py +228 -0
- platform_api_python_client/models/unified_get_job_deployment_response.py +204 -0
- platform_api_python_client/models/{list_c_serve_recipe_response.py → unified_list_deployment_revisions_response.py} +12 -12
- platform_api_python_client/models/{spire.py → unified_update_deployment_rollout_request.py} +12 -13
- platform_api_python_client/models/unified_write_compute_deployment_request.py +154 -0
- platform_api_python_client/models/unified_write_deployment_request.py +164 -0
- platform_api_python_client/models/unified_write_deployment_response.py +110 -0
- platform_api_python_client/models/unified_write_dynamo_deployment_request.py +197 -0
- platform_api_python_client/models/{create_c_serve_v3_deployment_request.py → unified_write_inference_v3_deployment_request.py} +86 -78
- platform_api_python_client/models/unified_write_job_deployment_request.py +183 -0
- platform_api_python_client/models/update_cluster_metadata_request.py +4 -3
- platform_api_python_client/models/{cluster_config.py → update_cluster_request.py} +11 -10
- platform_api_python_client/models/update_deployment_response.py +4 -3
- platform_api_python_client/models/update_deployment_status_v3_request.py +4 -3
- platform_api_python_client/models/update_insight_status_request.py +107 -0
- platform_api_python_client/models/update_service_account_request.py +4 -3
- platform_api_python_client/models/upsert_user_vault_item_request.py +5 -4
- platform_api_python_client/models/usage_availability.py +40 -0
- platform_api_python_client/models/usage_component.py +39 -0
- platform_api_python_client/models/user_vault_item.py +4 -3
- platform_api_python_client/models/validation_error.py +8 -8
- platform_api_python_client/models/volume_mount.py +4 -3
- platform_api_python_client/models/volume_status_response.py +4 -3
- platform_api_python_client/models/workload.py +110 -0
- platform_api_python_client/rest.py +87 -10
- platform_api_python_client-4.41.0.dist-info/METADATA +418 -0
- platform_api_python_client-4.41.0.dist-info/RECORD +206 -0
- {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.41.0.dist-info}/WHEEL +1 -1
- platform_api_python_client/models/cert_manager.py +0 -89
- platform_api_python_client/models/cluster_components.py +0 -193
- platform_api_python_client/models/final_stack.py +0 -89
- platform_api_python_client/models/get_c_serve_v2_deployment_response.py +0 -193
- platform_api_python_client/models/get_c_serve_v3_deployment_response.py +0 -194
- platform_api_python_client/models/gpu_operator.py +0 -89
- platform_api_python_client/models/kube_prometheus_stack.py +0 -89
- platform_api_python_client/models/metrics_server.py +0 -89
- platform_api_python_client/models/network_operator.py +0 -89
- platform_api_python_client/models/opentelemetry_collector.py +0 -89
- platform_api_python_client/models/spire_crds.py +0 -89
- platform_api_python_client/models/teleport_kube_agent.py +0 -89
- platform_api_python_client-4.31.0.dist-info/METADATA +0 -23
- platform_api_python_client-4.31.0.dist-info/RECORD +0 -151
- {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.41.0.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
1
|
"""
|
|
4
2
|
Platform External API
|
|
5
3
|
|
|
@@ -13,14 +11,19 @@
|
|
|
13
11
|
|
|
14
12
|
|
|
15
13
|
import copy
|
|
14
|
+
import http.client as httplib
|
|
16
15
|
import logging
|
|
17
16
|
from logging import FileHandler
|
|
18
17
|
import multiprocessing
|
|
18
|
+
import ssl
|
|
19
19
|
import sys
|
|
20
|
-
from typing import Optional
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union
|
|
21
|
+
from urllib.parse import urlparse
|
|
22
|
+
from urllib.request import getproxies
|
|
23
|
+
from typing_extensions import NotRequired, Self
|
|
24
|
+
|
|
21
25
|
import urllib3
|
|
22
26
|
|
|
23
|
-
import http.client as httplib
|
|
24
27
|
|
|
25
28
|
JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
|
26
29
|
'multipleOf', 'maximum', 'exclusiveMaximum',
|
|
@@ -28,6 +31,107 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
|
|
28
31
|
'minLength', 'pattern', 'maxItems', 'minItems'
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
ServerVariablesT = Dict[str, str]
|
|
35
|
+
|
|
36
|
+
GenericAuthSetting = TypedDict(
|
|
37
|
+
"GenericAuthSetting",
|
|
38
|
+
{
|
|
39
|
+
"type": str,
|
|
40
|
+
"in": str,
|
|
41
|
+
"key": str,
|
|
42
|
+
"value": str,
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
OAuth2AuthSetting = TypedDict(
|
|
48
|
+
"OAuth2AuthSetting",
|
|
49
|
+
{
|
|
50
|
+
"type": Literal["oauth2"],
|
|
51
|
+
"in": Literal["header"],
|
|
52
|
+
"key": Literal["Authorization"],
|
|
53
|
+
"value": str,
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
APIKeyAuthSetting = TypedDict(
|
|
59
|
+
"APIKeyAuthSetting",
|
|
60
|
+
{
|
|
61
|
+
"type": Literal["api_key"],
|
|
62
|
+
"in": str,
|
|
63
|
+
"key": str,
|
|
64
|
+
"value": Optional[str],
|
|
65
|
+
},
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
BasicAuthSetting = TypedDict(
|
|
70
|
+
"BasicAuthSetting",
|
|
71
|
+
{
|
|
72
|
+
"type": Literal["basic"],
|
|
73
|
+
"in": Literal["header"],
|
|
74
|
+
"key": Literal["Authorization"],
|
|
75
|
+
"value": Optional[str],
|
|
76
|
+
},
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
BearerFormatAuthSetting = TypedDict(
|
|
81
|
+
"BearerFormatAuthSetting",
|
|
82
|
+
{
|
|
83
|
+
"type": Literal["bearer"],
|
|
84
|
+
"in": Literal["header"],
|
|
85
|
+
"format": Literal["JWT"],
|
|
86
|
+
"key": Literal["Authorization"],
|
|
87
|
+
"value": str,
|
|
88
|
+
},
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
BearerAuthSetting = TypedDict(
|
|
93
|
+
"BearerAuthSetting",
|
|
94
|
+
{
|
|
95
|
+
"type": Literal["bearer"],
|
|
96
|
+
"in": Literal["header"],
|
|
97
|
+
"key": Literal["Authorization"],
|
|
98
|
+
"value": str,
|
|
99
|
+
},
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
HTTPSignatureAuthSetting = TypedDict(
|
|
104
|
+
"HTTPSignatureAuthSetting",
|
|
105
|
+
{
|
|
106
|
+
"type": Literal["http-signature"],
|
|
107
|
+
"in": Literal["header"],
|
|
108
|
+
"key": Literal["Authorization"],
|
|
109
|
+
"value": None,
|
|
110
|
+
},
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
AuthSettings = TypedDict(
|
|
115
|
+
"AuthSettings",
|
|
116
|
+
{
|
|
117
|
+
"HTTPBearer": BearerAuthSetting,
|
|
118
|
+
},
|
|
119
|
+
total=False,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class HostSettingVariable(TypedDict):
|
|
124
|
+
description: str
|
|
125
|
+
default_value: str
|
|
126
|
+
enum_values: List[str]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class HostSetting(TypedDict):
|
|
130
|
+
url: str
|
|
131
|
+
description: str
|
|
132
|
+
variables: NotRequired[Dict[str, HostSettingVariable]]
|
|
133
|
+
|
|
134
|
+
|
|
31
135
|
class Configuration:
|
|
32
136
|
"""This class contains various settings of the API client.
|
|
33
137
|
|
|
@@ -55,27 +159,67 @@ class Configuration:
|
|
|
55
159
|
string values to replace variables in templated server configuration.
|
|
56
160
|
The validation of enums is performed for variables with defined enum
|
|
57
161
|
values before.
|
|
162
|
+
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
|
|
163
|
+
when calling API from https server.
|
|
58
164
|
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
|
59
165
|
in PEM format.
|
|
60
|
-
:param retries:
|
|
166
|
+
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
|
|
167
|
+
:param ca_cert_data: verify the peer using concatenated CA certificate data
|
|
168
|
+
in PEM (str) or DER (bytes) format.
|
|
169
|
+
:param cert_file: the path to a client certificate file, for mTLS.
|
|
170
|
+
:param key_file: the path to a client key file, for mTLS.
|
|
171
|
+
:param assert_hostname: Set this to True/False to enable/disable SSL hostname verification.
|
|
172
|
+
:param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server.
|
|
173
|
+
:param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync.
|
|
174
|
+
:param proxy: Proxy URL.
|
|
175
|
+
:param no_proxy: Comma-separated hosts that bypass the proxy.
|
|
176
|
+
:param proxy_headers: Proxy headers.
|
|
177
|
+
:param proxy_ssl_context: SSL context used only for the TLS handshake with the proxy itself, independent of the destination TLS settings.
|
|
178
|
+
:param safe_chars_for_path_param: Safe characters for path parameter encoding.
|
|
179
|
+
:param client_side_validation: Enable client-side validation. Default True.
|
|
180
|
+
:param socket_options: Options to pass down to the underlying urllib3 socket.
|
|
181
|
+
:param datetime_format: Datetime format string for serialization.
|
|
182
|
+
:param date_format: Date format string for serialization.
|
|
61
183
|
|
|
62
184
|
:Example:
|
|
63
185
|
"""
|
|
64
186
|
|
|
65
|
-
_default = None
|
|
66
|
-
|
|
67
|
-
def __init__(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
187
|
+
_default: ClassVar[Optional[Self]] = None
|
|
188
|
+
|
|
189
|
+
def __init__(
|
|
190
|
+
self,
|
|
191
|
+
host: Optional[str]=None,
|
|
192
|
+
api_key: Optional[Dict[str, str]]=None,
|
|
193
|
+
api_key_prefix: Optional[Dict[str, str]]=None,
|
|
194
|
+
username: Optional[str]=None,
|
|
195
|
+
password: Optional[str]=None,
|
|
196
|
+
access_token: Optional[str]=None,
|
|
197
|
+
server_index: Optional[int]=None,
|
|
198
|
+
server_variables: Optional[ServerVariablesT]=None,
|
|
199
|
+
server_operation_index: Optional[Dict[int, int]]=None,
|
|
200
|
+
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
|
|
201
|
+
ignore_operation_servers: bool=False,
|
|
202
|
+
ssl_ca_cert: Optional[str]=None,
|
|
203
|
+
retries: Optional[Union[int, urllib3.util.retry.Retry]] = None,
|
|
204
|
+
ca_cert_data: Optional[Union[str, bytes]] = None,
|
|
205
|
+
cert_file: Optional[str]=None,
|
|
206
|
+
key_file: Optional[str]=None,
|
|
207
|
+
verify_ssl: bool=True,
|
|
208
|
+
assert_hostname: Optional[bool]=None,
|
|
209
|
+
tls_server_name: Optional[str]=None,
|
|
210
|
+
connection_pool_maxsize: Optional[int]=None,
|
|
211
|
+
proxy: Optional[str]=None,
|
|
212
|
+
no_proxy: Optional[str]=None,
|
|
213
|
+
proxy_headers: Optional[Any]=None,
|
|
214
|
+
proxy_ssl_context: Optional[ssl.SSLContext]=None,
|
|
215
|
+
safe_chars_for_path_param: str='',
|
|
216
|
+
client_side_validation: bool=True,
|
|
217
|
+
socket_options: Optional[Any]=None,
|
|
218
|
+
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
|
|
219
|
+
date_format: str="%Y-%m-%d",
|
|
220
|
+
*,
|
|
221
|
+
debug: Optional[bool] = None,
|
|
222
|
+
) -> None:
|
|
79
223
|
"""Constructor
|
|
80
224
|
"""
|
|
81
225
|
self._base_path = "http://localhost" if host is None else host
|
|
@@ -142,7 +286,7 @@ class Configuration:
|
|
|
142
286
|
"""Debug switch
|
|
143
287
|
"""
|
|
144
288
|
|
|
145
|
-
self.verify_ssl =
|
|
289
|
+
self.verify_ssl = verify_ssl
|
|
146
290
|
"""SSL/TLS verification
|
|
147
291
|
Set this to false to skip verifying SSL certificate when calling API
|
|
148
292
|
from https server.
|
|
@@ -150,74 +294,96 @@ class Configuration:
|
|
|
150
294
|
self.ssl_ca_cert = ssl_ca_cert
|
|
151
295
|
"""Set this to customize the certificate file to verify the peer.
|
|
152
296
|
"""
|
|
153
|
-
self.
|
|
297
|
+
self.ca_cert_data = ca_cert_data
|
|
298
|
+
"""Set this to verify the peer using PEM (str) or DER (bytes)
|
|
299
|
+
certificate data.
|
|
300
|
+
"""
|
|
301
|
+
self.cert_file = cert_file
|
|
154
302
|
"""client certificate file
|
|
155
303
|
"""
|
|
156
|
-
self.key_file =
|
|
304
|
+
self.key_file = key_file
|
|
157
305
|
"""client key file
|
|
158
306
|
"""
|
|
159
|
-
self.assert_hostname =
|
|
307
|
+
self.assert_hostname = assert_hostname
|
|
160
308
|
"""Set this to True/False to enable/disable SSL hostname verification.
|
|
161
309
|
"""
|
|
162
|
-
self.tls_server_name =
|
|
310
|
+
self.tls_server_name = tls_server_name
|
|
163
311
|
"""SSL/TLS Server Name Indication (SNI)
|
|
164
312
|
Set this to the SNI value expected by the server.
|
|
165
313
|
"""
|
|
166
314
|
|
|
167
|
-
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
|
|
315
|
+
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
|
|
168
316
|
"""urllib3 connection pool's maximum number of connections saved
|
|
169
|
-
per pool.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
317
|
+
per pool. None in the constructor is coerced to cpu_count * 5.
|
|
318
|
+
"""
|
|
319
|
+
|
|
320
|
+
# urllib3 does not read proxy environment variables itself:
|
|
321
|
+
# https://github.com/urllib3/urllib3/issues/1785
|
|
322
|
+
# A proxy taken from the environment is re-resolved when the host is
|
|
323
|
+
# assigned; see the host setter.
|
|
324
|
+
self._proxy_from_env = proxy is None
|
|
325
|
+
if proxy is None or no_proxy is None:
|
|
326
|
+
proxies = getproxies()
|
|
327
|
+
if proxy is None:
|
|
328
|
+
proxy = self._env_proxy(proxies, self.host)
|
|
329
|
+
if no_proxy is None:
|
|
330
|
+
no_proxy = proxies.get("no")
|
|
331
|
+
self._proxy = proxy
|
|
332
|
+
self.no_proxy = no_proxy
|
|
333
|
+
"""Hosts that bypass the proxy
|
|
334
|
+
"""
|
|
335
|
+
self.proxy_headers = proxy_headers
|
|
179
336
|
"""Proxy headers
|
|
180
337
|
"""
|
|
181
|
-
self.
|
|
338
|
+
self.proxy_ssl_context = proxy_ssl_context
|
|
339
|
+
"""SSL context used only for the TLS handshake with the proxy itself
|
|
340
|
+
(e.g. an HTTPS CONNECT tunnel), independent of the destination TLS
|
|
341
|
+
settings above.
|
|
342
|
+
"""
|
|
343
|
+
self.safe_chars_for_path_param = safe_chars_for_path_param
|
|
182
344
|
"""Safe chars for path_param
|
|
183
345
|
"""
|
|
184
346
|
self.retries = retries
|
|
185
|
-
"""
|
|
347
|
+
"""Retry configuration
|
|
186
348
|
"""
|
|
187
349
|
# Enable client side validation
|
|
188
|
-
self.client_side_validation =
|
|
350
|
+
self.client_side_validation = client_side_validation
|
|
189
351
|
|
|
190
|
-
self.socket_options =
|
|
352
|
+
self.socket_options = socket_options
|
|
191
353
|
"""Options to pass down to the underlying urllib3 socket
|
|
192
354
|
"""
|
|
193
355
|
|
|
194
|
-
self.datetime_format =
|
|
356
|
+
self.datetime_format = datetime_format
|
|
195
357
|
"""datetime format
|
|
196
358
|
"""
|
|
197
359
|
|
|
198
|
-
self.date_format =
|
|
360
|
+
self.date_format = date_format
|
|
199
361
|
"""date format
|
|
200
362
|
"""
|
|
201
363
|
|
|
202
|
-
def __deepcopy__(self, memo):
|
|
364
|
+
def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
|
|
203
365
|
cls = self.__class__
|
|
204
366
|
result = cls.__new__(cls)
|
|
205
367
|
memo[id(self)] = result
|
|
206
368
|
for k, v in self.__dict__.items():
|
|
369
|
+
if k == 'proxy_ssl_context':
|
|
370
|
+
# ssl.SSLContext holds unpicklable C state and can't be deepcopied.
|
|
371
|
+
setattr(result, k, v)
|
|
372
|
+
continue
|
|
207
373
|
if k not in ('logger', 'logger_file_handler'):
|
|
208
374
|
setattr(result, k, copy.deepcopy(v, memo))
|
|
209
375
|
# shallow copy of loggers
|
|
210
376
|
result.logger = copy.copy(self.logger)
|
|
211
|
-
# use
|
|
377
|
+
# use setter to re-create the file handler (excluded from __dict__ copy)
|
|
212
378
|
result.logger_file = self.logger_file
|
|
213
|
-
|
|
379
|
+
|
|
214
380
|
return result
|
|
215
381
|
|
|
216
|
-
def __setattr__(self, name, value):
|
|
382
|
+
def __setattr__(self, name: str, value: Any) -> None:
|
|
217
383
|
object.__setattr__(self, name, value)
|
|
218
384
|
|
|
219
385
|
@classmethod
|
|
220
|
-
def set_default(cls, default):
|
|
386
|
+
def set_default(cls, default: Optional[Self]) -> None:
|
|
221
387
|
"""Set default instance of configuration.
|
|
222
388
|
|
|
223
389
|
It stores default configuration, which can be
|
|
@@ -228,7 +394,7 @@ class Configuration:
|
|
|
228
394
|
cls._default = default
|
|
229
395
|
|
|
230
396
|
@classmethod
|
|
231
|
-
def get_default_copy(cls):
|
|
397
|
+
def get_default_copy(cls) -> Self:
|
|
232
398
|
"""Deprecated. Please use `get_default` instead.
|
|
233
399
|
|
|
234
400
|
Deprecated. Please use `get_default` instead.
|
|
@@ -238,7 +404,7 @@ class Configuration:
|
|
|
238
404
|
return cls.get_default()
|
|
239
405
|
|
|
240
406
|
@classmethod
|
|
241
|
-
def get_default(cls):
|
|
407
|
+
def get_default(cls) -> Self:
|
|
242
408
|
"""Return the default configuration.
|
|
243
409
|
|
|
244
410
|
This method returns newly created, based on default constructor,
|
|
@@ -248,11 +414,11 @@ class Configuration:
|
|
|
248
414
|
:return: The configuration object.
|
|
249
415
|
"""
|
|
250
416
|
if cls._default is None:
|
|
251
|
-
cls._default =
|
|
417
|
+
cls._default = cls()
|
|
252
418
|
return cls._default
|
|
253
419
|
|
|
254
420
|
@property
|
|
255
|
-
def logger_file(self):
|
|
421
|
+
def logger_file(self) -> Optional[str]:
|
|
256
422
|
"""The logger file.
|
|
257
423
|
|
|
258
424
|
If the logger_file is None, then add stream handler and remove file
|
|
@@ -264,7 +430,7 @@ class Configuration:
|
|
|
264
430
|
return self.__logger_file
|
|
265
431
|
|
|
266
432
|
@logger_file.setter
|
|
267
|
-
def logger_file(self, value):
|
|
433
|
+
def logger_file(self, value: Optional[str]) -> None:
|
|
268
434
|
"""The logger file.
|
|
269
435
|
|
|
270
436
|
If the logger_file is None, then add stream handler and remove file
|
|
@@ -283,7 +449,7 @@ class Configuration:
|
|
|
283
449
|
logger.addHandler(self.logger_file_handler)
|
|
284
450
|
|
|
285
451
|
@property
|
|
286
|
-
def debug(self):
|
|
452
|
+
def debug(self) -> bool:
|
|
287
453
|
"""Debug status
|
|
288
454
|
|
|
289
455
|
:param value: The debug status, True or False.
|
|
@@ -292,7 +458,7 @@ class Configuration:
|
|
|
292
458
|
return self.__debug
|
|
293
459
|
|
|
294
460
|
@debug.setter
|
|
295
|
-
def debug(self, value):
|
|
461
|
+
def debug(self, value: bool) -> None:
|
|
296
462
|
"""Debug status
|
|
297
463
|
|
|
298
464
|
:param value: The debug status, True or False.
|
|
@@ -314,7 +480,7 @@ class Configuration:
|
|
|
314
480
|
httplib.HTTPConnection.debuglevel = 0
|
|
315
481
|
|
|
316
482
|
@property
|
|
317
|
-
def logger_format(self):
|
|
483
|
+
def logger_format(self) -> str:
|
|
318
484
|
"""The logger format.
|
|
319
485
|
|
|
320
486
|
The logger_formatter will be updated when sets logger_format.
|
|
@@ -325,7 +491,7 @@ class Configuration:
|
|
|
325
491
|
return self.__logger_format
|
|
326
492
|
|
|
327
493
|
@logger_format.setter
|
|
328
|
-
def logger_format(self, value):
|
|
494
|
+
def logger_format(self, value: str) -> None:
|
|
329
495
|
"""The logger format.
|
|
330
496
|
|
|
331
497
|
The logger_formatter will be updated when sets logger_format.
|
|
@@ -336,7 +502,7 @@ class Configuration:
|
|
|
336
502
|
self.__logger_format = value
|
|
337
503
|
self.logger_formatter = logging.Formatter(self.__logger_format)
|
|
338
504
|
|
|
339
|
-
def get_api_key_with_prefix(self, identifier, alias=None):
|
|
505
|
+
def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]:
|
|
340
506
|
"""Gets API key (with prefix if set).
|
|
341
507
|
|
|
342
508
|
:param identifier: The identifier of apiKey.
|
|
@@ -347,13 +513,16 @@ class Configuration:
|
|
|
347
513
|
self.refresh_api_key_hook(self)
|
|
348
514
|
key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
|
|
349
515
|
if key:
|
|
350
|
-
prefix = self.api_key_prefix.get(
|
|
516
|
+
prefix = self.api_key_prefix.get(
|
|
517
|
+
identifier, self.api_key_prefix.get(alias) if alias is not None else None)
|
|
351
518
|
if prefix:
|
|
352
519
|
return "%s %s" % (prefix, key)
|
|
353
520
|
else:
|
|
354
521
|
return key
|
|
355
522
|
|
|
356
|
-
|
|
523
|
+
return None
|
|
524
|
+
|
|
525
|
+
def get_basic_auth_token(self) -> Optional[str]:
|
|
357
526
|
"""Gets HTTP basic authentication header (string).
|
|
358
527
|
|
|
359
528
|
:return: The token for basic HTTP authentication.
|
|
@@ -364,16 +533,17 @@ class Configuration:
|
|
|
364
533
|
password = ""
|
|
365
534
|
if self.password is not None:
|
|
366
535
|
password = self.password
|
|
536
|
+
|
|
367
537
|
return urllib3.util.make_headers(
|
|
368
538
|
basic_auth=username + ':' + password
|
|
369
539
|
).get('authorization')
|
|
370
540
|
|
|
371
|
-
def auth_settings(self):
|
|
541
|
+
def auth_settings(self)-> AuthSettings:
|
|
372
542
|
"""Gets Auth Settings dict for api client.
|
|
373
543
|
|
|
374
544
|
:return: The Auth Settings information dict.
|
|
375
545
|
"""
|
|
376
|
-
auth = {}
|
|
546
|
+
auth: AuthSettings = {}
|
|
377
547
|
if self.access_token is not None:
|
|
378
548
|
auth['HTTPBearer'] = {
|
|
379
549
|
'type': 'bearer',
|
|
@@ -383,7 +553,7 @@ class Configuration:
|
|
|
383
553
|
}
|
|
384
554
|
return auth
|
|
385
555
|
|
|
386
|
-
def to_debug_report(self):
|
|
556
|
+
def to_debug_report(self) -> str:
|
|
387
557
|
"""Gets the essential information for debugging.
|
|
388
558
|
|
|
389
559
|
:return: The report for debugging.
|
|
@@ -392,10 +562,10 @@ class Configuration:
|
|
|
392
562
|
"OS: {env}\n"\
|
|
393
563
|
"Python Version: {pyversion}\n"\
|
|
394
564
|
"Version of the API: 0.1.0\n"\
|
|
395
|
-
"SDK Package Version: 4.
|
|
565
|
+
"SDK Package Version: 4.41.0".\
|
|
396
566
|
format(env=sys.platform, pyversion=sys.version)
|
|
397
567
|
|
|
398
|
-
def get_host_settings(self):
|
|
568
|
+
def get_host_settings(self) -> List[HostSetting]:
|
|
399
569
|
"""Gets an array of host settings
|
|
400
570
|
|
|
401
571
|
:return: An array of host settings
|
|
@@ -407,7 +577,12 @@ class Configuration:
|
|
|
407
577
|
}
|
|
408
578
|
]
|
|
409
579
|
|
|
410
|
-
def get_host_from_settings(
|
|
580
|
+
def get_host_from_settings(
|
|
581
|
+
self,
|
|
582
|
+
index: Optional[int],
|
|
583
|
+
variables: Optional[ServerVariablesT]=None,
|
|
584
|
+
servers: Optional[List[HostSetting]]=None,
|
|
585
|
+
) -> str:
|
|
411
586
|
"""Gets host URL based on the index and variables
|
|
412
587
|
:param index: array index of the host settings
|
|
413
588
|
:param variables: hash of variable and the corresponding value
|
|
@@ -435,6 +610,7 @@ class Configuration:
|
|
|
435
610
|
variable_name, variable['default_value'])
|
|
436
611
|
|
|
437
612
|
if 'enum_values' in variable \
|
|
613
|
+
and variable['enum_values'] \
|
|
438
614
|
and used_value not in variable['enum_values']:
|
|
439
615
|
raise ValueError(
|
|
440
616
|
"The variable `{0}` in the host URL has invalid value "
|
|
@@ -447,12 +623,32 @@ class Configuration:
|
|
|
447
623
|
return url
|
|
448
624
|
|
|
449
625
|
@property
|
|
450
|
-
def host(self):
|
|
626
|
+
def host(self) -> str:
|
|
451
627
|
"""Return generated host."""
|
|
452
628
|
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
|
|
453
629
|
|
|
454
630
|
@host.setter
|
|
455
|
-
def host(self, value):
|
|
631
|
+
def host(self, value: str) -> None:
|
|
456
632
|
"""Fix base path."""
|
|
457
633
|
self._base_path = value
|
|
458
634
|
self.server_index = None
|
|
635
|
+
if self._proxy_from_env:
|
|
636
|
+
# the scheme-specific proxy depends on the host, which is
|
|
637
|
+
# commonly assigned after construction
|
|
638
|
+
self._proxy = self._env_proxy(getproxies(), value)
|
|
639
|
+
|
|
640
|
+
@staticmethod
|
|
641
|
+
def _env_proxy(proxies: Dict[str, str], host: str) -> Optional[str]:
|
|
642
|
+
"""Pick the environment proxy that applies to `host`."""
|
|
643
|
+
return proxies.get(urlparse(host).scheme) or proxies.get("all")
|
|
644
|
+
|
|
645
|
+
@property
|
|
646
|
+
def proxy(self) -> Optional[str]:
|
|
647
|
+
"""Proxy URL
|
|
648
|
+
"""
|
|
649
|
+
return self._proxy
|
|
650
|
+
|
|
651
|
+
@proxy.setter
|
|
652
|
+
def proxy(self, value: Optional[str]) -> None:
|
|
653
|
+
self._proxy = value
|
|
654
|
+
self._proxy_from_env = False
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
1
|
"""
|
|
4
2
|
Platform External API
|
|
5
3
|
|
|
@@ -11,6 +9,7 @@
|
|
|
11
9
|
Do not edit the class manually.
|
|
12
10
|
""" # noqa: E501
|
|
13
11
|
|
|
12
|
+
|
|
14
13
|
from typing import Any, Optional
|
|
15
14
|
from typing_extensions import Self
|
|
16
15
|
|
|
@@ -128,7 +127,7 @@ class ApiException(OpenApiException):
|
|
|
128
127
|
self.body = http_resp.data.decode('utf-8')
|
|
129
128
|
except Exception:
|
|
130
129
|
pass
|
|
131
|
-
self.headers = http_resp.
|
|
130
|
+
self.headers = http_resp.headers
|
|
132
131
|
|
|
133
132
|
@classmethod
|
|
134
133
|
def from_response(
|
|
@@ -150,6 +149,13 @@ class ApiException(OpenApiException):
|
|
|
150
149
|
if http_resp.status == 404:
|
|
151
150
|
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
152
151
|
|
|
152
|
+
# Added new conditions for 409 and 422
|
|
153
|
+
if http_resp.status == 409:
|
|
154
|
+
raise ConflictException(http_resp=http_resp, body=body, data=data)
|
|
155
|
+
|
|
156
|
+
if http_resp.status == 422:
|
|
157
|
+
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
|
|
158
|
+
|
|
153
159
|
if 500 <= http_resp.status <= 599:
|
|
154
160
|
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
155
161
|
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
@@ -162,8 +168,11 @@ class ApiException(OpenApiException):
|
|
|
162
168
|
error_message += "HTTP response headers: {0}\n".format(
|
|
163
169
|
self.headers)
|
|
164
170
|
|
|
165
|
-
if self.
|
|
166
|
-
error_message += "HTTP response body: {0}\n".format(self.
|
|
171
|
+
if self.body:
|
|
172
|
+
error_message += "HTTP response body: {0}\n".format(self.body)
|
|
173
|
+
|
|
174
|
+
if self.data:
|
|
175
|
+
error_message += "HTTP response data: {0}\n".format(self.data)
|
|
167
176
|
|
|
168
177
|
return error_message
|
|
169
178
|
|
|
@@ -188,6 +197,16 @@ class ServiceException(ApiException):
|
|
|
188
197
|
pass
|
|
189
198
|
|
|
190
199
|
|
|
200
|
+
class ConflictException(ApiException):
|
|
201
|
+
"""Exception for HTTP 409 Conflict."""
|
|
202
|
+
pass
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class UnprocessableEntityException(ApiException):
|
|
206
|
+
"""Exception for HTTP 422 Unprocessable Entity."""
|
|
207
|
+
pass
|
|
208
|
+
|
|
209
|
+
|
|
191
210
|
def render_path(path_to_item):
|
|
192
211
|
"""Returns a string representation of a path"""
|
|
193
212
|
result = ""
|