lightning-sdk 0.2.20__py3-none-any.whl → 0.2.21__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 (34) hide show
  1. lightning_sdk/__init__.py +1 -1
  2. lightning_sdk/api/deployment_api.py +7 -2
  3. lightning_sdk/api/license_api.py +3 -3
  4. lightning_sdk/api/llm_api.py +118 -26
  5. lightning_sdk/api/studio_api.py +5 -0
  6. lightning_sdk/cli/configure.py +34 -27
  7. lightning_sdk/cli/connect.py +2 -2
  8. lightning_sdk/deployment/deployment.py +17 -3
  9. lightning_sdk/lightning_cloud/openapi/__init__.py +0 -1
  10. lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +1 -5
  11. lightning_sdk/lightning_cloud/openapi/api/endpoint_service_api.py +11 -1
  12. lightning_sdk/lightning_cloud/openapi/api/user_service_api.py +0 -85
  13. lightning_sdk/lightning_cloud/openapi/models/__init__.py +0 -1
  14. lightning_sdk/lightning_cloud/openapi/models/update.py +79 -1
  15. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_template.py +53 -1
  16. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_template_config.py +27 -1
  17. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_deletion_options.py +27 -1
  18. lightning_sdk/lightning_cloud/openapi/models/v1_create_cloud_space_environment_template_request.py +79 -1
  19. lightning_sdk/lightning_cloud/openapi/models/v1_create_project_request.py +79 -1
  20. lightning_sdk/lightning_cloud/openapi/models/v1_get_user_response.py +79 -1
  21. lightning_sdk/lightning_cloud/openapi/models/v1_message.py +53 -1
  22. lightning_sdk/lightning_cloud/openapi/models/v1_routing_telemetry.py +27 -1
  23. lightning_sdk/lightning_cloud/openapi/models/v1_update_user_request.py +79 -1
  24. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +27 -365
  25. lightning_sdk/llm/llm.py +52 -1
  26. lightning_sdk/pipeline/pipeline.py +1 -1
  27. lightning_sdk/services/utilities.py +15 -1
  28. {lightning_sdk-0.2.20.dist-info → lightning_sdk-0.2.21.dist-info}/METADATA +1 -1
  29. {lightning_sdk-0.2.20.dist-info → lightning_sdk-0.2.21.dist-info}/RECORD +33 -34
  30. lightning_sdk/lightning_cloud/openapi/models/v1_get_user_storage_response.py +0 -201
  31. {lightning_sdk-0.2.20.dist-info → lightning_sdk-0.2.21.dist-info}/LICENSE +0 -0
  32. {lightning_sdk-0.2.20.dist-info → lightning_sdk-0.2.21.dist-info}/WHEEL +0 -0
  33. {lightning_sdk-0.2.20.dist-info → lightning_sdk-0.2.21.dist-info}/entry_points.txt +0 -0
  34. {lightning_sdk-0.2.20.dist-info → lightning_sdk-0.2.21.dist-info}/top_level.txt +0 -0
lightning_sdk/__init__.py CHANGED
@@ -31,6 +31,6 @@ __all__ = [
31
31
  "User",
32
32
  ]
33
33
 
34
- __version__ = "0.2.20"
34
+ __version__ = "0.2.21"
35
35
  _check_version_and_prompt_upgrade(__version__)
36
36
  _set_tqdm_envvars_noninteractive()
@@ -282,10 +282,11 @@ class DeploymentApi:
282
282
 
283
283
  requires_release = False
284
284
  requires_release |= apply_change(deployment.spec, "image", image)
285
+
285
286
  requires_release |= apply_change(deployment.spec, "entrypoint", entrypoint)
286
287
  requires_release |= apply_change(deployment.spec, "command", command)
287
288
  requires_release |= apply_change(deployment.spec, "env", to_env(env))
288
- requires_release |= apply_change(deployment.spec, "readiness_probe", to_health_check(health_check))
289
+ requires_release |= apply_change(deployment.spec, "readiness_probe", to_health_check(health_check, False))
289
290
  requires_release |= apply_change(deployment.spec, "cluster_id", cloud_account)
290
291
  requires_release |= apply_change(deployment.spec, "spot", spot)
291
292
  requires_release |= apply_change(deployment.spec, "quantity", quantity)
@@ -524,8 +525,12 @@ def to_endpoint(
524
525
 
525
526
 
526
527
  def to_health_check(
527
- health_check: Optional[Union[HttpHealthCheck, ExecHealthCheck]] = None
528
+ health_check: Optional[Union[HttpHealthCheck, ExecHealthCheck]] = None,
529
+ use_default: bool = True,
528
530
  ) -> Optional[V1JobHealthCheckConfig]:
531
+ if health_check is None and not use_default:
532
+ return None
533
+
529
534
  # Use Default health check if none is provided
530
535
  if not health_check:
531
536
  return V1JobHealthCheckConfig(
@@ -5,13 +5,13 @@ from urllib.parse import urlencode
5
5
  from lightning_sdk.lightning_cloud import env
6
6
  from lightning_sdk.lightning_cloud.rest_client import LightningClient
7
7
 
8
- LICENSE_CODE = os.environ.get("LICENSE_CODE", "we843fiji89")
8
+ LICENSE_CODE = os.environ.get("LICENSE_CODE", "d9s79g79ss")
9
9
  # https://lightning.ai/home?settings=licenses
10
- LICENSE_SIGNING_URL = f"{env.LIGHTNING_CLOUD_URL}/ai-hub?settings=licenses"
10
+ LICENSE_SIGNING_URL = f"{env.LIGHTNING_CLOUD_URL}?settings=licenses"
11
11
 
12
12
 
13
13
  def generate_url_user_settings(redirect_to: str = LICENSE_SIGNING_URL) -> str:
14
- params = urlencode({"redirectTo": redirect_to, "mode": "licenses", "okbhrt": LICENSE_CODE})
14
+ params = urlencode({"redirectTo": redirect_to, "okbhrt": LICENSE_CODE})
15
15
  return f"{env.LIGHTNING_CLOUD_URL}/sign-in?{params}"
16
16
 
17
17
 
@@ -1,7 +1,10 @@
1
+ import asyncio
1
2
  import base64
2
3
  import json
3
4
  import os
4
- from typing import Dict, Generator, List, Optional, Union
5
+ import threading
6
+ import warnings
7
+ from typing import Any, AsyncGenerator, Dict, Generator, List, Optional, Union
5
8
 
6
9
  from pip._vendor.urllib3 import HTTPResponse
7
10
 
@@ -27,35 +30,40 @@ class LLMApi:
27
30
  result = self._client.assistants_service_list_assistants(user_id=user_id)
28
31
  return result.assistants
29
32
 
33
+ def _parse_stream_line(self, decoded_line: str) -> Optional[V1ConversationResponseChunk]:
34
+ try:
35
+ payload = json.loads(decoded_line)
36
+ result_data = payload.get("result", {})
37
+
38
+ choices = []
39
+ for choice in result_data.get("choices", []):
40
+ delta = choice.get("delta", {})
41
+ choices.append(
42
+ V1ResponseChoice(
43
+ delta=V1ResponseChoiceDelta(**delta),
44
+ finish_reason=choice.get("finishReason"),
45
+ index=choice.get("index"),
46
+ )
47
+ )
48
+
49
+ return V1ConversationResponseChunk(
50
+ choices=choices,
51
+ conversation_id=result_data.get("conversationId"),
52
+ executable=result_data.get("executable"),
53
+ id=result_data.get("id"),
54
+ throughput=result_data.get("throughput"),
55
+ )
56
+ except json.JSONDecodeError:
57
+ warnings.warn("Error decoding JSON:", decoded_line)
58
+ return None
59
+
30
60
  def _stream_chat_response(self, result: HTTPResponse) -> Generator[V1ConversationResponseChunk, None, None]:
31
61
  for line in result.stream():
32
62
  decoded_lines = line.decode("utf-8").strip()
33
63
  for decoded_line in decoded_lines.splitlines():
34
- try:
35
- payload = json.loads(decoded_line)
36
- result_data = payload.get("result", {})
37
-
38
- choices = []
39
- for choice in result_data.get("choices", []):
40
- delta = choice.get("delta", {})
41
- choices.append(
42
- V1ResponseChoice(
43
- delta=V1ResponseChoiceDelta(**delta),
44
- finish_reason=choice.get("finishReason"),
45
- index=choice.get("index"),
46
- )
47
- )
48
-
49
- yield V1ConversationResponseChunk(
50
- choices=choices,
51
- conversation_id=result_data.get("conversationId"),
52
- executable=result_data.get("executable"),
53
- id=result_data.get("id"),
54
- throughput=result_data.get("throughput"),
55
- )
56
-
57
- except json.JSONDecodeError:
58
- print("Error decoding JSON:", decoded_line)
64
+ chunk = self._parse_stream_line(decoded_line)
65
+ if chunk:
66
+ yield chunk
59
67
 
60
68
  def _encode_image_bytes_to_data_url(self, image: str) -> str:
61
69
  with open(image, "rb") as image_file:
@@ -110,6 +118,90 @@ class LLMApi:
110
118
  return result.result
111
119
  return self._stream_chat_response(result)
112
120
 
121
+ async def async_start_conversation(
122
+ self,
123
+ prompt: str,
124
+ system_prompt: Optional[str],
125
+ max_completion_tokens: int,
126
+ assistant_id: str,
127
+ images: Optional[List[str]] = None,
128
+ conversation_id: Optional[str] = None,
129
+ billing_project_id: Optional[str] = None,
130
+ name: Optional[str] = None,
131
+ metadata: Optional[Dict[str, str]] = None,
132
+ stream: bool = False,
133
+ ) -> Union[V1ConversationResponseChunk, AsyncGenerator[V1ConversationResponseChunk, None]]:
134
+ is_internal_conversation = os.getenv("LIGHTNING_INTERNAL_CONVERSATION", "false").lower() == "true"
135
+ body = {
136
+ "message": {
137
+ "author": {"role": "user"},
138
+ "content": [
139
+ {"contentType": "text", "parts": [prompt]},
140
+ ],
141
+ },
142
+ "max_completion_tokens": max_completion_tokens,
143
+ "conversation_id": conversation_id,
144
+ "billing_project_id": billing_project_id,
145
+ "name": name,
146
+ "stream": stream,
147
+ "metadata": metadata or {},
148
+ "internal_conversation": is_internal_conversation,
149
+ }
150
+ if images:
151
+ for image in images:
152
+ url = image
153
+ if not image.startswith("http"):
154
+ url = self._encode_image_bytes_to_data_url(image)
155
+
156
+ body["message"]["content"].append(
157
+ {
158
+ "contentType": "image",
159
+ "parts": [url],
160
+ }
161
+ )
162
+
163
+ if not stream:
164
+ thread = await asyncio.to_thread(
165
+ self._client.assistants_service_start_conversation, body, assistant_id, async_req=True
166
+ )
167
+ result = await asyncio.to_thread(thread.get)
168
+ return result.result
169
+
170
+ conversation_thread = await asyncio.to_thread(
171
+ self._client.assistants_service_start_conversation,
172
+ body,
173
+ assistant_id,
174
+ async_req=True,
175
+ _preload_content=False,
176
+ )
177
+
178
+ return self.stream_response(conversation_thread)
179
+
180
+ async def stream_response(self, thread: Any) -> AsyncGenerator[V1ConversationResponseChunk, None]:
181
+ loop = asyncio.get_event_loop()
182
+ response = await asyncio.to_thread(thread.get)
183
+
184
+ queue = asyncio.Queue()
185
+
186
+ def enqueue() -> None:
187
+ try:
188
+ for line in response:
189
+ decoded_lines = line.decode("utf-8").strip()
190
+ for decoded_line in decoded_lines.splitlines():
191
+ chunk = self._parse_stream_line(decoded_line)
192
+ if chunk:
193
+ asyncio.run_coroutine_threadsafe(queue.put(chunk), loop)
194
+ finally:
195
+ asyncio.run_coroutine_threadsafe(queue.put(None), loop)
196
+
197
+ threading.Thread(target=enqueue, daemon=True).start()
198
+
199
+ while True:
200
+ item = await queue.get()
201
+ if item is None:
202
+ break
203
+ yield item
204
+
113
205
  def list_conversations(self, assistant_id: str) -> List[str]:
114
206
  result = self._client.assistants_service_list_conversations(assistant_id)
115
207
  return result.conversations
@@ -154,6 +154,11 @@ class StudioApi:
154
154
  @backoff.on_exception(backoff.expo, AttributeError, max_tries=10)
155
155
  def _check_code_status_top_up_restore_finished(self, studio_id: str, teamspace_id: str) -> bool:
156
156
  """Retries checking the top_up_restore_finished value of the code status when there's an AttributeError."""
157
+ if (
158
+ self.get_studio_status(studio_id, teamspace_id) is None
159
+ or self.get_studio_status(studio_id, teamspace_id).in_use is None
160
+ ):
161
+ return False
157
162
  startup_status = self.get_studio_status(studio_id, teamspace_id).in_use.startup_status
158
163
  return startup_status and startup_status.top_up_restore_finished
159
164
 
@@ -17,33 +17,10 @@ def configure() -> None:
17
17
  """Configure access to resources on the Lightning AI platform."""
18
18
 
19
19
 
20
- @configure.command(name="ssh")
21
- @click.option(
22
- "--name",
23
- default=None,
24
- help=(
25
- "The name of the studio to obtain SSH config. "
26
- "If not specified, tries to infer from the environment (e.g. when run from within a Studio.)"
27
- ),
28
- )
29
- @click.option(
30
- "--teamspace",
31
- default=None,
32
- help=(
33
- "The teamspace the studio is part of. "
34
- "Should be of format <OWNER>/<TEAMSPACE_NAME>. "
35
- "If not specified, tries to infer from the environment (e.g. when run from within a Studio.)"
36
- ),
37
- )
38
- @click.option(
39
- "--overwrite",
40
- is_flag=True,
41
- flag_value=True,
42
- default=False,
43
- help="Whether to overwrite the SSH key and config if they already exist.",
44
- )
45
- def ssh(name: Optional[str] = None, teamspace: Optional[str] = None, overwrite: bool = False) -> None:
46
- """Get SSH config entry for a studio."""
20
+ def _configure_ssh_internal(
21
+ name: Optional[str] = None, teamspace: Optional[str] = None, overwrite: bool = False
22
+ ) -> None:
23
+ """Internal function to configure SSH without Click decorators."""
47
24
  auth = Auth()
48
25
  auth.authenticate()
49
26
  console = Console()
@@ -78,6 +55,36 @@ def ssh(name: Optional[str] = None, teamspace: Optional[str] = None, overwrite:
78
55
  console.print(f"SSH config updated at {config_path}")
79
56
 
80
57
 
58
+ @configure.command(name="ssh")
59
+ @click.option(
60
+ "--name",
61
+ default=None,
62
+ help=(
63
+ "The name of the studio to obtain SSH config. "
64
+ "If not specified, tries to infer from the environment (e.g. when run from within a Studio.)"
65
+ ),
66
+ )
67
+ @click.option(
68
+ "--teamspace",
69
+ default=None,
70
+ help=(
71
+ "The teamspace the studio is part of. "
72
+ "Should be of format <OWNER>/<TEAMSPACE_NAME>. "
73
+ "If not specified, tries to infer from the environment (e.g. when run from within a Studio.)"
74
+ ),
75
+ )
76
+ @click.option(
77
+ "--overwrite",
78
+ is_flag=True,
79
+ flag_value=True,
80
+ default=False,
81
+ help="Whether to overwrite the SSH key and config if they already exist.",
82
+ )
83
+ def ssh(name: Optional[str] = None, teamspace: Optional[str] = None, overwrite: bool = False) -> None:
84
+ """Get SSH config entry for a studio."""
85
+ _configure_ssh_internal(name=name, teamspace=teamspace, overwrite=overwrite)
86
+
87
+
81
88
  def _download_file(url: str, local_path: Path, overwrite: bool = True, chmod: Optional[int] = None) -> None:
82
89
  """Download a file from a URL."""
83
90
  import requests
@@ -4,7 +4,7 @@ from typing import Optional
4
4
 
5
5
  import click
6
6
 
7
- from lightning_sdk.cli.configure import ssh as configure_ssh
7
+ from lightning_sdk.cli.configure import _configure_ssh_internal
8
8
  from lightning_sdk.cli.studios_menu import _StudiosMenu
9
9
 
10
10
 
@@ -22,7 +22,7 @@ def connect() -> None:
22
22
  )
23
23
  def studio(name: Optional[str], teamspace: Optional[str]) -> None:
24
24
  """Connect to a studio via SSH."""
25
- configure_ssh(name=name, teamspace=teamspace, overwrite=False)
25
+ _configure_ssh_internal(name=name, teamspace=teamspace, overwrite=False)
26
26
 
27
27
  menu = _StudiosMenu()
28
28
  studio = menu._get_studio(name=name, teamspace=teamspace)
@@ -276,8 +276,8 @@ class Deployment:
276
276
  cloud_account=cloud_account,
277
277
  machine=machine,
278
278
  image=image,
279
- entrypoint=entrypoint or "",
280
- command=command or "",
279
+ entrypoint=entrypoint,
280
+ command=command,
281
281
  ports=ports,
282
282
  custom_domain=custom_domain,
283
283
  auth=auth,
@@ -340,7 +340,7 @@ class Deployment:
340
340
  return None
341
341
 
342
342
  @property
343
- def readiness_probe(self) -> Optional[Union[HttpHealthCheck, ExecHealthCheck]]:
343
+ def health_check(self) -> Optional[Union[HttpHealthCheck, ExecHealthCheck]]:
344
344
  """The health check to validate the replicas are ready to receive traffic."""
345
345
  if self._deployment:
346
346
  self._deployment = self._deployment_api.get_deployment_by_name(self._name, self._teamspace.id)
@@ -467,6 +467,20 @@ class Deployment:
467
467
  return self._deployment.spec.image
468
468
  return None
469
469
 
470
+ @property
471
+ def entrypoint(self) -> Optional[str]:
472
+ if self._deployment:
473
+ self._deployment = self._deployment_api.get_deployment_by_name(self._name, self._teamspace.id)
474
+ return self._deployment.spec.entrypoint
475
+ return None
476
+
477
+ @property
478
+ def command(self) -> Optional[str]:
479
+ if self._deployment:
480
+ self._deployment = self._deployment_api.get_deployment_by_name(self._name, self._teamspace.id)
481
+ return self._deployment.spec.command
482
+ return None
483
+
470
484
  @property
471
485
  def _session(self) -> Any:
472
486
  if self._request_session is None:
@@ -563,7 +563,6 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_balance_response i
563
563
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_notification_preferences_response import V1GetUserNotificationPreferencesResponse
564
564
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_response import V1GetUserResponse
565
565
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_storage_breakdown_response import V1GetUserStorageBreakdownResponse
566
- from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_storage_response import V1GetUserStorageResponse
567
566
  from lightning_sdk.lightning_cloud.openapi.models.v1_git_credentials import V1GitCredentials
568
567
  from lightning_sdk.lightning_cloud.openapi.models.v1_google_cloud_direct_v1 import V1GoogleCloudDirectV1
569
568
  from lightning_sdk.lightning_cloud.openapi.models.v1_google_cloud_direct_v1_status import V1GoogleCloudDirectV1Status
@@ -2726,7 +2726,6 @@ class ClusterServiceApi(object):
2726
2726
  >>> result = thread.get()
2727
2727
 
2728
2728
  :param async_req bool
2729
- :param bool include_pricing:
2730
2729
  :param str cloud_provider:
2731
2730
  :param str project_id:
2732
2731
  :return: V1ListDefaultClusterAcceleratorsResponse
@@ -2749,7 +2748,6 @@ class ClusterServiceApi(object):
2749
2748
  >>> result = thread.get()
2750
2749
 
2751
2750
  :param async_req bool
2752
- :param bool include_pricing:
2753
2751
  :param str cloud_provider:
2754
2752
  :param str project_id:
2755
2753
  :return: V1ListDefaultClusterAcceleratorsResponse
@@ -2757,7 +2755,7 @@ class ClusterServiceApi(object):
2757
2755
  returns the request thread.
2758
2756
  """
2759
2757
 
2760
- all_params = ['include_pricing', 'cloud_provider', 'project_id'] # noqa: E501
2758
+ all_params = ['cloud_provider', 'project_id'] # noqa: E501
2761
2759
  all_params.append('async_req')
2762
2760
  all_params.append('_return_http_data_only')
2763
2761
  all_params.append('_preload_content')
@@ -2778,8 +2776,6 @@ class ClusterServiceApi(object):
2778
2776
  path_params = {}
2779
2777
 
2780
2778
  query_params = []
2781
- if 'include_pricing' in params:
2782
- query_params.append(('includePricing', params['include_pricing'])) # noqa: E501
2783
2779
  if 'cloud_provider' in params:
2784
2780
  query_params.append(('cloudProvider', params['cloud_provider'])) # noqa: E501
2785
2781
  if 'project_id' in params:
@@ -1420,6 +1420,8 @@ class EndpointServiceApi(object):
1420
1420
  :param list[str] ids:
1421
1421
  :param bool active_cloudspaces:
1422
1422
  :param bool active_jobs:
1423
+ :param list[str] cloudspace_ids:
1424
+ :param list[str] job_ids:
1423
1425
  :return: V1ListEndpointsResponse
1424
1426
  If the method is called asynchronously,
1425
1427
  returns the request thread.
@@ -1447,12 +1449,14 @@ class EndpointServiceApi(object):
1447
1449
  :param list[str] ids:
1448
1450
  :param bool active_cloudspaces:
1449
1451
  :param bool active_jobs:
1452
+ :param list[str] cloudspace_ids:
1453
+ :param list[str] job_ids:
1450
1454
  :return: V1ListEndpointsResponse
1451
1455
  If the method is called asynchronously,
1452
1456
  returns the request thread.
1453
1457
  """
1454
1458
 
1455
- all_params = ['project_id', 'cloudspace_id', 'auto_start', 'cluster_id', 'ids', 'active_cloudspaces', 'active_jobs'] # noqa: E501
1459
+ all_params = ['project_id', 'cloudspace_id', 'auto_start', 'cluster_id', 'ids', 'active_cloudspaces', 'active_jobs', 'cloudspace_ids', 'job_ids'] # noqa: E501
1456
1460
  all_params.append('async_req')
1457
1461
  all_params.append('_return_http_data_only')
1458
1462
  all_params.append('_preload_content')
@@ -1492,6 +1496,12 @@ class EndpointServiceApi(object):
1492
1496
  query_params.append(('activeCloudspaces', params['active_cloudspaces'])) # noqa: E501
1493
1497
  if 'active_jobs' in params:
1494
1498
  query_params.append(('activeJobs', params['active_jobs'])) # noqa: E501
1499
+ if 'cloudspace_ids' in params:
1500
+ query_params.append(('cloudspaceIds', params['cloudspace_ids'])) # noqa: E501
1501
+ collection_formats['cloudspaceIds'] = 'multi' # noqa: E501
1502
+ if 'job_ids' in params:
1503
+ query_params.append(('jobIds', params['job_ids'])) # noqa: E501
1504
+ collection_formats['jobIds'] = 'multi' # noqa: E501
1495
1505
 
1496
1506
  header_params = {}
1497
1507
 
@@ -706,91 +706,6 @@ class UserServiceApi(object):
706
706
  _request_timeout=params.get('_request_timeout'),
707
707
  collection_formats=collection_formats)
708
708
 
709
- def user_service_get_user_storage(self, **kwargs) -> 'V1GetUserStorageResponse': # noqa: E501
710
- """user_service_get_user_storage # noqa: E501
711
-
712
- This method makes a synchronous HTTP request by default. To make an
713
- asynchronous HTTP request, please pass async_req=True
714
- >>> thread = api.user_service_get_user_storage(async_req=True)
715
- >>> result = thread.get()
716
-
717
- :param async_req bool
718
- :return: V1GetUserStorageResponse
719
- If the method is called asynchronously,
720
- returns the request thread.
721
- """
722
- kwargs['_return_http_data_only'] = True
723
- if kwargs.get('async_req'):
724
- return self.user_service_get_user_storage_with_http_info(**kwargs) # noqa: E501
725
- else:
726
- (data) = self.user_service_get_user_storage_with_http_info(**kwargs) # noqa: E501
727
- return data
728
-
729
- def user_service_get_user_storage_with_http_info(self, **kwargs) -> 'V1GetUserStorageResponse': # noqa: E501
730
- """user_service_get_user_storage # noqa: E501
731
-
732
- This method makes a synchronous HTTP request by default. To make an
733
- asynchronous HTTP request, please pass async_req=True
734
- >>> thread = api.user_service_get_user_storage_with_http_info(async_req=True)
735
- >>> result = thread.get()
736
-
737
- :param async_req bool
738
- :return: V1GetUserStorageResponse
739
- If the method is called asynchronously,
740
- returns the request thread.
741
- """
742
-
743
- all_params = [] # noqa: E501
744
- all_params.append('async_req')
745
- all_params.append('_return_http_data_only')
746
- all_params.append('_preload_content')
747
- all_params.append('_request_timeout')
748
-
749
- params = locals()
750
- for key, val in six.iteritems(params['kwargs']):
751
- if key not in all_params:
752
- raise TypeError(
753
- "Got an unexpected keyword argument '%s'"
754
- " to method user_service_get_user_storage" % key
755
- )
756
- params[key] = val
757
- del params['kwargs']
758
-
759
- collection_formats = {}
760
-
761
- path_params = {}
762
-
763
- query_params = []
764
-
765
- header_params = {}
766
-
767
- form_params = []
768
- local_var_files = {}
769
-
770
- body_params = None
771
- # HTTP header `Accept`
772
- header_params['Accept'] = self.api_client.select_header_accept(
773
- ['application/json']) # noqa: E501
774
-
775
- # Authentication setting
776
- auth_settings = [] # noqa: E501
777
-
778
- return self.api_client.call_api(
779
- '/v1/users/storage', 'GET',
780
- path_params,
781
- query_params,
782
- header_params,
783
- body=body_params,
784
- post_params=form_params,
785
- files=local_var_files,
786
- response_type='V1GetUserStorageResponse', # noqa: E501
787
- auth_settings=auth_settings,
788
- async_req=params.get('async_req'),
789
- _return_http_data_only=params.get('_return_http_data_only'),
790
- _preload_content=params.get('_preload_content', True),
791
- _request_timeout=params.get('_request_timeout'),
792
- collection_formats=collection_formats)
793
-
794
709
  def user_service_get_user_storage_breakdown(self, **kwargs) -> 'V1GetUserStorageBreakdownResponse': # noqa: E501
795
710
  """user_service_get_user_storage_breakdown # noqa: E501
796
711
 
@@ -518,7 +518,6 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_balance_response i
518
518
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_notification_preferences_response import V1GetUserNotificationPreferencesResponse
519
519
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_response import V1GetUserResponse
520
520
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_storage_breakdown_response import V1GetUserStorageBreakdownResponse
521
- from lightning_sdk.lightning_cloud.openapi.models.v1_get_user_storage_response import V1GetUserStorageResponse
522
521
  from lightning_sdk.lightning_cloud.openapi.models.v1_git_credentials import V1GitCredentials
523
522
  from lightning_sdk.lightning_cloud.openapi.models.v1_google_cloud_direct_v1 import V1GoogleCloudDirectV1
524
523
  from lightning_sdk.lightning_cloud.openapi.models.v1_google_cloud_direct_v1_status import V1GoogleCloudDirectV1Status