lightning-sdk 2026.1.27__py3-none-any.whl → 2026.2.3__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 (22) hide show
  1. lightning_sdk/__version__.py +1 -1
  2. lightning_sdk/api/k8s_api.py +7 -1
  3. lightning_sdk/api/studio_api.py +32 -26
  4. lightning_sdk/api/teamspace_api.py +36 -26
  5. lightning_sdk/api/utils.py +61 -1
  6. lightning_sdk/cli/cp/teamspace_uploads.py +4 -2
  7. lightning_sdk/cli/utils/filesystem.py +6 -1
  8. lightning_sdk/lightning_cloud/openapi/__init__.py +3 -0
  9. lightning_sdk/lightning_cloud/openapi/api/cluster_service_api.py +121 -0
  10. lightning_sdk/lightning_cloud/openapi/api/container_registry_service_api.py +123 -0
  11. lightning_sdk/lightning_cloud/openapi/models/__init__.py +3 -0
  12. lightning_sdk/lightning_cloud/openapi/models/cluster_service_get_cluster_capacity_reservation_body.py +97 -0
  13. lightning_sdk/lightning_cloud/openapi/models/v1_get_cluster_capacity_reservation_response.py +123 -0
  14. lightning_sdk/lightning_cloud/openapi/models/v1_slack_notifier.py +27 -1
  15. lightning_sdk/lightning_cloud/openapi/models/v1_update_container_registry_response.py +97 -0
  16. lightning_sdk/lightning_cloud/openapi/models/v1_user_features.py +1 -53
  17. {lightning_sdk-2026.1.27.dist-info → lightning_sdk-2026.2.3.dist-info}/METADATA +1 -1
  18. {lightning_sdk-2026.1.27.dist-info → lightning_sdk-2026.2.3.dist-info}/RECORD +22 -19
  19. {lightning_sdk-2026.1.27.dist-info → lightning_sdk-2026.2.3.dist-info}/LICENSE +0 -0
  20. {lightning_sdk-2026.1.27.dist-info → lightning_sdk-2026.2.3.dist-info}/WHEEL +0 -0
  21. {lightning_sdk-2026.1.27.dist-info → lightning_sdk-2026.2.3.dist-info}/entry_points.txt +0 -0
  22. {lightning_sdk-2026.1.27.dist-info → lightning_sdk-2026.2.3.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,3 @@
1
1
  """Version information for lightning_sdk."""
2
2
 
3
- __version__ = "2026.01.27"
3
+ __version__ = "2026.02.03"
@@ -86,8 +86,14 @@ class K8sClusterApi:
86
86
  timestamp = datetime.fromisoformat(timestamp.replace("Z", "+00:00"))
87
87
  hour = timestamp.replace(minute=0, second=0, microsecond=0)
88
88
 
89
+ # allocated GPUs cannot exceed total number of gpus
90
+ num_gpus = entry["num_gpus"]
91
+ allocated_gpus = entry["num_allocated_gpus"]
92
+ if allocated_gpus > num_gpus:
93
+ allocated_gpus = num_gpus
94
+
89
95
  # Store allocated GPUs for averaging
90
- hourly_data[hour]["allocated_gpus"].append(entry["num_allocated_gpus"])
96
+ hourly_data[hour]["allocated_gpus"].append(allocated_gpus)
91
97
 
92
98
  # Keep first entry for each hour (for other fields)
93
99
  if hourly_data[hour]["first_entry"] is None:
@@ -13,12 +13,15 @@ import requests
13
13
  from tqdm import tqdm
14
14
 
15
15
  from lightning_sdk.api.utils import (
16
+ _MAX_SIZE_MULTI_PART_CHUNK,
16
17
  _authenticate_and_get_token,
17
18
  _create_app,
18
19
  _DummyBody,
19
20
  _DummyResponse,
21
+ _FileUploader,
20
22
  _machine_to_compute_name,
21
23
  _sanitize_studio_remote_path,
24
+ _SinglePartFileUploader,
22
25
  )
23
26
  from lightning_sdk.api.utils import (
24
27
  _get_cloud_url as _cloud_url,
@@ -722,33 +725,36 @@ class StudioApi:
722
725
  remote_path: str,
723
726
  progress_bar: bool,
724
727
  ) -> None:
725
- """Uploads file to given remote path on the studio."""
726
- token = _authenticate_and_get_token(self._client)
727
-
728
- query_params = {"token": token}
729
- client_host = self._client.api_client.configuration.host
730
- url = f"{client_host}/v1/projects/{teamspace_id}/artifacts/cloudspaces/{studio_id}/blobs/{remote_path}"
731
-
732
- filesize = os.path.getsize(file_path)
733
- with open(file_path, "rb") as f:
734
- if progress_bar:
735
- filesize = os.path.getsize(file_path)
736
- with tqdm.wrapattr(
737
- f,
738
- "read",
739
- desc=f"Uploading {os.path.split(file_path)[1]}",
740
- total=filesize,
741
- unit="B",
742
- unit_scale=True,
743
- unit_divisor=1000,
744
- ) as wrapped_file:
745
- r = requests.put(url, data=wrapped_file, params=query_params, timeout=30)
746
- else:
747
- r = requests.put(url, data=f, params=query_params, timeout=30)
728
+ """Uploads file to given remote path in the studio.
748
729
 
749
- if r.status_code == 200:
750
- return
751
- raise RuntimeError(f"Failed to upload file '{file_path}' to the Studio. Status code: {r.status_code}")
730
+ Uses single-part upload for files <= 5MB, multipart upload for larger files.
731
+ """
732
+ file_size = os.path.getsize(file_path)
733
+ multipart_threshold = int(os.environ.get("LIGHTNING_MULTIPART_THRESHOLD", _MAX_SIZE_MULTI_PART_CHUNK))
734
+
735
+ if file_size <= multipart_threshold:
736
+ token = _authenticate_and_get_token(self._client)
737
+
738
+ query_params = {"token": token}
739
+ client_host = self._client.api_client.configuration.host
740
+ url = f"{client_host}/v1/projects/{teamspace_id}/artifacts/cloudspaces/{studio_id}/blobs/{remote_path}"
741
+
742
+ _SinglePartFileUploader(
743
+ client=self._client,
744
+ file_path=file_path,
745
+ url=url,
746
+ query_params=query_params,
747
+ progress_bar=progress_bar,
748
+ )()
749
+ else:
750
+ _FileUploader(
751
+ client=self._client,
752
+ teamspace_id=teamspace_id,
753
+ cloud_account=cloud_account,
754
+ file_path=file_path,
755
+ remote_path=_sanitize_studio_remote_path(remote_path, studio_id),
756
+ progress_bar=progress_bar,
757
+ )()
752
758
 
753
759
  def download_file(
754
760
  self,
@@ -10,11 +10,15 @@ import requests
10
10
  from tqdm.auto import tqdm
11
11
 
12
12
  from lightning_sdk.api.utils import (
13
+ _MAX_SIZE_MULTI_PART_CHUNK,
13
14
  _authenticate_and_get_token,
14
15
  _download_model_files,
15
16
  _DummyBody,
17
+ _FileUploader,
16
18
  _get_model_version,
17
19
  _ModelFileUploader,
20
+ _resolve_teamspace_remote_path,
21
+ _SinglePartFileUploader,
18
22
  )
19
23
  from lightning_sdk.lightning_cloud.login import Auth
20
24
  from lightning_sdk.lightning_cloud.openapi import (
@@ -451,34 +455,40 @@ class TeamspaceApi:
451
455
  file_path: str,
452
456
  remote_path: str,
453
457
  progress_bar: bool,
458
+ headers: Optional[Dict[str, str]] = None,
454
459
  ) -> None:
455
- """Uploads file to given remote path in the Teamspace drive /Uploads/."""
456
- token = _authenticate_and_get_token(self._client)
460
+ """Uploads file to given remote path in the Teamspace drive.
457
461
 
458
- query_params = {"token": token, "clusterId": cloud_account}
459
- client_host = self._client.api_client.configuration.host
460
- url = f"{client_host}/v1/projects/{teamspace_id}/artifacts/uploads/blobs/{remote_path}"
461
-
462
- filesize = os.path.getsize(file_path)
463
- with open(file_path, "rb") as f:
464
- if progress_bar:
465
- filesize = os.path.getsize(file_path)
466
- with tqdm.wrapattr(
467
- f,
468
- "read",
469
- desc=f"Uploading {os.path.split(file_path)[1]}",
470
- total=filesize,
471
- unit="B",
472
- unit_scale=True,
473
- unit_divisor=1000,
474
- ) as wrapped_file:
475
- r = requests.put(url, data=wrapped_file, params=query_params, timeout=30)
476
- else:
477
- r = requests.put(url, data=f, params=query_params, timeout=30)
478
-
479
- if r.status_code == 200:
480
- return
481
- raise RuntimeError(f"Failed to upload file '{file_path}' to the Teamspace drive. Status code: {r.status_code}")
462
+ Uses single-part upload for files <= 5MB, multipart upload for larger files.
463
+ """
464
+ file_size = os.path.getsize(file_path)
465
+
466
+ multipart_threshold = int(os.environ.get("LIGHTNING_MULTIPART_THRESHOLD", _MAX_SIZE_MULTI_PART_CHUNK))
467
+
468
+ if file_size <= multipart_threshold:
469
+ token = _authenticate_and_get_token(self._client)
470
+
471
+ query_params = {"token": token, "clusterId": cloud_account}
472
+ client_host = self._client.api_client.configuration.host
473
+ url = f"{client_host}/v1/projects/{teamspace_id}/artifacts/blobs/{remote_path}"
474
+
475
+ _SinglePartFileUploader(
476
+ client=self._client,
477
+ file_path=file_path,
478
+ url=url,
479
+ query_params=query_params,
480
+ progress_bar=progress_bar,
481
+ headers=headers,
482
+ )()
483
+ else:
484
+ _FileUploader(
485
+ client=self._client,
486
+ teamspace_id=teamspace_id,
487
+ cloud_account=cloud_account,
488
+ file_path=file_path,
489
+ remote_path=_resolve_teamspace_remote_path(remote_path),
490
+ progress_bar=progress_bar,
491
+ )()
482
492
 
483
493
  def download_file(
484
494
  self,
@@ -59,6 +59,66 @@ _MAX_BATCH_SIZE = 50
59
59
  _MAX_WORKERS = 10
60
60
 
61
61
 
62
+ class _SinglePartFileUploader:
63
+ """A class handling upload files to studio and teamspace drive with new endpoint."""
64
+
65
+ def __init__(
66
+ self,
67
+ client: LightningClient,
68
+ file_path: str,
69
+ url: str,
70
+ query_params: Dict[str, str],
71
+ progress_bar: bool,
72
+ headers: Optional[Dict[str, str]] = None,
73
+ ) -> None:
74
+ self.client = client
75
+ self.local_path = file_path
76
+ self.url = url
77
+ self.query_params = query_params
78
+ self.headers = headers
79
+ self.filesize = os.path.getsize(file_path)
80
+
81
+ if progress_bar:
82
+ self.progress_bar = tqdm(
83
+ desc=f"Uploading {os.path.split(file_path)[1]}",
84
+ total=self.filesize,
85
+ unit="B",
86
+ unit_scale=True,
87
+ unit_divisor=1000,
88
+ position=-1,
89
+ mininterval=1,
90
+ )
91
+ else:
92
+ self.progress_bar = None
93
+
94
+ def __call__(self) -> None:
95
+ self._upload_with_retry()
96
+
97
+ @backoff.on_exception(
98
+ backoff.expo, (requests.exceptions.HTTPError, requests.exceptions.RequestException), max_tries=10
99
+ )
100
+ def _upload_with_retry(self) -> None:
101
+ with open(self.local_path, "rb") as f:
102
+ if self.progress_bar is not None:
103
+ with tqdm.wrapattr(
104
+ f,
105
+ "read",
106
+ desc=f"Uploading {os.path.split(self.local_path)[1]}",
107
+ total=self.filesize,
108
+ unit="B",
109
+ unit_scale=True,
110
+ unit_divisor=1000,
111
+ ) as wrapped_file:
112
+ r = requests.put(
113
+ self.url, data=wrapped_file, params=self.query_params, timeout=30, headers=self.headers
114
+ )
115
+ else:
116
+ r = requests.put(self.url, data=f, params=self.query_params, timeout=30, headers=self.headers)
117
+
118
+ if r.status_code != 200:
119
+ raise RuntimeError(f"Failed to upload file '{self.local_path}'. Status code: {r.status_code}")
120
+
121
+
62
122
  class _FileUploader:
63
123
  """A class handling the upload to studios.
64
124
 
@@ -358,7 +418,7 @@ def _sanitize_studio_remote_path(path: str, studio_id: str) -> str:
358
418
 
359
419
 
360
420
  def _resolve_teamspace_remote_path(path: str) -> str:
361
- return f"/Uploads/{path.replace('/teamspace/uploads/', '')}"
421
+ return f"{path.replace('/teamspace/', '')}"
362
422
 
363
423
 
364
424
  _DOWNLOAD_REQUEST_CHUNK_SIZE = 10 * _BYTES_PER_MB
@@ -4,7 +4,7 @@ from pathlib import Path
4
4
  from rich.console import Console
5
5
 
6
6
  from lightning_sdk.api.utils import _get_cloud_url
7
- from lightning_sdk.cli.utils.filesystem import parse_teamspace_uploads_path, resolve_teamspace
7
+ from lightning_sdk.cli.utils.filesystem import parse_teamspace_uploads_path, path_join, resolve_teamspace
8
8
 
9
9
 
10
10
  def cp_upload(
@@ -20,6 +20,8 @@ def cp_upload(
20
20
 
21
21
  teamspace_path_result = parse_teamspace_uploads_path(teamspace_path)
22
22
 
23
+ teamspace_path_result["destination"] = path_join("Uploads", teamspace_path_result["destination"])
24
+
23
25
  selected_teamspace = resolve_teamspace(teamspace_path_result["teamspace"], teamspace_path_result["owner"])
24
26
  console.print(f"Uploading to {selected_teamspace.owner.name}/{selected_teamspace.name}")
25
27
 
@@ -33,7 +35,7 @@ def cp_upload(
33
35
  if teamspace_path.endswith(("/", "\\")):
34
36
  # if destination ends with / or \, treat it as a directory
35
37
  file_name = os.path.basename(local_file_path)
36
- teamspace_path_result["destination"] = os.path.join(teamspace_path_result["destination"], file_name)
38
+ teamspace_path_result["destination"] = path_join(teamspace_path_result["destination"], file_name)
37
39
  selected_teamspace.upload_file(
38
40
  local_file_path, teamspace_path_result["destination"], cloud_account=cloud_account
39
41
  )
@@ -1,4 +1,5 @@
1
- from typing import Optional, TypedDict
1
+ import os
2
+ from typing import Any, Optional, TypedDict
2
3
 
3
4
  from lightning_sdk.cli.utils.owner_selection import OwnerMenu
4
5
  from lightning_sdk.cli.utils.studio_selection import StudiosMenu
@@ -14,6 +15,10 @@ class PathResult(TypedDict):
14
15
  destination: Optional[str]
15
16
 
16
17
 
18
+ def path_join(*args: Any) -> str:
19
+ return os.path.join(*args).replace("\\", "/")
20
+
21
+
17
22
  def parse_studio_path(studio_path: str) -> PathResult:
18
23
  path_string = studio_path.removeprefix("lit://")
19
24
  if not path_string:
@@ -141,6 +141,7 @@ from lightning_sdk.lightning_cloud.openapi.models.cluster_service_create_machine
141
141
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_create_org_cluster_capacity_reservation_body import ClusterServiceCreateOrgClusterCapacityReservationBody
142
142
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_create_project_cluster_body import ClusterServiceCreateProjectClusterBody
143
143
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_create_server_alert_body import ClusterServiceCreateServerAlertBody
144
+ from lightning_sdk.lightning_cloud.openapi.models.cluster_service_get_cluster_capacity_reservation_body import ClusterServiceGetClusterCapacityReservationBody
144
145
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_interrupt_server_body import ClusterServiceInterruptServerBody
145
146
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_purchase_capacity_block_body import ClusterServicePurchaseCapacityBlockBody
146
147
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_report_machine_system_metrics_body import ClusterServiceReportMachineSystemMetricsBody
@@ -648,6 +649,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_required_ba
648
649
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_size_response import V1GetCloudSpaceSizeResponse
649
650
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_transfer_estimate_response import V1GetCloudSpaceTransferEstimateResponse
650
651
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_accelerator_demand_response import V1GetClusterAcceleratorDemandResponse
652
+ from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_capacity_reservation_response import V1GetClusterCapacityReservationResponse
651
653
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_credentials_response import V1GetClusterCredentialsResponse
652
654
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_health_response import V1GetClusterHealthResponse
653
655
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_deployment_routing_telemetry_aggregated_response import V1GetDeploymentRoutingTelemetryAggregatedResponse
@@ -1139,6 +1141,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_update_cloud_space_visibili
1139
1141
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators_request import V1UpdateClusterAcceleratorsRequest
1140
1142
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators_response import V1UpdateClusterAcceleratorsResponse
1141
1143
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_availability_request import V1UpdateClusterAvailabilityRequest
1144
+ from lightning_sdk.lightning_cloud.openapi.models.v1_update_container_registry_response import V1UpdateContainerRegistryResponse
1142
1145
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_like_response import V1UpdateConversationLikeResponse
1143
1146
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_message_content_response import V1UpdateConversationMessageContentResponse
1144
1147
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_message_like_response import V1UpdateConversationMessageLikeResponse
@@ -2470,6 +2470,127 @@ class ClusterServiceApi(object):
2470
2470
  _request_timeout=params.get('_request_timeout'),
2471
2471
  collection_formats=collection_formats)
2472
2472
 
2473
+ def cluster_service_get_cluster_capacity_reservation(self, body: 'ClusterServiceGetClusterCapacityReservationBody', project_id: 'str', cluster_id: 'str', id: 'str', **kwargs) -> 'V1GetClusterCapacityReservationResponse': # noqa: E501
2474
+ """capacity reservation # noqa: E501
2475
+
2476
+ This method makes a synchronous HTTP request by default. To make an
2477
+ asynchronous HTTP request, please pass async_req=True
2478
+ >>> thread = api.cluster_service_get_cluster_capacity_reservation(body, project_id, cluster_id, id, async_req=True)
2479
+ >>> result = thread.get()
2480
+
2481
+ :param async_req bool
2482
+ :param ClusterServiceGetClusterCapacityReservationBody body: (required)
2483
+ :param str project_id: (required)
2484
+ :param str cluster_id: (required)
2485
+ :param str id: capacity reservation id (required)
2486
+ :return: V1GetClusterCapacityReservationResponse
2487
+ If the method is called asynchronously,
2488
+ returns the request thread.
2489
+ """
2490
+ kwargs['_return_http_data_only'] = True
2491
+ if kwargs.get('async_req'):
2492
+ return self.cluster_service_get_cluster_capacity_reservation_with_http_info(body, project_id, cluster_id, id, **kwargs) # noqa: E501
2493
+ else:
2494
+ (data) = self.cluster_service_get_cluster_capacity_reservation_with_http_info(body, project_id, cluster_id, id, **kwargs) # noqa: E501
2495
+ return data
2496
+
2497
+ def cluster_service_get_cluster_capacity_reservation_with_http_info(self, body: 'ClusterServiceGetClusterCapacityReservationBody', project_id: 'str', cluster_id: 'str', id: 'str', **kwargs) -> 'V1GetClusterCapacityReservationResponse': # noqa: E501
2498
+ """capacity reservation # noqa: E501
2499
+
2500
+ This method makes a synchronous HTTP request by default. To make an
2501
+ asynchronous HTTP request, please pass async_req=True
2502
+ >>> thread = api.cluster_service_get_cluster_capacity_reservation_with_http_info(body, project_id, cluster_id, id, async_req=True)
2503
+ >>> result = thread.get()
2504
+
2505
+ :param async_req bool
2506
+ :param ClusterServiceGetClusterCapacityReservationBody body: (required)
2507
+ :param str project_id: (required)
2508
+ :param str cluster_id: (required)
2509
+ :param str id: capacity reservation id (required)
2510
+ :return: V1GetClusterCapacityReservationResponse
2511
+ If the method is called asynchronously,
2512
+ returns the request thread.
2513
+ """
2514
+
2515
+ all_params = ['body', 'project_id', 'cluster_id', 'id'] # noqa: E501
2516
+ all_params.append('async_req')
2517
+ all_params.append('_return_http_data_only')
2518
+ all_params.append('_preload_content')
2519
+ all_params.append('_request_timeout')
2520
+
2521
+ params = locals()
2522
+ for key, val in six.iteritems(params['kwargs']):
2523
+ if key not in all_params:
2524
+ raise TypeError(
2525
+ "Got an unexpected keyword argument '%s'"
2526
+ " to method cluster_service_get_cluster_capacity_reservation" % key
2527
+ )
2528
+ params[key] = val
2529
+ del params['kwargs']
2530
+ # verify the required parameter 'body' is set
2531
+ if ('body' not in params or
2532
+ params['body'] is None):
2533
+ raise ValueError("Missing the required parameter `body` when calling `cluster_service_get_cluster_capacity_reservation`") # noqa: E501
2534
+ # verify the required parameter 'project_id' is set
2535
+ if ('project_id' not in params or
2536
+ params['project_id'] is None):
2537
+ raise ValueError("Missing the required parameter `project_id` when calling `cluster_service_get_cluster_capacity_reservation`") # noqa: E501
2538
+ # verify the required parameter 'cluster_id' is set
2539
+ if ('cluster_id' not in params or
2540
+ params['cluster_id'] is None):
2541
+ raise ValueError("Missing the required parameter `cluster_id` when calling `cluster_service_get_cluster_capacity_reservation`") # noqa: E501
2542
+ # verify the required parameter 'id' is set
2543
+ if ('id' not in params or
2544
+ params['id'] is None):
2545
+ raise ValueError("Missing the required parameter `id` when calling `cluster_service_get_cluster_capacity_reservation`") # noqa: E501
2546
+
2547
+ collection_formats = {}
2548
+
2549
+ path_params = {}
2550
+ if 'project_id' in params:
2551
+ path_params['projectId'] = params['project_id'] # noqa: E501
2552
+ if 'cluster_id' in params:
2553
+ path_params['clusterId'] = params['cluster_id'] # noqa: E501
2554
+ if 'id' in params:
2555
+ path_params['id'] = params['id'] # noqa: E501
2556
+
2557
+ query_params = []
2558
+
2559
+ header_params = {}
2560
+
2561
+ form_params = []
2562
+ local_var_files = {}
2563
+
2564
+ body_params = None
2565
+ if 'body' in params:
2566
+ body_params = params['body']
2567
+ # HTTP header `Accept`
2568
+ header_params['Accept'] = self.api_client.select_header_accept(
2569
+ ['application/json']) # noqa: E501
2570
+
2571
+ # HTTP header `Content-Type`
2572
+ header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
2573
+ ['application/json']) # noqa: E501
2574
+
2575
+ # Authentication setting
2576
+ auth_settings = [] # noqa: E501
2577
+
2578
+ return self.api_client.call_api(
2579
+ '/v1/projects/{projectId}/clusters/{clusterId}/capacity-reservations/{id}', 'POST',
2580
+ path_params,
2581
+ query_params,
2582
+ header_params,
2583
+ body=body_params,
2584
+ post_params=form_params,
2585
+ files=local_var_files,
2586
+ response_type='V1GetClusterCapacityReservationResponse', # noqa: E501
2587
+ auth_settings=auth_settings,
2588
+ async_req=params.get('async_req'),
2589
+ _return_http_data_only=params.get('_return_http_data_only'),
2590
+ _preload_content=params.get('_preload_content', True),
2591
+ _request_timeout=params.get('_request_timeout'),
2592
+ collection_formats=collection_formats)
2593
+
2473
2594
  def cluster_service_get_cluster_credentials(self, **kwargs) -> 'V1GetClusterCredentialsResponse': # noqa: E501
2474
2595
  """cluster_service_get_cluster_credentials # noqa: E501
2475
2596
 
@@ -454,3 +454,126 @@ class ContainerRegistryServiceApi(object):
454
454
  _preload_content=params.get('_preload_content', True),
455
455
  _request_timeout=params.get('_request_timeout'),
456
456
  collection_formats=collection_formats)
457
+
458
+ def container_registry_service_update_container_registry(self, cluster_id: 'str', id: 'str', **kwargs) -> 'V1UpdateContainerRegistryResponse': # noqa: E501
459
+ """container_registry_service_update_container_registry # noqa: E501
460
+
461
+ This method makes a synchronous HTTP request by default. To make an
462
+ asynchronous HTTP request, please pass async_req=True
463
+ >>> thread = api.container_registry_service_update_container_registry(cluster_id, id, async_req=True)
464
+ >>> result = thread.get()
465
+
466
+ :param async_req bool
467
+ :param str cluster_id: (required)
468
+ :param str id: (required)
469
+ :param str org_id:
470
+ :param str url:
471
+ :param str provider:
472
+ :param list[str] scopes_namespaces: for k8s org clusters
473
+ :param list[str] scopes_project_ids: for byoc cloud accounts
474
+ :return: V1UpdateContainerRegistryResponse
475
+ If the method is called asynchronously,
476
+ returns the request thread.
477
+ """
478
+ kwargs['_return_http_data_only'] = True
479
+ if kwargs.get('async_req'):
480
+ return self.container_registry_service_update_container_registry_with_http_info(cluster_id, id, **kwargs) # noqa: E501
481
+ else:
482
+ (data) = self.container_registry_service_update_container_registry_with_http_info(cluster_id, id, **kwargs) # noqa: E501
483
+ return data
484
+
485
+ def container_registry_service_update_container_registry_with_http_info(self, cluster_id: 'str', id: 'str', **kwargs) -> 'V1UpdateContainerRegistryResponse': # noqa: E501
486
+ """container_registry_service_update_container_registry # noqa: E501
487
+
488
+ This method makes a synchronous HTTP request by default. To make an
489
+ asynchronous HTTP request, please pass async_req=True
490
+ >>> thread = api.container_registry_service_update_container_registry_with_http_info(cluster_id, id, async_req=True)
491
+ >>> result = thread.get()
492
+
493
+ :param async_req bool
494
+ :param str cluster_id: (required)
495
+ :param str id: (required)
496
+ :param str org_id:
497
+ :param str url:
498
+ :param str provider:
499
+ :param list[str] scopes_namespaces: for k8s org clusters
500
+ :param list[str] scopes_project_ids: for byoc cloud accounts
501
+ :return: V1UpdateContainerRegistryResponse
502
+ If the method is called asynchronously,
503
+ returns the request thread.
504
+ """
505
+
506
+ all_params = ['cluster_id', 'id', 'org_id', 'url', 'provider', 'scopes_namespaces', 'scopes_project_ids'] # noqa: E501
507
+ all_params.append('async_req')
508
+ all_params.append('_return_http_data_only')
509
+ all_params.append('_preload_content')
510
+ all_params.append('_request_timeout')
511
+
512
+ params = locals()
513
+ for key, val in six.iteritems(params['kwargs']):
514
+ if key not in all_params:
515
+ raise TypeError(
516
+ "Got an unexpected keyword argument '%s'"
517
+ " to method container_registry_service_update_container_registry" % key
518
+ )
519
+ params[key] = val
520
+ del params['kwargs']
521
+ # verify the required parameter 'cluster_id' is set
522
+ if ('cluster_id' not in params or
523
+ params['cluster_id'] is None):
524
+ raise ValueError("Missing the required parameter `cluster_id` when calling `container_registry_service_update_container_registry`") # noqa: E501
525
+ # verify the required parameter 'id' is set
526
+ if ('id' not in params or
527
+ params['id'] is None):
528
+ raise ValueError("Missing the required parameter `id` when calling `container_registry_service_update_container_registry`") # noqa: E501
529
+
530
+ collection_formats = {}
531
+
532
+ path_params = {}
533
+ if 'cluster_id' in params:
534
+ path_params['clusterId'] = params['cluster_id'] # noqa: E501
535
+ if 'id' in params:
536
+ path_params['id'] = params['id'] # noqa: E501
537
+
538
+ query_params = []
539
+ if 'org_id' in params:
540
+ query_params.append(('orgId', params['org_id'])) # noqa: E501
541
+ if 'url' in params:
542
+ query_params.append(('url', params['url'])) # noqa: E501
543
+ if 'provider' in params:
544
+ query_params.append(('provider', params['provider'])) # noqa: E501
545
+ if 'scopes_namespaces' in params:
546
+ query_params.append(('scopes.namespaces', params['scopes_namespaces'])) # noqa: E501
547
+ collection_formats['scopes.namespaces'] = 'multi' # noqa: E501
548
+ if 'scopes_project_ids' in params:
549
+ query_params.append(('scopes.projectIds', params['scopes_project_ids'])) # noqa: E501
550
+ collection_formats['scopes.projectIds'] = 'multi' # noqa: E501
551
+
552
+ header_params = {}
553
+
554
+ form_params = []
555
+ local_var_files = {}
556
+
557
+ body_params = None
558
+ # HTTP header `Accept`
559
+ header_params['Accept'] = self.api_client.select_header_accept(
560
+ ['application/json']) # noqa: E501
561
+
562
+ # Authentication setting
563
+ auth_settings = [] # noqa: E501
564
+
565
+ return self.api_client.call_api(
566
+ '/v1/core/clusters/{clusterId}/container-registries/{id}', 'PATCH',
567
+ path_params,
568
+ query_params,
569
+ header_params,
570
+ body=body_params,
571
+ post_params=form_params,
572
+ files=local_var_files,
573
+ response_type='V1UpdateContainerRegistryResponse', # noqa: E501
574
+ auth_settings=auth_settings,
575
+ async_req=params.get('async_req'),
576
+ _return_http_data_only=params.get('_return_http_data_only'),
577
+ _preload_content=params.get('_preload_content', True),
578
+ _request_timeout=params.get('_request_timeout'),
579
+ collection_formats=collection_formats)
@@ -88,6 +88,7 @@ from lightning_sdk.lightning_cloud.openapi.models.cluster_service_create_machine
88
88
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_create_org_cluster_capacity_reservation_body import ClusterServiceCreateOrgClusterCapacityReservationBody
89
89
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_create_project_cluster_body import ClusterServiceCreateProjectClusterBody
90
90
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_create_server_alert_body import ClusterServiceCreateServerAlertBody
91
+ from lightning_sdk.lightning_cloud.openapi.models.cluster_service_get_cluster_capacity_reservation_body import ClusterServiceGetClusterCapacityReservationBody
91
92
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_interrupt_server_body import ClusterServiceInterruptServerBody
92
93
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_purchase_capacity_block_body import ClusterServicePurchaseCapacityBlockBody
93
94
  from lightning_sdk.lightning_cloud.openapi.models.cluster_service_report_machine_system_metrics_body import ClusterServiceReportMachineSystemMetricsBody
@@ -595,6 +596,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_required_ba
595
596
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_size_response import V1GetCloudSpaceSizeResponse
596
597
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cloud_space_transfer_estimate_response import V1GetCloudSpaceTransferEstimateResponse
597
598
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_accelerator_demand_response import V1GetClusterAcceleratorDemandResponse
599
+ from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_capacity_reservation_response import V1GetClusterCapacityReservationResponse
598
600
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_credentials_response import V1GetClusterCredentialsResponse
599
601
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_cluster_health_response import V1GetClusterHealthResponse
600
602
  from lightning_sdk.lightning_cloud.openapi.models.v1_get_deployment_routing_telemetry_aggregated_response import V1GetDeploymentRoutingTelemetryAggregatedResponse
@@ -1086,6 +1088,7 @@ from lightning_sdk.lightning_cloud.openapi.models.v1_update_cloud_space_visibili
1086
1088
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators_request import V1UpdateClusterAcceleratorsRequest
1087
1089
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_accelerators_response import V1UpdateClusterAcceleratorsResponse
1088
1090
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_cluster_availability_request import V1UpdateClusterAvailabilityRequest
1091
+ from lightning_sdk.lightning_cloud.openapi.models.v1_update_container_registry_response import V1UpdateContainerRegistryResponse
1089
1092
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_like_response import V1UpdateConversationLikeResponse
1090
1093
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_message_content_response import V1UpdateConversationMessageContentResponse
1091
1094
  from lightning_sdk.lightning_cloud.openapi.models.v1_update_conversation_message_like_response import V1UpdateConversationMessageLikeResponse