gcore 0.1.0a2__py3-none-any.whl → 0.2.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.
Potentially problematic release.
This version of gcore might be problematic. Click here for more details.
- gcore/__init__.py +5 -0
- gcore/_client.py +9 -0
- gcore/_utils/_proxy.py +4 -1
- gcore/_utils/_resources_proxy.py +24 -0
- gcore/_version.py +1 -1
- gcore/resources/__init__.py +14 -0
- gcore/resources/cloud/baremetal/servers.py +234 -0
- gcore/resources/cloud/billing_reservations.py +24 -0
- gcore/resources/cloud/file_shares/file_shares.py +16 -0
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +352 -2
- gcore/resources/cloud/gpu_baremetal_clusters/images.py +204 -0
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +80 -0
- gcore/resources/cloud/inference/deployments/deployments.py +322 -4
- gcore/resources/cloud/instances/images.py +316 -0
- gcore/resources/cloud/instances/instances.py +472 -0
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +282 -0
- gcore/resources/cloud/load_balancers/l7_policies/rules.py +326 -0
- gcore/resources/cloud/load_balancers/listeners.py +371 -6
- gcore/resources/cloud/load_balancers/load_balancers.py +364 -0
- gcore/resources/cloud/load_balancers/pools/health_monitors.py +24 -0
- gcore/resources/cloud/load_balancers/pools/members.py +28 -0
- gcore/resources/cloud/load_balancers/pools/pools.py +388 -8
- gcore/resources/cloud/networks/networks.py +72 -16
- gcore/resources/cloud/secrets.py +56 -11
- gcore/resources/cloud/tasks.py +107 -96
- gcore/resources/waap/__init__.py +33 -0
- gcore/resources/waap/domains/__init__.py +33 -0
- gcore/resources/waap/domains/domains.py +515 -0
- gcore/resources/waap/domains/settings.py +271 -0
- gcore/resources/waap/waap.py +102 -0
- gcore/types/cloud/__init__.py +1 -0
- gcore/types/cloud/billing_reservation_list_params.py +5 -0
- gcore/types/cloud/container_probe_config_create_param.py +1 -2
- gcore/types/cloud/file_share.py +3 -0
- gcore/types/cloud/file_share_list_params.py +7 -1
- gcore/types/cloud/gpu_baremetal_cluster_create_params.py +20 -0
- gcore/types/cloud/inference/deployment_update_params.py +203 -6
- gcore/types/cloud/inference/inference.py +3 -1
- gcore/types/cloud/load_balancer_listener_detail.py +13 -13
- gcore/types/cloud/load_balancer_pool.py +13 -13
- gcore/types/cloud/load_balancer_pool_list.py +99 -4
- gcore/types/cloud/load_balancers/listener_create_params.py +2 -0
- gcore/types/cloud/load_balancers/listener_get_params.py +3 -1
- gcore/types/cloud/load_balancers/listener_list_params.py +4 -2
- gcore/types/cloud/load_balancers/listener_update_params.py +2 -0
- gcore/types/cloud/load_balancers/pool_create_params.py +2 -0
- gcore/types/cloud/load_balancers/pool_list_params.py +5 -6
- gcore/types/cloud/load_balancers/pool_update_params.py +2 -0
- gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +2 -0
- gcore/types/cloud/load_balancers/pools/member_add_params.py +2 -0
- gcore/types/cloud/network.py +21 -21
- gcore/types/cloud/network_create_params.py +2 -0
- gcore/types/cloud/network_details.py +24 -23
- gcore/types/cloud/network_list_params.py +15 -10
- gcore/types/cloud/network_update_params.py +2 -0
- gcore/types/cloud/quota_get_all_response.py +18 -0
- gcore/types/cloud/quota_get_by_region_response.py +18 -0
- gcore/types/cloud/quotas/request_create_params.py +9 -0
- gcore/types/cloud/quotas/request_get_response.py +9 -0
- gcore/types/cloud/quotas/request_list_response.py +9 -0
- gcore/types/cloud/secret_list_params.py +24 -0
- gcore/types/cloud/task.py +0 -3
- gcore/types/cloud/task_list_params.py +8 -2
- gcore/types/waap/__init__.py +12 -0
- gcore/types/waap/domain_list_params.py +30 -0
- gcore/types/waap/domain_update_params.py +12 -0
- gcore/types/waap/domains/__init__.py +5 -0
- gcore/types/waap/domains/setting_update_params.py +41 -0
- gcore/types/waap/waap_api_urls.py +15 -0
- gcore/types/waap/waap_detailed_domain.py +37 -0
- gcore/types/waap/waap_domain_ddos_settings.py +31 -0
- gcore/types/waap/waap_domain_settings.py +15 -0
- gcore/types/waap/waap_domain_status.py +7 -0
- gcore/types/waap/waap_summary_domain.py +26 -0
- {gcore-0.1.0a2.dist-info → gcore-0.2.0.dist-info}/METADATA +3 -3
- {gcore-0.1.0a2.dist-info → gcore-0.2.0.dist-info}/RECORD +78 -60
- {gcore-0.1.0a2.dist-info → gcore-0.2.0.dist-info}/WHEEL +0 -0
- {gcore-0.1.0a2.dist-info → gcore-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -111,8 +111,11 @@ class GPUBaremetalClustersResource(SyncAPIResource):
|
|
|
111
111
|
interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface],
|
|
112
112
|
name: str,
|
|
113
113
|
instances_count: int | NotGiven = NOT_GIVEN,
|
|
114
|
+
password: str | NotGiven = NOT_GIVEN,
|
|
114
115
|
ssh_key_name: str | NotGiven = NOT_GIVEN,
|
|
115
116
|
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
117
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
118
|
+
username: str | NotGiven = NOT_GIVEN,
|
|
116
119
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
117
120
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
118
121
|
extra_headers: Headers | None = None,
|
|
@@ -135,6 +138,10 @@ class GPUBaremetalClustersResource(SyncAPIResource):
|
|
|
135
138
|
|
|
136
139
|
instances_count: Number of servers to create
|
|
137
140
|
|
|
141
|
+
password: A password for a bare metal server. This parameter is used to set a password for
|
|
142
|
+
the "Admin" user on a Windows instance, a default user or a new user on a Linux
|
|
143
|
+
instance
|
|
144
|
+
|
|
138
145
|
ssh_key_name: Specifies the name of the SSH keypair, created via the
|
|
139
146
|
<a href="#operation/SSHKeyCollectionViewSet.post">/v1/ssh_keys endpoint</a>.
|
|
140
147
|
|
|
@@ -144,6 +151,13 @@ class GPUBaremetalClustersResource(SyncAPIResource):
|
|
|
144
151
|
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
145
152
|
data to be filtered based on tag keys or values.
|
|
146
153
|
|
|
154
|
+
user_data: String in base64 format. Must not be passed together with 'username' or
|
|
155
|
+
'password'. Examples of the user_data:
|
|
156
|
+
https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
|
157
|
+
|
|
158
|
+
username: A name of a new user in the Linux instance. It may be passed with a 'password'
|
|
159
|
+
parameter
|
|
160
|
+
|
|
147
161
|
extra_headers: Send extra headers
|
|
148
162
|
|
|
149
163
|
extra_query: Add additional query parameters to the request
|
|
@@ -165,8 +179,11 @@ class GPUBaremetalClustersResource(SyncAPIResource):
|
|
|
165
179
|
"interfaces": interfaces,
|
|
166
180
|
"name": name,
|
|
167
181
|
"instances_count": instances_count,
|
|
182
|
+
"password": password,
|
|
168
183
|
"ssh_key_name": ssh_key_name,
|
|
169
184
|
"tags": tags,
|
|
185
|
+
"user_data": user_data,
|
|
186
|
+
"username": username,
|
|
170
187
|
},
|
|
171
188
|
gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams,
|
|
172
189
|
),
|
|
@@ -498,7 +515,7 @@ class GPUBaremetalClustersResource(SyncAPIResource):
|
|
|
498
515
|
if region_id is None:
|
|
499
516
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
500
517
|
if not cluster_id:
|
|
501
|
-
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
518
|
+
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
502
519
|
return self._post(
|
|
503
520
|
f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize",
|
|
504
521
|
body=maybe_transform(
|
|
@@ -511,6 +528,164 @@ class GPUBaremetalClustersResource(SyncAPIResource):
|
|
|
511
528
|
cast_to=TaskIDList,
|
|
512
529
|
)
|
|
513
530
|
|
|
531
|
+
def create_and_poll(
|
|
532
|
+
self,
|
|
533
|
+
*,
|
|
534
|
+
project_id: int | None = None,
|
|
535
|
+
region_id: int | None = None,
|
|
536
|
+
flavor: str,
|
|
537
|
+
image_id: str,
|
|
538
|
+
interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface],
|
|
539
|
+
name: str,
|
|
540
|
+
instances_count: int | NotGiven = NOT_GIVEN,
|
|
541
|
+
ssh_key_name: str | NotGiven = NOT_GIVEN,
|
|
542
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
543
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
544
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
545
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
546
|
+
extra_headers: Headers | None = None,
|
|
547
|
+
extra_query: Query | None = None,
|
|
548
|
+
extra_body: Body | None = None,
|
|
549
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
550
|
+
) -> GPUBaremetalCluster:
|
|
551
|
+
"""
|
|
552
|
+
Create a bare metal GPU cluster and wait for it to be ready.
|
|
553
|
+
"""
|
|
554
|
+
response = self.create(
|
|
555
|
+
project_id=project_id,
|
|
556
|
+
region_id=region_id,
|
|
557
|
+
flavor=flavor,
|
|
558
|
+
image_id=image_id,
|
|
559
|
+
interfaces=interfaces,
|
|
560
|
+
name=name,
|
|
561
|
+
instances_count=instances_count,
|
|
562
|
+
ssh_key_name=ssh_key_name,
|
|
563
|
+
tags=tags,
|
|
564
|
+
extra_headers=extra_headers,
|
|
565
|
+
extra_query=extra_query,
|
|
566
|
+
extra_body=extra_body,
|
|
567
|
+
timeout=timeout,
|
|
568
|
+
)
|
|
569
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
570
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
571
|
+
task = self._client.cloud.tasks.poll(
|
|
572
|
+
response.tasks[0],
|
|
573
|
+
extra_headers=extra_headers,
|
|
574
|
+
extra_query=extra_query,
|
|
575
|
+
extra_body=extra_body,
|
|
576
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
577
|
+
)
|
|
578
|
+
if not task.created_resources or not task.created_resources.ai_clusters:
|
|
579
|
+
raise ValueError("No cluster was created")
|
|
580
|
+
cluster_id = task.created_resources.ai_clusters[0]
|
|
581
|
+
return self.get(
|
|
582
|
+
cluster_id=cluster_id,
|
|
583
|
+
project_id=project_id,
|
|
584
|
+
region_id=region_id,
|
|
585
|
+
extra_headers=extra_headers,
|
|
586
|
+
extra_query=extra_query,
|
|
587
|
+
extra_body=extra_body,
|
|
588
|
+
timeout=timeout,
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
def rebuild_and_poll(
|
|
592
|
+
self,
|
|
593
|
+
cluster_id: str,
|
|
594
|
+
*,
|
|
595
|
+
project_id: int | None = None,
|
|
596
|
+
region_id: int | None = None,
|
|
597
|
+
nodes: List[str],
|
|
598
|
+
image_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
599
|
+
user_data: Optional[str] | NotGiven = NOT_GIVEN,
|
|
600
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
601
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
602
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
603
|
+
extra_headers: Headers | None = None,
|
|
604
|
+
extra_query: Query | None = None,
|
|
605
|
+
extra_body: Body | None = None,
|
|
606
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
607
|
+
) -> GPUBaremetalCluster:
|
|
608
|
+
"""
|
|
609
|
+
Rebuild a bare metal GPU cluster and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
610
|
+
"""
|
|
611
|
+
response = self.rebuild(
|
|
612
|
+
cluster_id=cluster_id,
|
|
613
|
+
project_id=project_id,
|
|
614
|
+
region_id=region_id,
|
|
615
|
+
nodes=nodes,
|
|
616
|
+
image_id=image_id,
|
|
617
|
+
user_data=user_data,
|
|
618
|
+
extra_headers=extra_headers,
|
|
619
|
+
extra_query=extra_query,
|
|
620
|
+
extra_body=extra_body,
|
|
621
|
+
timeout=timeout,
|
|
622
|
+
)
|
|
623
|
+
if not response.tasks:
|
|
624
|
+
raise ValueError("Expected at least one task to be created")
|
|
625
|
+
self._client.cloud.tasks.poll(
|
|
626
|
+
response.tasks[0],
|
|
627
|
+
extra_headers=extra_headers,
|
|
628
|
+
extra_query=extra_query,
|
|
629
|
+
extra_body=extra_body,
|
|
630
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
631
|
+
)
|
|
632
|
+
return self.get(
|
|
633
|
+
cluster_id=cluster_id,
|
|
634
|
+
project_id=project_id,
|
|
635
|
+
region_id=region_id,
|
|
636
|
+
extra_headers=extra_headers,
|
|
637
|
+
extra_query=extra_query,
|
|
638
|
+
extra_body=extra_body,
|
|
639
|
+
timeout=timeout,
|
|
640
|
+
)
|
|
641
|
+
|
|
642
|
+
def resize_and_poll(
|
|
643
|
+
self,
|
|
644
|
+
cluster_id: str,
|
|
645
|
+
*,
|
|
646
|
+
project_id: int | None = None,
|
|
647
|
+
region_id: int | None = None,
|
|
648
|
+
instances_count: int,
|
|
649
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
650
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
651
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
652
|
+
extra_headers: Headers | None = None,
|
|
653
|
+
extra_query: Query | None = None,
|
|
654
|
+
extra_body: Body | None = None,
|
|
655
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
656
|
+
) -> GPUBaremetalCluster:
|
|
657
|
+
"""
|
|
658
|
+
Resize a bare metal GPU cluster and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
659
|
+
"""
|
|
660
|
+
response = self.resize(
|
|
661
|
+
cluster_id=cluster_id,
|
|
662
|
+
project_id=project_id,
|
|
663
|
+
region_id=region_id,
|
|
664
|
+
instances_count=instances_count,
|
|
665
|
+
extra_headers=extra_headers,
|
|
666
|
+
extra_query=extra_query,
|
|
667
|
+
extra_body=extra_body,
|
|
668
|
+
timeout=timeout,
|
|
669
|
+
)
|
|
670
|
+
if not response.tasks:
|
|
671
|
+
raise ValueError("Expected at least one task to be created")
|
|
672
|
+
self._client.cloud.tasks.poll(
|
|
673
|
+
response.tasks[0],
|
|
674
|
+
extra_headers=extra_headers,
|
|
675
|
+
extra_query=extra_query,
|
|
676
|
+
extra_body=extra_body,
|
|
677
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
678
|
+
)
|
|
679
|
+
return self.get(
|
|
680
|
+
cluster_id=cluster_id,
|
|
681
|
+
project_id=project_id,
|
|
682
|
+
region_id=region_id,
|
|
683
|
+
extra_headers=extra_headers,
|
|
684
|
+
extra_query=extra_query,
|
|
685
|
+
extra_body=extra_body,
|
|
686
|
+
timeout=timeout,
|
|
687
|
+
)
|
|
688
|
+
|
|
514
689
|
|
|
515
690
|
class AsyncGPUBaremetalClustersResource(AsyncAPIResource):
|
|
516
691
|
@cached_property
|
|
@@ -558,8 +733,11 @@ class AsyncGPUBaremetalClustersResource(AsyncAPIResource):
|
|
|
558
733
|
interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface],
|
|
559
734
|
name: str,
|
|
560
735
|
instances_count: int | NotGiven = NOT_GIVEN,
|
|
736
|
+
password: str | NotGiven = NOT_GIVEN,
|
|
561
737
|
ssh_key_name: str | NotGiven = NOT_GIVEN,
|
|
562
738
|
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
739
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
740
|
+
username: str | NotGiven = NOT_GIVEN,
|
|
563
741
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
564
742
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
565
743
|
extra_headers: Headers | None = None,
|
|
@@ -582,6 +760,10 @@ class AsyncGPUBaremetalClustersResource(AsyncAPIResource):
|
|
|
582
760
|
|
|
583
761
|
instances_count: Number of servers to create
|
|
584
762
|
|
|
763
|
+
password: A password for a bare metal server. This parameter is used to set a password for
|
|
764
|
+
the "Admin" user on a Windows instance, a default user or a new user on a Linux
|
|
765
|
+
instance
|
|
766
|
+
|
|
585
767
|
ssh_key_name: Specifies the name of the SSH keypair, created via the
|
|
586
768
|
<a href="#operation/SSHKeyCollectionViewSet.post">/v1/ssh_keys endpoint</a>.
|
|
587
769
|
|
|
@@ -591,6 +773,13 @@ class AsyncGPUBaremetalClustersResource(AsyncAPIResource):
|
|
|
591
773
|
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
592
774
|
data to be filtered based on tag keys or values.
|
|
593
775
|
|
|
776
|
+
user_data: String in base64 format. Must not be passed together with 'username' or
|
|
777
|
+
'password'. Examples of the user_data:
|
|
778
|
+
https://cloudinit.readthedocs.io/en/latest/topics/examples.html
|
|
779
|
+
|
|
780
|
+
username: A name of a new user in the Linux instance. It may be passed with a 'password'
|
|
781
|
+
parameter
|
|
782
|
+
|
|
594
783
|
extra_headers: Send extra headers
|
|
595
784
|
|
|
596
785
|
extra_query: Add additional query parameters to the request
|
|
@@ -612,8 +801,11 @@ class AsyncGPUBaremetalClustersResource(AsyncAPIResource):
|
|
|
612
801
|
"interfaces": interfaces,
|
|
613
802
|
"name": name,
|
|
614
803
|
"instances_count": instances_count,
|
|
804
|
+
"password": password,
|
|
615
805
|
"ssh_key_name": ssh_key_name,
|
|
616
806
|
"tags": tags,
|
|
807
|
+
"user_data": user_data,
|
|
808
|
+
"username": username,
|
|
617
809
|
},
|
|
618
810
|
gpu_baremetal_cluster_create_params.GPUBaremetalClusterCreateParams,
|
|
619
811
|
),
|
|
@@ -945,7 +1137,7 @@ class AsyncGPUBaremetalClustersResource(AsyncAPIResource):
|
|
|
945
1137
|
if region_id is None:
|
|
946
1138
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
947
1139
|
if not cluster_id:
|
|
948
|
-
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
1140
|
+
raise ValueError(f"Expected a non-empty value for `cluster_id` but received {cluster_id!r}")
|
|
949
1141
|
return await self._post(
|
|
950
1142
|
f"/cloud/v1/ai/clusters/gpu/{project_id}/{region_id}/{cluster_id}/resize",
|
|
951
1143
|
body=await async_maybe_transform(
|
|
@@ -958,6 +1150,164 @@ class AsyncGPUBaremetalClustersResource(AsyncAPIResource):
|
|
|
958
1150
|
cast_to=TaskIDList,
|
|
959
1151
|
)
|
|
960
1152
|
|
|
1153
|
+
async def create_and_poll(
|
|
1154
|
+
self,
|
|
1155
|
+
*,
|
|
1156
|
+
project_id: int | None = None,
|
|
1157
|
+
region_id: int | None = None,
|
|
1158
|
+
flavor: str,
|
|
1159
|
+
image_id: str,
|
|
1160
|
+
interfaces: Iterable[gpu_baremetal_cluster_create_params.Interface],
|
|
1161
|
+
name: str,
|
|
1162
|
+
instances_count: int | NotGiven = NOT_GIVEN,
|
|
1163
|
+
ssh_key_name: str | NotGiven = NOT_GIVEN,
|
|
1164
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
1165
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1166
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1167
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1168
|
+
extra_headers: Headers | None = None,
|
|
1169
|
+
extra_query: Query | None = None,
|
|
1170
|
+
extra_body: Body | None = None,
|
|
1171
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1172
|
+
) -> GPUBaremetalCluster:
|
|
1173
|
+
"""
|
|
1174
|
+
Create a bare metal GPU cluster and wait for it to be ready.
|
|
1175
|
+
"""
|
|
1176
|
+
response = await self.create(
|
|
1177
|
+
project_id=project_id,
|
|
1178
|
+
region_id=region_id,
|
|
1179
|
+
flavor=flavor,
|
|
1180
|
+
image_id=image_id,
|
|
1181
|
+
interfaces=interfaces,
|
|
1182
|
+
name=name,
|
|
1183
|
+
instances_count=instances_count,
|
|
1184
|
+
ssh_key_name=ssh_key_name,
|
|
1185
|
+
tags=tags,
|
|
1186
|
+
extra_headers=extra_headers,
|
|
1187
|
+
extra_query=extra_query,
|
|
1188
|
+
extra_body=extra_body,
|
|
1189
|
+
timeout=timeout,
|
|
1190
|
+
)
|
|
1191
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
1192
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
1193
|
+
task = await self._client.cloud.tasks.poll(
|
|
1194
|
+
response.tasks[0],
|
|
1195
|
+
extra_headers=extra_headers,
|
|
1196
|
+
extra_query=extra_query,
|
|
1197
|
+
extra_body=extra_body,
|
|
1198
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1199
|
+
)
|
|
1200
|
+
if not task.created_resources or not task.created_resources.ai_clusters:
|
|
1201
|
+
raise ValueError("No cluster was created")
|
|
1202
|
+
cluster_id = task.created_resources.ai_clusters[0]
|
|
1203
|
+
return await self.get(
|
|
1204
|
+
cluster_id=cluster_id,
|
|
1205
|
+
project_id=project_id,
|
|
1206
|
+
region_id=region_id,
|
|
1207
|
+
extra_headers=extra_headers,
|
|
1208
|
+
extra_query=extra_query,
|
|
1209
|
+
extra_body=extra_body,
|
|
1210
|
+
timeout=timeout,
|
|
1211
|
+
)
|
|
1212
|
+
|
|
1213
|
+
async def rebuild_and_poll(
|
|
1214
|
+
self,
|
|
1215
|
+
cluster_id: str,
|
|
1216
|
+
*,
|
|
1217
|
+
project_id: int | None = None,
|
|
1218
|
+
region_id: int | None = None,
|
|
1219
|
+
nodes: List[str],
|
|
1220
|
+
image_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1221
|
+
user_data: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1222
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1223
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1224
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1225
|
+
extra_headers: Headers | None = None,
|
|
1226
|
+
extra_query: Query | None = None,
|
|
1227
|
+
extra_body: Body | None = None,
|
|
1228
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1229
|
+
) -> GPUBaremetalCluster:
|
|
1230
|
+
"""
|
|
1231
|
+
Rebuild a bare metal GPU cluster and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1232
|
+
"""
|
|
1233
|
+
response = await self.rebuild(
|
|
1234
|
+
cluster_id=cluster_id,
|
|
1235
|
+
project_id=project_id,
|
|
1236
|
+
region_id=region_id,
|
|
1237
|
+
nodes=nodes,
|
|
1238
|
+
image_id=image_id,
|
|
1239
|
+
user_data=user_data,
|
|
1240
|
+
extra_headers=extra_headers,
|
|
1241
|
+
extra_query=extra_query,
|
|
1242
|
+
extra_body=extra_body,
|
|
1243
|
+
timeout=timeout,
|
|
1244
|
+
)
|
|
1245
|
+
if not response.tasks:
|
|
1246
|
+
raise ValueError("Expected at least one task to be created")
|
|
1247
|
+
await self._client.cloud.tasks.poll(
|
|
1248
|
+
response.tasks[0],
|
|
1249
|
+
extra_headers=extra_headers,
|
|
1250
|
+
extra_query=extra_query,
|
|
1251
|
+
extra_body=extra_body,
|
|
1252
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1253
|
+
)
|
|
1254
|
+
return await self.get(
|
|
1255
|
+
cluster_id=cluster_id,
|
|
1256
|
+
project_id=project_id,
|
|
1257
|
+
region_id=region_id,
|
|
1258
|
+
extra_headers=extra_headers,
|
|
1259
|
+
extra_query=extra_query,
|
|
1260
|
+
extra_body=extra_body,
|
|
1261
|
+
timeout=timeout,
|
|
1262
|
+
)
|
|
1263
|
+
|
|
1264
|
+
async def resize_and_poll(
|
|
1265
|
+
self,
|
|
1266
|
+
cluster_id: str,
|
|
1267
|
+
*,
|
|
1268
|
+
project_id: int | None = None,
|
|
1269
|
+
region_id: int | None = None,
|
|
1270
|
+
instances_count: int,
|
|
1271
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1272
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1273
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1274
|
+
extra_headers: Headers | None = None,
|
|
1275
|
+
extra_query: Query | None = None,
|
|
1276
|
+
extra_body: Body | None = None,
|
|
1277
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1278
|
+
) -> GPUBaremetalCluster:
|
|
1279
|
+
"""
|
|
1280
|
+
Resize a bare metal GPU cluster and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1281
|
+
"""
|
|
1282
|
+
response = await self.resize(
|
|
1283
|
+
cluster_id=cluster_id,
|
|
1284
|
+
project_id=project_id,
|
|
1285
|
+
region_id=region_id,
|
|
1286
|
+
instances_count=instances_count,
|
|
1287
|
+
extra_headers=extra_headers,
|
|
1288
|
+
extra_query=extra_query,
|
|
1289
|
+
extra_body=extra_body,
|
|
1290
|
+
timeout=timeout,
|
|
1291
|
+
)
|
|
1292
|
+
if not response.tasks:
|
|
1293
|
+
raise ValueError("Expected at least one task to be created")
|
|
1294
|
+
await self._client.cloud.tasks.poll(
|
|
1295
|
+
response.tasks[0],
|
|
1296
|
+
extra_headers=extra_headers,
|
|
1297
|
+
extra_query=extra_query,
|
|
1298
|
+
extra_body=extra_body,
|
|
1299
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1300
|
+
)
|
|
1301
|
+
return await self.get(
|
|
1302
|
+
cluster_id=cluster_id,
|
|
1303
|
+
project_id=project_id,
|
|
1304
|
+
region_id=region_id,
|
|
1305
|
+
extra_headers=extra_headers,
|
|
1306
|
+
extra_query=extra_query,
|
|
1307
|
+
extra_body=extra_body,
|
|
1308
|
+
timeout=timeout,
|
|
1309
|
+
)
|
|
1310
|
+
|
|
961
1311
|
|
|
962
1312
|
class GPUBaremetalClustersResourceWithRawResponse:
|
|
963
1313
|
def __init__(self, gpu_baremetal_clusters: GPUBaremetalClustersResource) -> None:
|
|
@@ -132,6 +132,42 @@ class ImagesResource(SyncAPIResource):
|
|
|
132
132
|
cast_to=TaskIDList,
|
|
133
133
|
)
|
|
134
134
|
|
|
135
|
+
def delete_and_poll(
|
|
136
|
+
self,
|
|
137
|
+
image_id: str,
|
|
138
|
+
*,
|
|
139
|
+
project_id: int | None = None,
|
|
140
|
+
region_id: int | None = None,
|
|
141
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
142
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
143
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
144
|
+
extra_headers: Headers | None = None,
|
|
145
|
+
extra_query: Query | None = None,
|
|
146
|
+
extra_body: Body | None = None,
|
|
147
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
148
|
+
) -> None:
|
|
149
|
+
"""
|
|
150
|
+
Delete a bare metal GPU image and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
151
|
+
"""
|
|
152
|
+
response = self.delete(
|
|
153
|
+
image_id=image_id,
|
|
154
|
+
project_id=project_id,
|
|
155
|
+
region_id=region_id,
|
|
156
|
+
extra_headers=extra_headers,
|
|
157
|
+
extra_query=extra_query,
|
|
158
|
+
extra_body=extra_body,
|
|
159
|
+
timeout=timeout,
|
|
160
|
+
)
|
|
161
|
+
if not response.tasks or len(response.tasks) < 1:
|
|
162
|
+
raise ValueError("Expected at least one task to be created")
|
|
163
|
+
self._client.cloud.tasks.poll(
|
|
164
|
+
response.tasks[0],
|
|
165
|
+
extra_headers=extra_headers,
|
|
166
|
+
extra_query=extra_query,
|
|
167
|
+
extra_body=extra_body,
|
|
168
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
169
|
+
)
|
|
170
|
+
|
|
135
171
|
def get(
|
|
136
172
|
self,
|
|
137
173
|
image_id: str,
|
|
@@ -267,6 +303,72 @@ class ImagesResource(SyncAPIResource):
|
|
|
267
303
|
cast_to=TaskIDList,
|
|
268
304
|
)
|
|
269
305
|
|
|
306
|
+
def upload_and_poll(
|
|
307
|
+
self,
|
|
308
|
+
*,
|
|
309
|
+
project_id: int | None = None,
|
|
310
|
+
region_id: int | None = None,
|
|
311
|
+
name: str,
|
|
312
|
+
url: str,
|
|
313
|
+
architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN,
|
|
314
|
+
cow_format: bool | NotGiven = NOT_GIVEN,
|
|
315
|
+
hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN,
|
|
316
|
+
os_distro: Optional[str] | NotGiven = NOT_GIVEN,
|
|
317
|
+
os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN,
|
|
318
|
+
os_version: Optional[str] | NotGiven = NOT_GIVEN,
|
|
319
|
+
ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN,
|
|
320
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
321
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
322
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
323
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
324
|
+
extra_headers: Headers | None = None,
|
|
325
|
+
extra_query: Query | None = None,
|
|
326
|
+
extra_body: Body | None = None,
|
|
327
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
328
|
+
) -> GPUImage:
|
|
329
|
+
"""
|
|
330
|
+
Upload a new bare metal GPU image and wait for the upload to complete.
|
|
331
|
+
"""
|
|
332
|
+
response = self.upload(
|
|
333
|
+
project_id=project_id,
|
|
334
|
+
region_id=region_id,
|
|
335
|
+
name=name,
|
|
336
|
+
url=url,
|
|
337
|
+
architecture=architecture,
|
|
338
|
+
cow_format=cow_format,
|
|
339
|
+
hw_firmware_type=hw_firmware_type,
|
|
340
|
+
os_distro=os_distro,
|
|
341
|
+
os_type=os_type,
|
|
342
|
+
os_version=os_version,
|
|
343
|
+
ssh_key=ssh_key,
|
|
344
|
+
tags=tags,
|
|
345
|
+
extra_headers=extra_headers,
|
|
346
|
+
extra_query=extra_query,
|
|
347
|
+
extra_body=extra_body,
|
|
348
|
+
timeout=timeout,
|
|
349
|
+
)
|
|
350
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
351
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
352
|
+
task = self._client.cloud.tasks.poll(
|
|
353
|
+
response.tasks[0],
|
|
354
|
+
extra_headers=extra_headers,
|
|
355
|
+
extra_query=extra_query,
|
|
356
|
+
extra_body=extra_body,
|
|
357
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
358
|
+
)
|
|
359
|
+
if not task.created_resources or not task.created_resources.images:
|
|
360
|
+
raise ValueError("No image was created")
|
|
361
|
+
image_id = task.created_resources.images[0]
|
|
362
|
+
return self.get(
|
|
363
|
+
image_id=image_id,
|
|
364
|
+
project_id=project_id,
|
|
365
|
+
region_id=region_id,
|
|
366
|
+
extra_headers=extra_headers,
|
|
367
|
+
extra_query=extra_query,
|
|
368
|
+
extra_body=extra_body,
|
|
369
|
+
timeout=timeout,
|
|
370
|
+
)
|
|
371
|
+
|
|
270
372
|
|
|
271
373
|
class AsyncImagesResource(AsyncAPIResource):
|
|
272
374
|
@cached_property
|
|
@@ -373,6 +475,42 @@ class AsyncImagesResource(AsyncAPIResource):
|
|
|
373
475
|
cast_to=TaskIDList,
|
|
374
476
|
)
|
|
375
477
|
|
|
478
|
+
async def delete_and_poll(
|
|
479
|
+
self,
|
|
480
|
+
image_id: str,
|
|
481
|
+
*,
|
|
482
|
+
project_id: int | None = None,
|
|
483
|
+
region_id: int | None = None,
|
|
484
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
485
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
486
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
487
|
+
extra_headers: Headers | None = None,
|
|
488
|
+
extra_query: Query | None = None,
|
|
489
|
+
extra_body: Body | None = None,
|
|
490
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
491
|
+
) -> None:
|
|
492
|
+
"""
|
|
493
|
+
Delete a bare metal GPU image and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
494
|
+
"""
|
|
495
|
+
response = await self.delete(
|
|
496
|
+
image_id=image_id,
|
|
497
|
+
project_id=project_id,
|
|
498
|
+
region_id=region_id,
|
|
499
|
+
extra_headers=extra_headers,
|
|
500
|
+
extra_query=extra_query,
|
|
501
|
+
extra_body=extra_body,
|
|
502
|
+
timeout=timeout,
|
|
503
|
+
)
|
|
504
|
+
if not response.tasks or len(response.tasks) < 1:
|
|
505
|
+
raise ValueError("Expected at least one task to be created")
|
|
506
|
+
await self._client.cloud.tasks.poll(
|
|
507
|
+
response.tasks[0],
|
|
508
|
+
extra_headers=extra_headers,
|
|
509
|
+
extra_query=extra_query,
|
|
510
|
+
extra_body=extra_body,
|
|
511
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
512
|
+
)
|
|
513
|
+
|
|
376
514
|
async def get(
|
|
377
515
|
self,
|
|
378
516
|
image_id: str,
|
|
@@ -508,6 +646,72 @@ class AsyncImagesResource(AsyncAPIResource):
|
|
|
508
646
|
cast_to=TaskIDList,
|
|
509
647
|
)
|
|
510
648
|
|
|
649
|
+
async def upload_and_poll(
|
|
650
|
+
self,
|
|
651
|
+
*,
|
|
652
|
+
project_id: int | None = None,
|
|
653
|
+
region_id: int | None = None,
|
|
654
|
+
name: str,
|
|
655
|
+
url: str,
|
|
656
|
+
architecture: Optional[Literal["aarch64", "x86_64"]] | NotGiven = NOT_GIVEN,
|
|
657
|
+
cow_format: bool | NotGiven = NOT_GIVEN,
|
|
658
|
+
hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN,
|
|
659
|
+
os_distro: Optional[str] | NotGiven = NOT_GIVEN,
|
|
660
|
+
os_type: Optional[Literal["linux", "windows"]] | NotGiven = NOT_GIVEN,
|
|
661
|
+
os_version: Optional[str] | NotGiven = NOT_GIVEN,
|
|
662
|
+
ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN,
|
|
663
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
664
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
665
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
666
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
667
|
+
extra_headers: Headers | None = None,
|
|
668
|
+
extra_query: Query | None = None,
|
|
669
|
+
extra_body: Body | None = None,
|
|
670
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
671
|
+
) -> GPUImage:
|
|
672
|
+
"""
|
|
673
|
+
Upload a new bare metal GPU image and wait for the upload to complete.
|
|
674
|
+
"""
|
|
675
|
+
response = await self.upload(
|
|
676
|
+
project_id=project_id,
|
|
677
|
+
region_id=region_id,
|
|
678
|
+
name=name,
|
|
679
|
+
url=url,
|
|
680
|
+
architecture=architecture,
|
|
681
|
+
cow_format=cow_format,
|
|
682
|
+
hw_firmware_type=hw_firmware_type,
|
|
683
|
+
os_distro=os_distro,
|
|
684
|
+
os_type=os_type,
|
|
685
|
+
os_version=os_version,
|
|
686
|
+
ssh_key=ssh_key,
|
|
687
|
+
tags=tags,
|
|
688
|
+
extra_headers=extra_headers,
|
|
689
|
+
extra_query=extra_query,
|
|
690
|
+
extra_body=extra_body,
|
|
691
|
+
timeout=timeout,
|
|
692
|
+
)
|
|
693
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
694
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
695
|
+
task = await self._client.cloud.tasks.poll(
|
|
696
|
+
response.tasks[0],
|
|
697
|
+
extra_headers=extra_headers,
|
|
698
|
+
extra_query=extra_query,
|
|
699
|
+
extra_body=extra_body,
|
|
700
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
701
|
+
)
|
|
702
|
+
if not task.created_resources or not task.created_resources.images:
|
|
703
|
+
raise ValueError("No image was created")
|
|
704
|
+
image_id = task.created_resources.images[0]
|
|
705
|
+
return await self.get(
|
|
706
|
+
image_id=image_id,
|
|
707
|
+
project_id=project_id,
|
|
708
|
+
region_id=region_id,
|
|
709
|
+
extra_headers=extra_headers,
|
|
710
|
+
extra_query=extra_query,
|
|
711
|
+
extra_body=extra_body,
|
|
712
|
+
timeout=timeout,
|
|
713
|
+
)
|
|
714
|
+
|
|
511
715
|
|
|
512
716
|
class ImagesResourceWithRawResponse:
|
|
513
717
|
def __init__(self, images: ImagesResource) -> None:
|