gcore 0.1.0a1__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.

Files changed (78) hide show
  1. gcore/__init__.py +5 -0
  2. gcore/_client.py +9 -0
  3. gcore/_utils/_proxy.py +4 -1
  4. gcore/_utils/_resources_proxy.py +24 -0
  5. gcore/_version.py +1 -1
  6. gcore/resources/__init__.py +14 -0
  7. gcore/resources/cloud/baremetal/servers.py +234 -0
  8. gcore/resources/cloud/billing_reservations.py +24 -0
  9. gcore/resources/cloud/file_shares/file_shares.py +16 -0
  10. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +352 -2
  11. gcore/resources/cloud/gpu_baremetal_clusters/images.py +204 -0
  12. gcore/resources/cloud/gpu_baremetal_clusters/servers.py +80 -0
  13. gcore/resources/cloud/inference/deployments/deployments.py +322 -4
  14. gcore/resources/cloud/instances/images.py +316 -0
  15. gcore/resources/cloud/instances/instances.py +472 -0
  16. gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +282 -0
  17. gcore/resources/cloud/load_balancers/l7_policies/rules.py +326 -0
  18. gcore/resources/cloud/load_balancers/listeners.py +371 -6
  19. gcore/resources/cloud/load_balancers/load_balancers.py +364 -0
  20. gcore/resources/cloud/load_balancers/pools/health_monitors.py +24 -0
  21. gcore/resources/cloud/load_balancers/pools/members.py +28 -0
  22. gcore/resources/cloud/load_balancers/pools/pools.py +388 -8
  23. gcore/resources/cloud/networks/networks.py +72 -16
  24. gcore/resources/cloud/secrets.py +56 -11
  25. gcore/resources/cloud/tasks.py +107 -96
  26. gcore/resources/waap/__init__.py +33 -0
  27. gcore/resources/waap/domains/__init__.py +33 -0
  28. gcore/resources/waap/domains/domains.py +515 -0
  29. gcore/resources/waap/domains/settings.py +271 -0
  30. gcore/resources/waap/waap.py +102 -0
  31. gcore/types/cloud/__init__.py +1 -0
  32. gcore/types/cloud/billing_reservation_list_params.py +5 -0
  33. gcore/types/cloud/container_probe_config_create_param.py +1 -2
  34. gcore/types/cloud/file_share.py +3 -0
  35. gcore/types/cloud/file_share_list_params.py +7 -1
  36. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +20 -0
  37. gcore/types/cloud/inference/deployment_update_params.py +203 -6
  38. gcore/types/cloud/inference/inference.py +3 -1
  39. gcore/types/cloud/load_balancer_listener_detail.py +13 -13
  40. gcore/types/cloud/load_balancer_pool.py +13 -13
  41. gcore/types/cloud/load_balancer_pool_list.py +99 -4
  42. gcore/types/cloud/load_balancers/listener_create_params.py +2 -0
  43. gcore/types/cloud/load_balancers/listener_get_params.py +3 -1
  44. gcore/types/cloud/load_balancers/listener_list_params.py +4 -2
  45. gcore/types/cloud/load_balancers/listener_update_params.py +2 -0
  46. gcore/types/cloud/load_balancers/pool_create_params.py +2 -0
  47. gcore/types/cloud/load_balancers/pool_list_params.py +5 -6
  48. gcore/types/cloud/load_balancers/pool_update_params.py +2 -0
  49. gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +2 -0
  50. gcore/types/cloud/load_balancers/pools/member_add_params.py +2 -0
  51. gcore/types/cloud/network.py +21 -21
  52. gcore/types/cloud/network_create_params.py +2 -0
  53. gcore/types/cloud/network_details.py +24 -23
  54. gcore/types/cloud/network_list_params.py +15 -10
  55. gcore/types/cloud/network_update_params.py +2 -0
  56. gcore/types/cloud/quota_get_all_response.py +18 -0
  57. gcore/types/cloud/quota_get_by_region_response.py +18 -0
  58. gcore/types/cloud/quotas/request_create_params.py +9 -0
  59. gcore/types/cloud/quotas/request_get_response.py +9 -0
  60. gcore/types/cloud/quotas/request_list_response.py +9 -0
  61. gcore/types/cloud/secret_list_params.py +24 -0
  62. gcore/types/cloud/task.py +0 -3
  63. gcore/types/cloud/task_list_params.py +8 -2
  64. gcore/types/waap/__init__.py +12 -0
  65. gcore/types/waap/domain_list_params.py +30 -0
  66. gcore/types/waap/domain_update_params.py +12 -0
  67. gcore/types/waap/domains/__init__.py +5 -0
  68. gcore/types/waap/domains/setting_update_params.py +41 -0
  69. gcore/types/waap/waap_api_urls.py +15 -0
  70. gcore/types/waap/waap_detailed_domain.py +37 -0
  71. gcore/types/waap/waap_domain_ddos_settings.py +31 -0
  72. gcore/types/waap/waap_domain_settings.py +15 -0
  73. gcore/types/waap/waap_domain_status.py +7 -0
  74. gcore/types/waap/waap_summary_domain.py +26 -0
  75. {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/METADATA +4 -7
  76. {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/RECORD +78 -60
  77. {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/WHEEL +0 -0
  78. {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/licenses/LICENSE +0 -0
@@ -236,6 +236,40 @@ class ImagesResource(SyncAPIResource):
236
236
  cast_to=TaskIDList,
237
237
  )
238
238
 
239
+ def delete_and_poll(
240
+ self,
241
+ image_id: str,
242
+ *,
243
+ project_id: int | None = None,
244
+ region_id: int | None = None,
245
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
246
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
247
+ # The extra values given here take precedence over values defined on the client or passed to this method.
248
+ extra_headers: Headers | None = None,
249
+ extra_query: Query | None = None,
250
+ extra_body: Body | None = None,
251
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
252
+ ) -> None:
253
+ """
254
+ Delete 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.
255
+ """
256
+ response = self.delete(
257
+ image_id=image_id,
258
+ project_id=project_id,
259
+ region_id=region_id,
260
+ extra_headers=extra_headers,
261
+ extra_query=extra_query,
262
+ extra_body=extra_body,
263
+ timeout=timeout,
264
+ )
265
+ if not response.tasks:
266
+ raise ValueError("Expected at least one task to be created")
267
+ self._client.cloud.tasks.poll(
268
+ task_id=response.tasks[0],
269
+ extra_headers=extra_headers,
270
+ polling_interval_seconds=polling_interval_seconds,
271
+ )
272
+
239
273
  def create_from_volume(
240
274
  self,
241
275
  *,
@@ -321,6 +355,66 @@ class ImagesResource(SyncAPIResource):
321
355
  cast_to=TaskIDList,
322
356
  )
323
357
 
358
+ def create_from_volume_and_poll(
359
+ self,
360
+ *,
361
+ project_id: int | None = None,
362
+ region_id: int | None = None,
363
+ name: str,
364
+ volume_id: str,
365
+ architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN,
366
+ hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN,
367
+ hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN,
368
+ is_baremetal: bool | NotGiven = NOT_GIVEN,
369
+ os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN,
370
+ source: Literal["volume"] | NotGiven = NOT_GIVEN,
371
+ ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN,
372
+ tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
373
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
374
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
375
+ # The extra values given here take precedence over values defined on the client or passed to this method.
376
+ extra_headers: Headers | None = None,
377
+ extra_query: Query | None = None,
378
+ extra_body: Body | None = None,
379
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
380
+ ) -> Image:
381
+ """
382
+ Create image from volume and poll for completion
383
+ """
384
+ response = self.create_from_volume(
385
+ project_id=project_id,
386
+ region_id=region_id,
387
+ name=name,
388
+ volume_id=volume_id,
389
+ architecture=architecture,
390
+ hw_firmware_type=hw_firmware_type,
391
+ hw_machine_type=hw_machine_type,
392
+ is_baremetal=is_baremetal,
393
+ os_type=os_type,
394
+ source=source,
395
+ ssh_key=ssh_key,
396
+ tags=tags,
397
+ extra_headers=extra_headers,
398
+ extra_query=extra_query,
399
+ extra_body=extra_body,
400
+ timeout=timeout,
401
+ )
402
+ if not response.tasks or len(response.tasks) != 1:
403
+ raise ValueError(f"Expected exactly one task to be created")
404
+ task = self._client.cloud.tasks.poll(
405
+ task_id=response.tasks[0],
406
+ extra_headers=extra_headers,
407
+ polling_interval_seconds=polling_interval_seconds,
408
+ )
409
+ if not task.created_resources or not task.created_resources.images or len(task.created_resources.images) != 1:
410
+ raise ValueError(f"Expected exactly one resource to be created in a task")
411
+ return self.get(
412
+ image_id=task.created_resources.images[0],
413
+ project_id=project_id,
414
+ region_id=region_id,
415
+ extra_headers=extra_headers,
416
+ )
417
+
324
418
  def get(
325
419
  self,
326
420
  image_id: str,
@@ -461,6 +555,70 @@ class ImagesResource(SyncAPIResource):
461
555
  cast_to=TaskIDList,
462
556
  )
463
557
 
558
+ def upload_and_poll(
559
+ self,
560
+ *,
561
+ project_id: int | None = None,
562
+ region_id: int | None = None,
563
+ name: str,
564
+ url: str,
565
+ architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN,
566
+ cow_format: bool | NotGiven = NOT_GIVEN,
567
+ hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN,
568
+ hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN,
569
+ is_baremetal: bool | NotGiven = NOT_GIVEN,
570
+ os_distro: Optional[str] | NotGiven = NOT_GIVEN,
571
+ os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN,
572
+ os_version: Optional[str] | NotGiven = NOT_GIVEN,
573
+ ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN,
574
+ tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
575
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
576
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
577
+ # The extra values given here take precedence over values defined on the client or passed to this method.
578
+ extra_headers: Headers | None = None,
579
+ extra_query: Query | None = None,
580
+ extra_body: Body | None = None,
581
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
582
+ ) -> Image:
583
+ """
584
+ Upload image and poll for completion
585
+ """
586
+ response = self.upload(
587
+ project_id=project_id,
588
+ region_id=region_id,
589
+ name=name,
590
+ url=url,
591
+ architecture=architecture,
592
+ cow_format=cow_format,
593
+ hw_firmware_type=hw_firmware_type,
594
+ hw_machine_type=hw_machine_type,
595
+ is_baremetal=is_baremetal,
596
+ os_distro=os_distro,
597
+ os_type=os_type,
598
+ os_version=os_version,
599
+ ssh_key=ssh_key,
600
+ tags=tags,
601
+ extra_headers=extra_headers,
602
+ extra_query=extra_query,
603
+ extra_body=extra_body,
604
+ timeout=timeout,
605
+ )
606
+ if not response.tasks or len(response.tasks) != 1:
607
+ raise ValueError(f"Expected exactly one task to be created")
608
+ task = self._client.cloud.tasks.poll(
609
+ task_id=response.tasks[0],
610
+ extra_headers=extra_headers,
611
+ polling_interval_seconds=polling_interval_seconds,
612
+ )
613
+ if not task.created_resources or not task.created_resources.images or len(task.created_resources.images) != 1:
614
+ raise ValueError(f"Expected exactly one resource to be created in a task")
615
+ return self.get(
616
+ image_id=task.created_resources.images[0],
617
+ project_id=project_id,
618
+ region_id=region_id,
619
+ extra_headers=extra_headers,
620
+ )
621
+
464
622
 
465
623
  class AsyncImagesResource(AsyncAPIResource):
466
624
  @cached_property
@@ -665,6 +823,40 @@ class AsyncImagesResource(AsyncAPIResource):
665
823
  cast_to=TaskIDList,
666
824
  )
667
825
 
826
+ async def delete_and_poll(
827
+ self,
828
+ image_id: str,
829
+ *,
830
+ project_id: int | None = None,
831
+ region_id: int | None = None,
832
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
833
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
834
+ # The extra values given here take precedence over values defined on the client or passed to this method.
835
+ extra_headers: Headers | None = None,
836
+ extra_query: Query | None = None,
837
+ extra_body: Body | None = None,
838
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
839
+ ) -> None:
840
+ """
841
+ Delete 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.
842
+ """
843
+ response = await self.delete(
844
+ image_id=image_id,
845
+ project_id=project_id,
846
+ region_id=region_id,
847
+ extra_headers=extra_headers,
848
+ extra_query=extra_query,
849
+ extra_body=extra_body,
850
+ timeout=timeout,
851
+ )
852
+ if not response.tasks:
853
+ raise ValueError("Expected at least one task to be created")
854
+ await self._client.cloud.tasks.poll(
855
+ task_id=response.tasks[0],
856
+ extra_headers=extra_headers,
857
+ polling_interval_seconds=polling_interval_seconds,
858
+ )
859
+
668
860
  async def create_from_volume(
669
861
  self,
670
862
  *,
@@ -750,6 +942,66 @@ class AsyncImagesResource(AsyncAPIResource):
750
942
  cast_to=TaskIDList,
751
943
  )
752
944
 
945
+ async def create_from_volume_and_poll(
946
+ self,
947
+ *,
948
+ project_id: int | None = None,
949
+ region_id: int | None = None,
950
+ name: str,
951
+ volume_id: str,
952
+ architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN,
953
+ hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN,
954
+ hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN,
955
+ is_baremetal: bool | NotGiven = NOT_GIVEN,
956
+ os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN,
957
+ source: Literal["volume"] | NotGiven = NOT_GIVEN,
958
+ ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN,
959
+ tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
960
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
961
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
962
+ # The extra values given here take precedence over values defined on the client or passed to this method.
963
+ extra_headers: Headers | None = None,
964
+ extra_query: Query | None = None,
965
+ extra_body: Body | None = None,
966
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
967
+ ) -> Image:
968
+ """
969
+ Create image from volume and poll for completion
970
+ """
971
+ response = await self.create_from_volume(
972
+ project_id=project_id,
973
+ region_id=region_id,
974
+ name=name,
975
+ volume_id=volume_id,
976
+ architecture=architecture,
977
+ hw_firmware_type=hw_firmware_type,
978
+ hw_machine_type=hw_machine_type,
979
+ is_baremetal=is_baremetal,
980
+ os_type=os_type,
981
+ source=source,
982
+ ssh_key=ssh_key,
983
+ tags=tags,
984
+ extra_headers=extra_headers,
985
+ extra_query=extra_query,
986
+ extra_body=extra_body,
987
+ timeout=timeout,
988
+ )
989
+ if not response.tasks or len(response.tasks) != 1:
990
+ raise ValueError(f"Expected exactly one task to be created")
991
+ task = await self._client.cloud.tasks.poll(
992
+ task_id=response.tasks[0],
993
+ extra_headers=extra_headers,
994
+ polling_interval_seconds=polling_interval_seconds,
995
+ )
996
+ if not task.created_resources or not task.created_resources.images or len(task.created_resources.images) != 1:
997
+ raise ValueError(f"Expected exactly one resource to be created in a task")
998
+ return await self.get(
999
+ image_id=task.created_resources.images[0],
1000
+ project_id=project_id,
1001
+ region_id=region_id,
1002
+ extra_headers=extra_headers,
1003
+ )
1004
+
753
1005
  async def get(
754
1006
  self,
755
1007
  image_id: str,
@@ -890,6 +1142,70 @@ class AsyncImagesResource(AsyncAPIResource):
890
1142
  cast_to=TaskIDList,
891
1143
  )
892
1144
 
1145
+ async def upload_and_poll(
1146
+ self,
1147
+ *,
1148
+ project_id: int | None = None,
1149
+ region_id: int | None = None,
1150
+ name: str,
1151
+ url: str,
1152
+ architecture: Literal["aarch64", "x86_64"] | NotGiven = NOT_GIVEN,
1153
+ cow_format: bool | NotGiven = NOT_GIVEN,
1154
+ hw_firmware_type: Optional[Literal["bios", "uefi"]] | NotGiven = NOT_GIVEN,
1155
+ hw_machine_type: Optional[Literal["pc", "q35"]] | NotGiven = NOT_GIVEN,
1156
+ is_baremetal: bool | NotGiven = NOT_GIVEN,
1157
+ os_distro: Optional[str] | NotGiven = NOT_GIVEN,
1158
+ os_type: Literal["linux", "windows"] | NotGiven = NOT_GIVEN,
1159
+ os_version: Optional[str] | NotGiven = NOT_GIVEN,
1160
+ ssh_key: Literal["allow", "deny", "required"] | NotGiven = NOT_GIVEN,
1161
+ tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
1162
+ polling_interval_seconds: int | NotGiven = NOT_GIVEN,
1163
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1164
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1165
+ extra_headers: Headers | None = None,
1166
+ extra_query: Query | None = None,
1167
+ extra_body: Body | None = None,
1168
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1169
+ ) -> Image:
1170
+ """
1171
+ Upload image and poll for completion
1172
+ """
1173
+ response = await self.upload(
1174
+ project_id=project_id,
1175
+ region_id=region_id,
1176
+ name=name,
1177
+ url=url,
1178
+ architecture=architecture,
1179
+ cow_format=cow_format,
1180
+ hw_firmware_type=hw_firmware_type,
1181
+ hw_machine_type=hw_machine_type,
1182
+ is_baremetal=is_baremetal,
1183
+ os_distro=os_distro,
1184
+ os_type=os_type,
1185
+ os_version=os_version,
1186
+ ssh_key=ssh_key,
1187
+ tags=tags,
1188
+ extra_headers=extra_headers,
1189
+ extra_query=extra_query,
1190
+ extra_body=extra_body,
1191
+ timeout=timeout,
1192
+ )
1193
+ if not response.tasks or len(response.tasks) != 1:
1194
+ raise ValueError(f"Expected exactly one task to be created")
1195
+ task = await self._client.cloud.tasks.poll(
1196
+ task_id=response.tasks[0],
1197
+ extra_headers=extra_headers,
1198
+ polling_interval_seconds=polling_interval_seconds,
1199
+ )
1200
+ if not task.created_resources or not task.created_resources.images or len(task.created_resources.images) != 1:
1201
+ raise ValueError(f"Expected exactly one resource to be created in a task")
1202
+ return await self.get(
1203
+ image_id=task.created_resources.images[0],
1204
+ project_id=project_id,
1205
+ region_id=region_id,
1206
+ extra_headers=extra_headers,
1207
+ )
1208
+
893
1209
 
894
1210
  class ImagesResourceWithRawResponse:
895
1211
  def __init__(self, images: ImagesResource) -> None: