lightning-sdk 0.2.19__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 (62) 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 +28 -6
  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/cli/deploy/_auth.py +11 -19
  9. lightning_sdk/cli/entrypoint.py +20 -2
  10. lightning_sdk/deployment/deployment.py +17 -3
  11. lightning_sdk/lightning_cloud/login.py +2 -2
  12. lightning_sdk/lightning_cloud/openapi/__init__.py +2 -3
  13. lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +1 -5
  14. lightning_sdk/lightning_cloud/openapi/api/endpoint_service_api.py +11 -1
  15. lightning_sdk/lightning_cloud/openapi/api/jobs_service_api.py +121 -0
  16. lightning_sdk/lightning_cloud/openapi/api/user_service_api.py +0 -85
  17. lightning_sdk/lightning_cloud/openapi/models/__init__.py +2 -3
  18. lightning_sdk/lightning_cloud/openapi/models/alertingevents_id_body.py +409 -0
  19. lightning_sdk/lightning_cloud/openapi/models/id_codeconfig_body.py +29 -3
  20. lightning_sdk/lightning_cloud/openapi/models/update.py +105 -1
  21. lightning_sdk/lightning_cloud/openapi/models/v1_author.py +201 -0
  22. lightning_sdk/lightning_cloud/openapi/models/v1_blog_post.py +53 -1
  23. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space.py +27 -1
  24. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_template.py +53 -1
  25. lightning_sdk/lightning_cloud/openapi/models/v1_cloud_space_environment_template_config.py +27 -1
  26. lightning_sdk/lightning_cloud/openapi/models/v1_cluster_deletion_options.py +27 -1
  27. lightning_sdk/lightning_cloud/openapi/models/v1_create_cloud_space_environment_template_request.py +105 -1
  28. lightning_sdk/lightning_cloud/openapi/models/v1_create_project_request.py +79 -1
  29. lightning_sdk/lightning_cloud/openapi/models/v1_data_connection.py +79 -1
  30. lightning_sdk/lightning_cloud/openapi/models/v1_deployment_alerting_policy_type.py +1 -0
  31. lightning_sdk/lightning_cloud/openapi/models/v1_get_organization_storage_metadata_response.py +79 -1
  32. lightning_sdk/lightning_cloud/openapi/models/v1_get_project_storage_metadata_response.py +105 -1
  33. lightning_sdk/lightning_cloud/openapi/models/v1_get_user_response.py +79 -1
  34. lightning_sdk/lightning_cloud/openapi/models/v1_get_user_storage_breakdown_response.py +27 -1
  35. lightning_sdk/lightning_cloud/openapi/models/v1_membership.py +27 -1
  36. lightning_sdk/lightning_cloud/openapi/models/v1_message.py +53 -1
  37. lightning_sdk/lightning_cloud/openapi/models/v1_notification_type.py +1 -0
  38. lightning_sdk/lightning_cloud/openapi/models/v1_organization.py +105 -1
  39. lightning_sdk/lightning_cloud/openapi/models/v1_project_storage.py +131 -1
  40. lightning_sdk/lightning_cloud/openapi/models/v1_routing_telemetry.py +27 -1
  41. lightning_sdk/lightning_cloud/openapi/models/v1_storage_asset.py +27 -1
  42. lightning_sdk/lightning_cloud/openapi/models/v1_storage_asset_type.py +2 -0
  43. lightning_sdk/lightning_cloud/openapi/models/v1_transaction.py +27 -1
  44. lightning_sdk/lightning_cloud/openapi/models/v1_update_user_request.py +79 -1
  45. lightning_sdk/lightning_cloud/openapi/models/v1_usage.py +27 -27
  46. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +79 -443
  47. lightning_sdk/lightning_cloud/openapi/models/v1_volume.py +499 -31
  48. lightning_sdk/lightning_cloud/rest_client.py +13 -11
  49. lightning_sdk/lightning_cloud/source_code/logs_socket_api.py +8 -3
  50. lightning_sdk/llm/llm.py +52 -1
  51. lightning_sdk/pipeline/pipeline.py +1 -1
  52. lightning_sdk/services/license.py +78 -22
  53. lightning_sdk/services/utilities.py +15 -1
  54. {lightning_sdk-0.2.19.dist-info → lightning_sdk-0.2.21.dist-info}/METADATA +1 -1
  55. {lightning_sdk-0.2.19.dist-info → lightning_sdk-0.2.21.dist-info}/RECORD +59 -60
  56. lightning_sdk/lightning_cloud/openapi/models/v1_ebs.py +0 -279
  57. lightning_sdk/lightning_cloud/openapi/models/v1_get_user_storage_response.py +0 -201
  58. lightning_sdk/lightning_cloud/openapi/models/v1_reservation_billing_session.py +0 -279
  59. {lightning_sdk-0.2.19.dist-info → lightning_sdk-0.2.21.dist-info}/LICENSE +0 -0
  60. {lightning_sdk-0.2.19.dist-info → lightning_sdk-0.2.21.dist-info}/WHEEL +0 -0
  61. {lightning_sdk-0.2.19.dist-info → lightning_sdk-0.2.21.dist-info}/entry_points.txt +0 -0
  62. {lightning_sdk-0.2.19.dist-info → lightning_sdk-0.2.21.dist-info}/top_level.txt +0 -0
@@ -41,50 +41,245 @@ class V1Volume(object):
41
41
  and the value is json key in definition.
42
42
  """
43
43
  swagger_types = {
44
- 'ebs': 'V1Ebs',
44
+ 'attached_at': 'datetime',
45
+ 'availability_zone': 'str',
46
+ 'cluster_id': 'str',
47
+ 'created_at': 'datetime',
48
+ 'detached_at': 'datetime',
49
+ 'encrypted': 'bool',
45
50
  'id': 'str',
46
- 'spec_id': 'str'
51
+ 'iops': 'str',
52
+ 'path': 'str',
53
+ 'project_id': 'str',
54
+ 'provider': 'str',
55
+ 'provider_id': 'str',
56
+ 'region': 'str',
57
+ 'resource_id': 'str',
58
+ 'resource_type': 'str',
59
+ 'server_id': 'str',
60
+ 'size_gb': 'str',
61
+ 'throughput': 'str',
62
+ 'type': 'str',
63
+ 'updated_at': 'datetime',
64
+ 'user_id': 'str'
47
65
  }
48
66
 
49
67
  attribute_map = {
50
- 'ebs': 'ebs',
68
+ 'attached_at': 'attachedAt',
69
+ 'availability_zone': 'availabilityZone',
70
+ 'cluster_id': 'clusterId',
71
+ 'created_at': 'createdAt',
72
+ 'detached_at': 'detachedAt',
73
+ 'encrypted': 'encrypted',
51
74
  'id': 'id',
52
- 'spec_id': 'specId'
75
+ 'iops': 'iops',
76
+ 'path': 'path',
77
+ 'project_id': 'projectId',
78
+ 'provider': 'provider',
79
+ 'provider_id': 'providerId',
80
+ 'region': 'region',
81
+ 'resource_id': 'resourceId',
82
+ 'resource_type': 'resourceType',
83
+ 'server_id': 'serverId',
84
+ 'size_gb': 'sizeGb',
85
+ 'throughput': 'throughput',
86
+ 'type': 'type',
87
+ 'updated_at': 'updatedAt',
88
+ 'user_id': 'userId'
53
89
  }
54
90
 
55
- def __init__(self, ebs: 'V1Ebs' =None, id: 'str' =None, spec_id: 'str' =None): # noqa: E501
91
+ def __init__(self, attached_at: 'datetime' =None, availability_zone: 'str' =None, cluster_id: 'str' =None, created_at: 'datetime' =None, detached_at: 'datetime' =None, encrypted: 'bool' =None, id: 'str' =None, iops: 'str' =None, path: 'str' =None, project_id: 'str' =None, provider: 'str' =None, provider_id: 'str' =None, region: 'str' =None, resource_id: 'str' =None, resource_type: 'str' =None, server_id: 'str' =None, size_gb: 'str' =None, throughput: 'str' =None, type: 'str' =None, updated_at: 'datetime' =None, user_id: 'str' =None): # noqa: E501
56
92
  """V1Volume - a model defined in Swagger""" # noqa: E501
57
- self._ebs = None
93
+ self._attached_at = None
94
+ self._availability_zone = None
95
+ self._cluster_id = None
96
+ self._created_at = None
97
+ self._detached_at = None
98
+ self._encrypted = None
58
99
  self._id = None
59
- self._spec_id = None
100
+ self._iops = None
101
+ self._path = None
102
+ self._project_id = None
103
+ self._provider = None
104
+ self._provider_id = None
105
+ self._region = None
106
+ self._resource_id = None
107
+ self._resource_type = None
108
+ self._server_id = None
109
+ self._size_gb = None
110
+ self._throughput = None
111
+ self._type = None
112
+ self._updated_at = None
113
+ self._user_id = None
60
114
  self.discriminator = None
61
- if ebs is not None:
62
- self.ebs = ebs
115
+ if attached_at is not None:
116
+ self.attached_at = attached_at
117
+ if availability_zone is not None:
118
+ self.availability_zone = availability_zone
119
+ if cluster_id is not None:
120
+ self.cluster_id = cluster_id
121
+ if created_at is not None:
122
+ self.created_at = created_at
123
+ if detached_at is not None:
124
+ self.detached_at = detached_at
125
+ if encrypted is not None:
126
+ self.encrypted = encrypted
63
127
  if id is not None:
64
128
  self.id = id
65
- if spec_id is not None:
66
- self.spec_id = spec_id
129
+ if iops is not None:
130
+ self.iops = iops
131
+ if path is not None:
132
+ self.path = path
133
+ if project_id is not None:
134
+ self.project_id = project_id
135
+ if provider is not None:
136
+ self.provider = provider
137
+ if provider_id is not None:
138
+ self.provider_id = provider_id
139
+ if region is not None:
140
+ self.region = region
141
+ if resource_id is not None:
142
+ self.resource_id = resource_id
143
+ if resource_type is not None:
144
+ self.resource_type = resource_type
145
+ if server_id is not None:
146
+ self.server_id = server_id
147
+ if size_gb is not None:
148
+ self.size_gb = size_gb
149
+ if throughput is not None:
150
+ self.throughput = throughput
151
+ if type is not None:
152
+ self.type = type
153
+ if updated_at is not None:
154
+ self.updated_at = updated_at
155
+ if user_id is not None:
156
+ self.user_id = user_id
67
157
 
68
158
  @property
69
- def ebs(self) -> 'V1Ebs':
70
- """Gets the ebs of this V1Volume. # noqa: E501
159
+ def attached_at(self) -> 'datetime':
160
+ """Gets the attached_at of this V1Volume. # noqa: E501
71
161
 
72
162
 
73
- :return: The ebs of this V1Volume. # noqa: E501
74
- :rtype: V1Ebs
163
+ :return: The attached_at of this V1Volume. # noqa: E501
164
+ :rtype: datetime
75
165
  """
76
- return self._ebs
166
+ return self._attached_at
77
167
 
78
- @ebs.setter
79
- def ebs(self, ebs: 'V1Ebs'):
80
- """Sets the ebs of this V1Volume.
168
+ @attached_at.setter
169
+ def attached_at(self, attached_at: 'datetime'):
170
+ """Sets the attached_at of this V1Volume.
81
171
 
82
172
 
83
- :param ebs: The ebs of this V1Volume. # noqa: E501
84
- :type: V1Ebs
173
+ :param attached_at: The attached_at of this V1Volume. # noqa: E501
174
+ :type: datetime
85
175
  """
86
176
 
87
- self._ebs = ebs
177
+ self._attached_at = attached_at
178
+
179
+ @property
180
+ def availability_zone(self) -> 'str':
181
+ """Gets the availability_zone of this V1Volume. # noqa: E501
182
+
183
+
184
+ :return: The availability_zone of this V1Volume. # noqa: E501
185
+ :rtype: str
186
+ """
187
+ return self._availability_zone
188
+
189
+ @availability_zone.setter
190
+ def availability_zone(self, availability_zone: 'str'):
191
+ """Sets the availability_zone of this V1Volume.
192
+
193
+
194
+ :param availability_zone: The availability_zone of this V1Volume. # noqa: E501
195
+ :type: str
196
+ """
197
+
198
+ self._availability_zone = availability_zone
199
+
200
+ @property
201
+ def cluster_id(self) -> 'str':
202
+ """Gets the cluster_id of this V1Volume. # noqa: E501
203
+
204
+
205
+ :return: The cluster_id of this V1Volume. # noqa: E501
206
+ :rtype: str
207
+ """
208
+ return self._cluster_id
209
+
210
+ @cluster_id.setter
211
+ def cluster_id(self, cluster_id: 'str'):
212
+ """Sets the cluster_id of this V1Volume.
213
+
214
+
215
+ :param cluster_id: The cluster_id of this V1Volume. # noqa: E501
216
+ :type: str
217
+ """
218
+
219
+ self._cluster_id = cluster_id
220
+
221
+ @property
222
+ def created_at(self) -> 'datetime':
223
+ """Gets the created_at of this V1Volume. # noqa: E501
224
+
225
+
226
+ :return: The created_at of this V1Volume. # noqa: E501
227
+ :rtype: datetime
228
+ """
229
+ return self._created_at
230
+
231
+ @created_at.setter
232
+ def created_at(self, created_at: 'datetime'):
233
+ """Sets the created_at of this V1Volume.
234
+
235
+
236
+ :param created_at: The created_at of this V1Volume. # noqa: E501
237
+ :type: datetime
238
+ """
239
+
240
+ self._created_at = created_at
241
+
242
+ @property
243
+ def detached_at(self) -> 'datetime':
244
+ """Gets the detached_at of this V1Volume. # noqa: E501
245
+
246
+
247
+ :return: The detached_at of this V1Volume. # noqa: E501
248
+ :rtype: datetime
249
+ """
250
+ return self._detached_at
251
+
252
+ @detached_at.setter
253
+ def detached_at(self, detached_at: 'datetime'):
254
+ """Sets the detached_at of this V1Volume.
255
+
256
+
257
+ :param detached_at: The detached_at of this V1Volume. # noqa: E501
258
+ :type: datetime
259
+ """
260
+
261
+ self._detached_at = detached_at
262
+
263
+ @property
264
+ def encrypted(self) -> 'bool':
265
+ """Gets the encrypted of this V1Volume. # noqa: E501
266
+
267
+
268
+ :return: The encrypted of this V1Volume. # noqa: E501
269
+ :rtype: bool
270
+ """
271
+ return self._encrypted
272
+
273
+ @encrypted.setter
274
+ def encrypted(self, encrypted: 'bool'):
275
+ """Sets the encrypted of this V1Volume.
276
+
277
+
278
+ :param encrypted: The encrypted of this V1Volume. # noqa: E501
279
+ :type: bool
280
+ """
281
+
282
+ self._encrypted = encrypted
88
283
 
89
284
  @property
90
285
  def id(self) -> 'str':
@@ -108,25 +303,298 @@ class V1Volume(object):
108
303
  self._id = id
109
304
 
110
305
  @property
111
- def spec_id(self) -> 'str':
112
- """Gets the spec_id of this V1Volume. # noqa: E501
306
+ def iops(self) -> 'str':
307
+ """Gets the iops of this V1Volume. # noqa: E501
308
+
309
+
310
+ :return: The iops of this V1Volume. # noqa: E501
311
+ :rtype: str
312
+ """
313
+ return self._iops
314
+
315
+ @iops.setter
316
+ def iops(self, iops: 'str'):
317
+ """Sets the iops of this V1Volume.
318
+
319
+
320
+ :param iops: The iops of this V1Volume. # noqa: E501
321
+ :type: str
322
+ """
323
+
324
+ self._iops = iops
325
+
326
+ @property
327
+ def path(self) -> 'str':
328
+ """Gets the path of this V1Volume. # noqa: E501
329
+
330
+
331
+ :return: The path of this V1Volume. # noqa: E501
332
+ :rtype: str
333
+ """
334
+ return self._path
335
+
336
+ @path.setter
337
+ def path(self, path: 'str'):
338
+ """Sets the path of this V1Volume.
339
+
340
+
341
+ :param path: The path of this V1Volume. # noqa: E501
342
+ :type: str
343
+ """
344
+
345
+ self._path = path
346
+
347
+ @property
348
+ def project_id(self) -> 'str':
349
+ """Gets the project_id of this V1Volume. # noqa: E501
350
+
351
+
352
+ :return: The project_id of this V1Volume. # noqa: E501
353
+ :rtype: str
354
+ """
355
+ return self._project_id
356
+
357
+ @project_id.setter
358
+ def project_id(self, project_id: 'str'):
359
+ """Sets the project_id of this V1Volume.
360
+
361
+
362
+ :param project_id: The project_id of this V1Volume. # noqa: E501
363
+ :type: str
364
+ """
365
+
366
+ self._project_id = project_id
367
+
368
+ @property
369
+ def provider(self) -> 'str':
370
+ """Gets the provider of this V1Volume. # noqa: E501
371
+
372
+
373
+ :return: The provider of this V1Volume. # noqa: E501
374
+ :rtype: str
375
+ """
376
+ return self._provider
377
+
378
+ @provider.setter
379
+ def provider(self, provider: 'str'):
380
+ """Sets the provider of this V1Volume.
381
+
382
+
383
+ :param provider: The provider of this V1Volume. # noqa: E501
384
+ :type: str
385
+ """
386
+
387
+ self._provider = provider
388
+
389
+ @property
390
+ def provider_id(self) -> 'str':
391
+ """Gets the provider_id of this V1Volume. # noqa: E501
392
+
393
+
394
+ :return: The provider_id of this V1Volume. # noqa: E501
395
+ :rtype: str
396
+ """
397
+ return self._provider_id
398
+
399
+ @provider_id.setter
400
+ def provider_id(self, provider_id: 'str'):
401
+ """Sets the provider_id of this V1Volume.
402
+
403
+
404
+ :param provider_id: The provider_id of this V1Volume. # noqa: E501
405
+ :type: str
406
+ """
407
+
408
+ self._provider_id = provider_id
409
+
410
+ @property
411
+ def region(self) -> 'str':
412
+ """Gets the region of this V1Volume. # noqa: E501
413
+
414
+
415
+ :return: The region of this V1Volume. # noqa: E501
416
+ :rtype: str
417
+ """
418
+ return self._region
419
+
420
+ @region.setter
421
+ def region(self, region: 'str'):
422
+ """Sets the region of this V1Volume.
423
+
424
+
425
+ :param region: The region of this V1Volume. # noqa: E501
426
+ :type: str
427
+ """
428
+
429
+ self._region = region
430
+
431
+ @property
432
+ def resource_id(self) -> 'str':
433
+ """Gets the resource_id of this V1Volume. # noqa: E501
434
+
435
+
436
+ :return: The resource_id of this V1Volume. # noqa: E501
437
+ :rtype: str
438
+ """
439
+ return self._resource_id
440
+
441
+ @resource_id.setter
442
+ def resource_id(self, resource_id: 'str'):
443
+ """Sets the resource_id of this V1Volume.
444
+
445
+
446
+ :param resource_id: The resource_id of this V1Volume. # noqa: E501
447
+ :type: str
448
+ """
449
+
450
+ self._resource_id = resource_id
451
+
452
+ @property
453
+ def resource_type(self) -> 'str':
454
+ """Gets the resource_type of this V1Volume. # noqa: E501
455
+
456
+
457
+ :return: The resource_type of this V1Volume. # noqa: E501
458
+ :rtype: str
459
+ """
460
+ return self._resource_type
461
+
462
+ @resource_type.setter
463
+ def resource_type(self, resource_type: 'str'):
464
+ """Sets the resource_type of this V1Volume.
465
+
466
+
467
+ :param resource_type: The resource_type of this V1Volume. # noqa: E501
468
+ :type: str
469
+ """
470
+
471
+ self._resource_type = resource_type
472
+
473
+ @property
474
+ def server_id(self) -> 'str':
475
+ """Gets the server_id of this V1Volume. # noqa: E501
476
+
477
+
478
+ :return: The server_id of this V1Volume. # noqa: E501
479
+ :rtype: str
480
+ """
481
+ return self._server_id
482
+
483
+ @server_id.setter
484
+ def server_id(self, server_id: 'str'):
485
+ """Sets the server_id of this V1Volume.
486
+
487
+
488
+ :param server_id: The server_id of this V1Volume. # noqa: E501
489
+ :type: str
490
+ """
491
+
492
+ self._server_id = server_id
493
+
494
+ @property
495
+ def size_gb(self) -> 'str':
496
+ """Gets the size_gb of this V1Volume. # noqa: E501
497
+
498
+
499
+ :return: The size_gb of this V1Volume. # noqa: E501
500
+ :rtype: str
501
+ """
502
+ return self._size_gb
503
+
504
+ @size_gb.setter
505
+ def size_gb(self, size_gb: 'str'):
506
+ """Sets the size_gb of this V1Volume.
507
+
508
+
509
+ :param size_gb: The size_gb of this V1Volume. # noqa: E501
510
+ :type: str
511
+ """
512
+
513
+ self._size_gb = size_gb
514
+
515
+ @property
516
+ def throughput(self) -> 'str':
517
+ """Gets the throughput of this V1Volume. # noqa: E501
518
+
519
+
520
+ :return: The throughput of this V1Volume. # noqa: E501
521
+ :rtype: str
522
+ """
523
+ return self._throughput
524
+
525
+ @throughput.setter
526
+ def throughput(self, throughput: 'str'):
527
+ """Sets the throughput of this V1Volume.
528
+
529
+
530
+ :param throughput: The throughput of this V1Volume. # noqa: E501
531
+ :type: str
532
+ """
533
+
534
+ self._throughput = throughput
535
+
536
+ @property
537
+ def type(self) -> 'str':
538
+ """Gets the type of this V1Volume. # noqa: E501
539
+
540
+
541
+ :return: The type of this V1Volume. # noqa: E501
542
+ :rtype: str
543
+ """
544
+ return self._type
545
+
546
+ @type.setter
547
+ def type(self, type: 'str'):
548
+ """Sets the type of this V1Volume.
549
+
550
+
551
+ :param type: The type of this V1Volume. # noqa: E501
552
+ :type: str
553
+ """
554
+
555
+ self._type = type
556
+
557
+ @property
558
+ def updated_at(self) -> 'datetime':
559
+ """Gets the updated_at of this V1Volume. # noqa: E501
560
+
561
+
562
+ :return: The updated_at of this V1Volume. # noqa: E501
563
+ :rtype: datetime
564
+ """
565
+ return self._updated_at
566
+
567
+ @updated_at.setter
568
+ def updated_at(self, updated_at: 'datetime'):
569
+ """Sets the updated_at of this V1Volume.
570
+
571
+
572
+ :param updated_at: The updated_at of this V1Volume. # noqa: E501
573
+ :type: datetime
574
+ """
575
+
576
+ self._updated_at = updated_at
577
+
578
+ @property
579
+ def user_id(self) -> 'str':
580
+ """Gets the user_id of this V1Volume. # noqa: E501
113
581
 
114
582
 
115
- :return: The spec_id of this V1Volume. # noqa: E501
583
+ :return: The user_id of this V1Volume. # noqa: E501
116
584
  :rtype: str
117
585
  """
118
- return self._spec_id
586
+ return self._user_id
119
587
 
120
- @spec_id.setter
121
- def spec_id(self, spec_id: 'str'):
122
- """Sets the spec_id of this V1Volume.
588
+ @user_id.setter
589
+ def user_id(self, user_id: 'str'):
590
+ """Sets the user_id of this V1Volume.
123
591
 
124
592
 
125
- :param spec_id: The spec_id of this V1Volume. # noqa: E501
593
+ :param user_id: The user_id of this V1Volume. # noqa: E501
126
594
  :type: str
127
595
  """
128
596
 
129
- self._spec_id = spec_id
597
+ self._user_id = user_id
130
598
 
131
599
  def to_dict(self) -> dict:
132
600
  """Returns the model properties as a dict"""
@@ -44,7 +44,7 @@ from lightning_sdk.lightning_cloud.source_code.logs_socket_api import LightningL
44
44
  logger = logging.getLogger(__name__)
45
45
 
46
46
 
47
- def create_swagger_client(check_context=True):
47
+ def create_swagger_client(check_context: bool = True, with_auth: bool = True):
48
48
  """
49
49
  Create the swagger client to use the autogenerated code
50
50
 
@@ -53,6 +53,8 @@ def create_swagger_client(check_context=True):
53
53
  check_context: bool
54
54
  If true, check if the context is set. It's only false for APIs that
55
55
  doesn't need the context information i.e login
56
+ with_auth: bool
57
+ If true, it uses user's Authorization for the api client
56
58
  """
57
59
  if check_context and not env.CONTEXT:
58
60
  raise RuntimeError(
@@ -67,7 +69,8 @@ def create_swagger_client(check_context=True):
67
69
  # if present in /grid-cli/grid/cli/cli/artifacts.py
68
70
  configuration.ssl_ca_cert = env.SSL_CA_CERT
69
71
  api_client = ApiClient(configuration)
70
- api_client.default_headers["Authorization"] = Auth().authenticate()
72
+ if with_auth:
73
+ api_client.default_headers["Authorization"] = Auth().authenticate()
71
74
  api_client.user_agent = f"Grid-CLI-{env.VERSION}"
72
75
  return api_client
73
76
 
@@ -103,8 +106,8 @@ class GridRestClient(
103
106
  CloudSpaceEnvironmentTemplateServiceApi
104
107
  ):
105
108
 
106
- def __init__(self, api_client: Optional[ApiClient] = None):
107
- api_client = api_client if api_client else create_swagger_client()
109
+ def __init__(self, api_client: Optional[ApiClient] = None, with_auth: bool = True):
110
+ api_client = api_client if api_client else create_swagger_client(with_auth=with_auth)
108
111
  api_client.request = request_auth_warning_wrapper(api_client.request)
109
112
  super().__init__(api_client)
110
113
 
@@ -179,24 +182,23 @@ class LightningClient(GridRestClient):
179
182
  Args:
180
183
  retry: Whether API calls should follow a retry mechanism with exponential backoff.
181
184
  max_tries: Maximum number of attempts (or -1 to retry forever).
185
+ with_auth: Whether to use user's Authorization for the api client.
182
186
 
183
187
  """
184
188
 
185
189
  def __init__(self,
186
190
  retry: bool = True,
187
- max_tries: Optional[int] = None) -> None:
188
- super().__init__(api_client=create_swagger_client())
191
+ max_tries: Optional[int] = None,
192
+ with_auth: bool = True) -> None:
193
+ super().__init__(api_client=create_swagger_client(with_auth=with_auth))
189
194
  if retry:
190
195
  for base_class in GridRestClient.__mro__:
191
196
  for name, attribute in base_class.__dict__.items():
192
- if callable(
193
- attribute) and attribute.__name__ != "__init__":
197
+ if callable(attribute) and attribute.__name__ != "__init__":
194
198
  setattr(
195
199
  self,
196
200
  name,
197
- _retry_wrapper(self,
198
- attribute,
199
- max_tries=max_tries),
201
+ _retry_wrapper(self, attribute, max_tries=max_tries),
200
202
  )
201
203
 
202
204
 
@@ -11,11 +11,17 @@ class LightningLogsSocketAPI:
11
11
  if api_client is None:
12
12
  api_client = ApiClient()
13
13
  self.api_client = api_client
14
+ self._auth = None
15
+ self._auth_service = None
16
+
17
+ def _init_auth(self):
14
18
  self._auth = Auth()
15
19
  self._auth.authenticate()
16
- self._auth_service = AuthServiceApi(api_client)
20
+ self._auth_service = AuthServiceApi(self.api_client)
17
21
 
18
22
  def _get_api_token(self):
23
+ if not self._auth_service:
24
+ self._init_auth()
19
25
  token_resp = self._auth_service.auth_service_login(body=V1LoginRequest(
20
26
  username=self._auth.user_id,
21
27
  api_key=self._auth.api_key,
@@ -83,13 +89,12 @@ class LightningLogsSocketAPI:
83
89
  -------
84
90
  WebSocketApp of the wanted socket
85
91
  """
86
- _token = self._get_api_token()
87
92
  clean_ws_host = urlparse(self.api_client.configuration.host).netloc
88
93
  socket_url = self._socket_url(
89
94
  host=clean_ws_host,
90
95
  project_id=project_id,
91
96
  app_id=app_id,
92
- token=_token,
97
+ token=self._get_api_token(),
93
98
  component=component,
94
99
  )
95
100