gcore 0.13.0__py3-none-any.whl → 0.14.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 (334) hide show
  1. gcore/__init__.py +3 -1
  2. gcore/_base_client.py +9 -9
  3. gcore/_client.py +25 -10
  4. gcore/_models.py +10 -4
  5. gcore/_qs.py +7 -7
  6. gcore/_types.py +18 -11
  7. gcore/_utils/_transform.py +2 -2
  8. gcore/_utils/_utils.py +4 -4
  9. gcore/_version.py +1 -1
  10. gcore/pagination.py +137 -0
  11. gcore/resources/__init__.py +14 -0
  12. gcore/resources/cdn/__init__.py +201 -0
  13. gcore/resources/cdn/audit_log.py +406 -0
  14. gcore/resources/cdn/cdn.py +957 -0
  15. gcore/resources/cdn/certificates.py +1062 -0
  16. gcore/resources/cdn/ip_ranges.py +224 -0
  17. gcore/resources/cdn/logs/__init__.py +33 -0
  18. gcore/resources/cdn/logs/logs.py +1424 -0
  19. gcore/resources/cdn/logs/settings.py +1081 -0
  20. gcore/resources/cdn/logs_uploader/__init__.py +61 -0
  21. gcore/resources/cdn/logs_uploader/configs.py +868 -0
  22. gcore/resources/cdn/logs_uploader/logs_uploader.py +166 -0
  23. gcore/resources/cdn/logs_uploader/policies.py +1060 -0
  24. gcore/resources/cdn/logs_uploader/targets.py +811 -0
  25. gcore/resources/cdn/metrics.py +419 -0
  26. gcore/resources/cdn/network_capacity.py +139 -0
  27. gcore/resources/cdn/origin_groups.py +1496 -0
  28. gcore/resources/cdn/resources/__init__.py +47 -0
  29. gcore/resources/cdn/resources/resources.py +2060 -0
  30. gcore/resources/cdn/resources/rules.py +1027 -0
  31. gcore/resources/cdn/resources/shield.py +259 -0
  32. gcore/resources/cdn/rule_templates.py +883 -0
  33. gcore/resources/cdn/shields.py +139 -0
  34. gcore/resources/cdn/statistics.py +1408 -0
  35. gcore/resources/cdn/trusted_ca_certificates.py +592 -0
  36. gcore/resources/cloud/audit_logs.py +33 -29
  37. gcore/resources/cloud/baremetal/flavors.py +21 -17
  38. gcore/resources/cloud/baremetal/images.py +19 -15
  39. gcore/resources/cloud/baremetal/servers.py +141 -119
  40. gcore/resources/cloud/billing_reservations.py +41 -33
  41. gcore/resources/cloud/cloud.py +24 -0
  42. gcore/resources/cloud/cost_reports.py +149 -119
  43. gcore/resources/cloud/file_shares/access_rules.py +25 -13
  44. gcore/resources/cloud/file_shares/file_shares.py +107 -71
  45. gcore/resources/cloud/floating_ips.py +101 -59
  46. gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +13 -9
  47. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +275 -65
  48. gcore/resources/cloud/gpu_baremetal_clusters/images.py +69 -53
  49. gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +9 -5
  50. gcore/resources/cloud/gpu_baremetal_clusters/servers.py +151 -127
  51. gcore/resources/cloud/inference/api_keys.py +51 -31
  52. gcore/resources/cloud/inference/applications/deployments.py +49 -31
  53. gcore/resources/cloud/inference/applications/templates.py +17 -9
  54. gcore/resources/cloud/inference/deployments/deployments.py +171 -139
  55. gcore/resources/cloud/inference/deployments/logs.py +17 -13
  56. gcore/resources/cloud/inference/flavors.py +21 -13
  57. gcore/resources/cloud/inference/inference.py +9 -5
  58. gcore/resources/cloud/inference/registry_credentials.py +45 -25
  59. gcore/resources/cloud/inference/secrets.py +45 -25
  60. gcore/resources/cloud/instances/flavors.py +17 -13
  61. gcore/resources/cloud/instances/images.py +153 -129
  62. gcore/resources/cloud/instances/instances.py +287 -213
  63. gcore/resources/cloud/instances/interfaces.py +165 -161
  64. gcore/resources/cloud/instances/metrics.py +9 -5
  65. gcore/resources/cloud/ip_ranges.py +25 -15
  66. gcore/resources/cloud/k8s/clusters/clusters.py +151 -87
  67. gcore/resources/cloud/k8s/clusters/nodes.py +19 -11
  68. gcore/resources/cloud/k8s/clusters/pools/nodes.py +19 -11
  69. gcore/resources/cloud/k8s/clusters/pools/pools.py +83 -59
  70. gcore/resources/cloud/k8s/flavors.py +13 -9
  71. gcore/resources/cloud/k8s/k8s.py +9 -5
  72. gcore/resources/cloud/load_balancers/flavors.py +11 -7
  73. gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +103 -83
  74. gcore/resources/cloud/load_balancers/l7_policies/rules.py +77 -57
  75. gcore/resources/cloud/load_balancers/listeners.py +125 -105
  76. gcore/resources/cloud/load_balancers/load_balancers.py +155 -123
  77. gcore/resources/cloud/load_balancers/metrics.py +9 -5
  78. gcore/resources/cloud/load_balancers/pools/health_monitors.py +25 -17
  79. gcore/resources/cloud/load_balancers/pools/members.py +31 -23
  80. gcore/resources/cloud/load_balancers/pools/pools.py +155 -129
  81. gcore/resources/cloud/load_balancers/statuses.py +17 -9
  82. gcore/resources/cloud/networks/networks.py +79 -55
  83. gcore/resources/cloud/networks/routers.py +75 -47
  84. gcore/resources/cloud/networks/subnets.py +105 -81
  85. gcore/resources/cloud/placement_groups.py +33 -17
  86. gcore/resources/cloud/projects.py +53 -41
  87. gcore/resources/cloud/quotas/quotas.py +25 -13
  88. gcore/resources/cloud/quotas/requests.py +41 -25
  89. gcore/resources/cloud/regions.py +25 -23
  90. gcore/resources/cloud/registries/artifacts.py +17 -9
  91. gcore/resources/cloud/registries/registries.py +55 -29
  92. gcore/resources/cloud/registries/repositories.py +17 -9
  93. gcore/resources/cloud/registries/tags.py +9 -5
  94. gcore/resources/cloud/registries/users.py +65 -35
  95. gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +123 -107
  96. gcore/resources/cloud/reserved_fixed_ips/vip.py +45 -25
  97. gcore/resources/cloud/secrets.py +43 -27
  98. gcore/resources/cloud/security_groups/rules.py +55 -43
  99. gcore/resources/cloud/security_groups/security_groups.py +79 -47
  100. gcore/resources/cloud/ssh_keys.py +51 -31
  101. gcore/resources/cloud/tasks.py +57 -45
  102. gcore/resources/cloud/usage_reports.py +27 -23
  103. gcore/resources/cloud/users/role_assignments.py +49 -33
  104. gcore/resources/cloud/volumes.py +237 -201
  105. gcore/resources/dns/dns.py +17 -13
  106. gcore/resources/dns/locations.py +29 -17
  107. gcore/resources/dns/metrics.py +13 -9
  108. gcore/resources/dns/pickers/pickers.py +5 -5
  109. gcore/resources/dns/pickers/presets.py +9 -5
  110. gcore/resources/dns/zones/dnssec.py +19 -11
  111. gcore/resources/dns/zones/rrsets.py +149 -91
  112. gcore/resources/dns/zones/zones.py +245 -187
  113. gcore/resources/fastedge/apps/apps.py +105 -89
  114. gcore/resources/fastedge/apps/logs.py +25 -21
  115. gcore/resources/fastedge/binaries.py +33 -17
  116. gcore/resources/fastedge/fastedge.py +5 -5
  117. gcore/resources/fastedge/kv_stores.py +43 -31
  118. gcore/resources/fastedge/secrets.py +69 -45
  119. gcore/resources/fastedge/statistics.py +25 -17
  120. gcore/resources/fastedge/templates.py +59 -39
  121. gcore/resources/iam/api_tokens.py +43 -27
  122. gcore/resources/iam/iam.py +5 -5
  123. gcore/resources/iam/users.py +97 -65
  124. gcore/resources/security/bgp_announces.py +27 -19
  125. gcore/resources/security/events.py +23 -19
  126. gcore/resources/security/profile_templates.py +9 -5
  127. gcore/resources/security/profiles.py +69 -45
  128. gcore/resources/storage/buckets/buckets.py +37 -25
  129. gcore/resources/storage/buckets/cors.py +19 -11
  130. gcore/resources/storage/buckets/lifecycle.py +19 -11
  131. gcore/resources/storage/buckets/policy.py +25 -13
  132. gcore/resources/storage/credentials.py +19 -15
  133. gcore/resources/storage/locations.py +13 -9
  134. gcore/resources/storage/statistics.py +39 -31
  135. gcore/resources/storage/storage.py +105 -69
  136. gcore/resources/streaming/ai_tasks.py +307 -197
  137. gcore/resources/streaming/broadcasts.py +63 -35
  138. gcore/resources/streaming/directories.py +65 -39
  139. gcore/resources/streaming/players.py +47 -31
  140. gcore/resources/streaming/playlists.py +189 -123
  141. gcore/resources/streaming/quality_sets.py +69 -39
  142. gcore/resources/streaming/restreams.py +47 -27
  143. gcore/resources/streaming/statistics.py +613 -407
  144. gcore/resources/streaming/streams/overlays.py +107 -67
  145. gcore/resources/streaming/streams/streams.py +403 -263
  146. gcore/resources/streaming/videos/subtitles.py +131 -75
  147. gcore/resources/streaming/videos/videos.py +429 -279
  148. gcore/resources/waap/advanced_rules.py +9 -5
  149. gcore/resources/waap/custom_page_sets.py +99 -75
  150. gcore/resources/waap/domains/advanced_rules.py +157 -99
  151. gcore/resources/waap/domains/api_discovery.py +71 -47
  152. gcore/resources/waap/domains/api_path_groups.py +9 -5
  153. gcore/resources/waap/domains/api_paths.py +79 -83
  154. gcore/resources/waap/domains/custom_rules.py +89 -59
  155. gcore/resources/waap/domains/domains.py +59 -41
  156. gcore/resources/waap/domains/firewall_rules.py +83 -55
  157. gcore/resources/waap/domains/insight_silences.py +59 -39
  158. gcore/resources/waap/domains/insights.py +39 -27
  159. gcore/resources/waap/domains/settings.py +21 -13
  160. gcore/resources/waap/domains/statistics.py +99 -75
  161. gcore/resources/waap/insights.py +23 -21
  162. gcore/resources/waap/ip_info/ip_info.py +65 -33
  163. gcore/resources/waap/ip_info/metrics.py +11 -7
  164. gcore/resources/waap/organizations.py +17 -13
  165. gcore/resources/waap/statistics.py +9 -5
  166. gcore/resources/waap/tags.py +17 -17
  167. gcore/resources/waap/waap.py +5 -5
  168. gcore/types/cdn/__init__.py +80 -0
  169. gcore/types/cdn/audit_log_list_params.py +73 -0
  170. gcore/types/cdn/ca_certificate.py +53 -0
  171. gcore/types/cdn/ca_certificate_list.py +10 -0
  172. gcore/types/cdn/cdn_account.py +86 -0
  173. gcore/types/cdn/cdn_account_limits.py +27 -0
  174. gcore/types/cdn/cdn_audit_log_entry.py +66 -0
  175. gcore/types/cdn/cdn_available_features.py +46 -0
  176. gcore/types/cdn/cdn_list_purge_statuses_params.py +67 -0
  177. gcore/types/cdn/cdn_log_entry.py +70 -0
  178. gcore/types/cdn/cdn_metrics.py +22 -0
  179. gcore/types/cdn/cdn_metrics_groups.py +13 -0
  180. gcore/types/cdn/cdn_metrics_values.py +19 -0
  181. gcore/types/cdn/cdn_resource.py +1977 -0
  182. gcore/types/cdn/cdn_resource_list.py +10 -0
  183. gcore/types/cdn/cdn_update_account_params.py +15 -0
  184. gcore/types/cdn/certificate_create_params.py +51 -0
  185. gcore/types/cdn/certificate_get_status_params.py +14 -0
  186. gcore/types/cdn/certificate_list_params.py +29 -0
  187. gcore/types/cdn/certificate_replace_params.py +39 -0
  188. gcore/types/cdn/log_download_params.py +279 -0
  189. gcore/types/cdn/log_list_params.py +273 -0
  190. gcore/types/cdn/logs/__init__.py +7 -0
  191. gcore/types/cdn/logs/log_settings.py +172 -0
  192. gcore/types/cdn/logs/setting_create_params.py +200 -0
  193. gcore/types/cdn/logs/setting_update_params.py +200 -0
  194. gcore/types/cdn/logs_aggregated_stats.py +23 -0
  195. gcore/types/cdn/logs_uploader/__init__.py +23 -0
  196. gcore/types/cdn/logs_uploader/config_create_params.py +32 -0
  197. gcore/types/cdn/logs_uploader/config_list_params.py +16 -0
  198. gcore/types/cdn/logs_uploader/config_replace_params.py +32 -0
  199. gcore/types/cdn/logs_uploader/config_update_params.py +32 -0
  200. gcore/types/cdn/logs_uploader/logs_uploader_config.py +51 -0
  201. gcore/types/cdn/logs_uploader/logs_uploader_config_list.py +10 -0
  202. gcore/types/cdn/logs_uploader/logs_uploader_policy.py +73 -0
  203. gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py +10 -0
  204. gcore/types/cdn/logs_uploader/logs_uploader_target.py +236 -0
  205. gcore/types/cdn/logs_uploader/logs_uploader_target_list.py +10 -0
  206. gcore/types/cdn/logs_uploader/policy_create_params.py +61 -0
  207. gcore/types/cdn/logs_uploader/policy_list_fields_response.py +8 -0
  208. gcore/types/cdn/logs_uploader/policy_list_params.py +16 -0
  209. gcore/types/cdn/logs_uploader/policy_replace_params.py +61 -0
  210. gcore/types/cdn/logs_uploader/policy_update_params.py +61 -0
  211. gcore/types/cdn/logs_uploader/target_create_params.py +249 -0
  212. gcore/types/cdn/logs_uploader/target_list_params.py +16 -0
  213. gcore/types/cdn/logs_uploader/target_replace_params.py +249 -0
  214. gcore/types/cdn/logs_uploader/target_update_params.py +249 -0
  215. gcore/types/cdn/logs_uploader_validation.py +23 -0
  216. gcore/types/cdn/metric_list_params.py +168 -0
  217. gcore/types/cdn/network_capacity.py +22 -0
  218. gcore/types/cdn/origin_group_create_params.py +184 -0
  219. gcore/types/cdn/origin_group_list_params.py +24 -0
  220. gcore/types/cdn/origin_group_replace_params.py +190 -0
  221. gcore/types/cdn/origin_group_update_params.py +190 -0
  222. gcore/types/cdn/origin_groups.py +212 -0
  223. gcore/types/cdn/origin_groups_list.py +10 -0
  224. gcore/types/cdn/public_ip_list.py +15 -0
  225. gcore/types/cdn/public_network_list.py +15 -0
  226. gcore/types/cdn/purge_status.py +55 -0
  227. gcore/types/cdn/resource_aggregated_stats.py +80 -0
  228. gcore/types/cdn/resource_create_params.py +1825 -0
  229. gcore/types/cdn/resource_list_params.py +107 -0
  230. gcore/types/cdn/resource_prefetch_params.py +17 -0
  231. gcore/types/cdn/resource_purge_params.py +71 -0
  232. gcore/types/cdn/resource_replace_params.py +1803 -0
  233. gcore/types/cdn/resource_update_params.py +1794 -0
  234. gcore/types/cdn/resource_usage_stats.py +111 -0
  235. gcore/types/cdn/resources/__init__.py +11 -0
  236. gcore/types/cdn/resources/cdn_resource_rule.py +1695 -0
  237. gcore/types/cdn/resources/origin_shielding.py +15 -0
  238. gcore/types/cdn/resources/rule_create_params.py +1652 -0
  239. gcore/types/cdn/resources/rule_list_response.py +10 -0
  240. gcore/types/cdn/resources/rule_replace_params.py +1654 -0
  241. gcore/types/cdn/resources/rule_update_params.py +1654 -0
  242. gcore/types/cdn/resources/shield_replace_params.py +16 -0
  243. gcore/types/cdn/rule_template.py +1666 -0
  244. gcore/types/cdn/rule_template_create_params.py +1636 -0
  245. gcore/types/cdn/rule_template_list.py +10 -0
  246. gcore/types/cdn/rule_template_replace_params.py +1636 -0
  247. gcore/types/cdn/rule_template_update_params.py +1636 -0
  248. gcore/types/cdn/shield_aggregated_stats.py +23 -0
  249. gcore/types/cdn/shield_list_response.py +25 -0
  250. gcore/types/cdn/ssl_detail.py +62 -0
  251. gcore/types/cdn/ssl_detail_list.py +10 -0
  252. gcore/types/cdn/ssl_request_status.py +135 -0
  253. gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py +42 -0
  254. gcore/types/cdn/statistic_get_logs_usage_series_params.py +35 -0
  255. gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py +151 -0
  256. gcore/types/cdn/statistic_get_resource_usage_series_params.py +131 -0
  257. gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py +42 -0
  258. gcore/types/cdn/statistic_get_shield_usage_series_params.py +25 -0
  259. gcore/types/cdn/trusted_ca_certificate_create_params.py +23 -0
  260. gcore/types/cdn/trusted_ca_certificate_list_params.py +29 -0
  261. gcore/types/cdn/trusted_ca_certificate_replace_params.py +15 -0
  262. gcore/types/cdn/usage_series_stats.py +31 -0
  263. gcore/types/cloud/__init__.py +1 -0
  264. gcore/types/cloud/file_share.py +4 -0
  265. gcore/types/cloud/file_share_create_params.py +20 -0
  266. gcore/types/cloud/file_share_update_params.py +40 -3
  267. gcore/types/cloud/floating_ip_update_params.py +3 -1
  268. gcore/types/cloud/gpu_baremetal_cluster_action_params.py +46 -0
  269. gcore/types/cloud/inference/inference_deployment.py +3 -1
  270. gcore/types/cloud/instance_create_params.py +3 -1
  271. gcore/types/cloud/k8s/cluster_create_params.py +46 -4
  272. gcore/types/cloud/k8s/cluster_update_params.py +60 -6
  273. gcore/types/cloud/k8s/clusters/pool_update_params.py +1 -1
  274. gcore/types/cloud/k8s/k8s_cluster.py +40 -3
  275. gcore/types/cloud/load_balancer_update_params.py +3 -1
  276. gcore/types/cloud/network_update_params.py +3 -1
  277. gcore/types/cloud/networks/subnet_update_params.py +3 -1
  278. gcore/types/cloud/registries/user_create_multiple_params.py +5 -3
  279. gcore/types/cloud/registries/user_create_params.py +5 -3
  280. gcore/types/cloud/registry_create_params.py +5 -3
  281. gcore/types/cloud/security_group_update_params.py +3 -1
  282. gcore/types/cloud/ssh_key_created.py +6 -3
  283. gcore/types/cloud/volume_update_params.py +3 -1
  284. gcore/types/dns/zone_get_statistics_params.py +12 -9
  285. gcore/types/dns/zone_get_statistics_response.py +3 -1
  286. gcore/types/dns/zone_import_params.py +21 -15
  287. gcore/types/dns/zones/dns_output_rrset.py +7 -3
  288. gcore/types/iam/account_overview.py +7 -2
  289. gcore/types/iam/user.py +7 -2
  290. gcore/types/iam/user_detailed.py +7 -2
  291. gcore/types/iam/user_invite_params.py +4 -1
  292. gcore/types/iam/user_update.py +7 -2
  293. gcore/types/iam/user_update_params.py +7 -2
  294. gcore/types/streaming/ai_contentmoderation_hardnudity.py +6 -4
  295. gcore/types/streaming/ai_contentmoderation_nsfw.py +6 -4
  296. gcore/types/streaming/ai_contentmoderation_softnudity.py +6 -4
  297. gcore/types/streaming/ai_contentmoderation_sport.py +6 -4
  298. gcore/types/streaming/ai_task.py +20 -11
  299. gcore/types/streaming/ai_task_create_params.py +20 -11
  300. gcore/types/streaming/ai_task_get_response.py +5 -4
  301. gcore/types/streaming/ai_task_list_params.py +11 -5
  302. gcore/types/streaming/clip.py +33 -22
  303. gcore/types/streaming/create_video_param.py +75 -43
  304. gcore/types/streaming/playlist.py +7 -5
  305. gcore/types/streaming/playlist_create_params.py +7 -5
  306. gcore/types/streaming/playlist_update_params.py +7 -5
  307. gcore/types/streaming/playlist_video.py +75 -43
  308. gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +7 -4
  309. gcore/types/streaming/stream.py +207 -136
  310. gcore/types/streaming/stream_create_clip_params.py +33 -22
  311. gcore/types/streaming/stream_create_params.py +41 -24
  312. gcore/types/streaming/stream_update_params.py +41 -24
  313. gcore/types/streaming/video.py +138 -76
  314. gcore/types/streaming/video_list_params.py +4 -2
  315. gcore/types/streaming/video_update_params.py +75 -43
  316. gcore/types/waap/domain_update_params.py +2 -2
  317. gcore/types/waap/domains/advanced_rule_create_params.py +26 -18
  318. gcore/types/waap/domains/advanced_rule_list_params.py +10 -7
  319. gcore/types/waap/domains/advanced_rule_update_params.py +22 -17
  320. gcore/types/waap/domains/api_path_create_params.py +0 -3
  321. gcore/types/waap/domains/api_path_update_params.py +1 -3
  322. gcore/types/waap/domains/custom_rule_create_params.py +36 -35
  323. gcore/types/waap/domains/custom_rule_update_params.py +31 -33
  324. gcore/types/waap/domains/firewall_rule_create_params.py +6 -6
  325. gcore/types/waap/domains/firewall_rule_update_params.py +5 -5
  326. gcore/types/waap/domains/waap_advanced_rule.py +17 -9
  327. gcore/types/waap/domains/waap_custom_rule.py +5 -2
  328. gcore/types/waap/domains/waap_firewall_rule.py +1 -1
  329. gcore/types/waap/domains/waap_insight.py +1 -1
  330. gcore/types/waap/insight_list_types_params.py +1 -1
  331. {gcore-0.13.0.dist-info → gcore-0.14.0.dist-info}/METADATA +1 -1
  332. {gcore-0.13.0.dist-info → gcore-0.14.0.dist-info}/RECORD +334 -214
  333. {gcore-0.13.0.dist-info → gcore-0.14.0.dist-info}/WHEEL +0 -0
  334. {gcore-0.13.0.dist-info → gcore-0.14.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,2060 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, overload
7
+
8
+ import httpx
9
+
10
+ from .rules import (
11
+ RulesResource,
12
+ AsyncRulesResource,
13
+ RulesResourceWithRawResponse,
14
+ AsyncRulesResourceWithRawResponse,
15
+ RulesResourceWithStreamingResponse,
16
+ AsyncRulesResourceWithStreamingResponse,
17
+ )
18
+ from .shield import (
19
+ ShieldResource,
20
+ AsyncShieldResource,
21
+ ShieldResourceWithRawResponse,
22
+ AsyncShieldResourceWithRawResponse,
23
+ ShieldResourceWithStreamingResponse,
24
+ AsyncShieldResourceWithStreamingResponse,
25
+ )
26
+ from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given
27
+ from ...._utils import maybe_transform, async_maybe_transform
28
+ from ...._compat import cached_property
29
+ from ...._resource import SyncAPIResource, AsyncAPIResource
30
+ from ...._response import (
31
+ to_raw_response_wrapper,
32
+ to_streamed_response_wrapper,
33
+ async_to_raw_response_wrapper,
34
+ async_to_streamed_response_wrapper,
35
+ )
36
+ from ....types.cdn import (
37
+ resource_list_params,
38
+ resource_purge_params,
39
+ resource_create_params,
40
+ resource_update_params,
41
+ resource_replace_params,
42
+ resource_prefetch_params,
43
+ )
44
+ from ...._base_client import make_request_options
45
+ from ....types.cdn.cdn_resource import CdnResource
46
+ from ....types.cdn.cdn_resource_list import CdnResourceList
47
+
48
+ __all__ = ["ResourcesResource", "AsyncResourcesResource"]
49
+
50
+
51
+ class ResourcesResource(SyncAPIResource):
52
+ @cached_property
53
+ def shield(self) -> ShieldResource:
54
+ return ShieldResource(self._client)
55
+
56
+ @cached_property
57
+ def rules(self) -> RulesResource:
58
+ return RulesResource(self._client)
59
+
60
+ @cached_property
61
+ def with_raw_response(self) -> ResourcesResourceWithRawResponse:
62
+ """
63
+ This property can be used as a prefix for any HTTP method call to return
64
+ the raw response object instead of the parsed content.
65
+
66
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
67
+ """
68
+ return ResourcesResourceWithRawResponse(self)
69
+
70
+ @cached_property
71
+ def with_streaming_response(self) -> ResourcesResourceWithStreamingResponse:
72
+ """
73
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
74
+
75
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
76
+ """
77
+ return ResourcesResourceWithStreamingResponse(self)
78
+
79
+ def create(
80
+ self,
81
+ *,
82
+ cname: str,
83
+ origin: str,
84
+ origin_group: int,
85
+ active: bool | Omit = omit,
86
+ description: str | Omit = omit,
87
+ name: Optional[str] | Omit = omit,
88
+ options: resource_create_params.Options | Omit = omit,
89
+ origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit,
90
+ primary_resource: Optional[int] | Omit = omit,
91
+ proxy_ssl_ca: Optional[int] | Omit = omit,
92
+ proxy_ssl_data: Optional[int] | Omit = omit,
93
+ proxy_ssl_enabled: bool | Omit = omit,
94
+ secondary_hostnames: SequenceNotStr[str] | Omit = omit,
95
+ ssl_data: Optional[int] | Omit = omit,
96
+ ssl_enabled: bool | Omit = omit,
97
+ waap_api_domain_enabled: bool | Omit = omit,
98
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
99
+ # The extra values given here take precedence over values defined on the client or passed to this method.
100
+ extra_headers: Headers | None = None,
101
+ extra_query: Query | None = None,
102
+ extra_body: Body | None = None,
103
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
104
+ ) -> CdnResource:
105
+ """
106
+ Create CDN resource
107
+
108
+ Args:
109
+ cname: Delivery domains that will be used for content delivery through a CDN.
110
+
111
+ Delivery domains should be added to your DNS settings.
112
+
113
+ origin: IP address or domain name of the origin and the port, if custom port is used.
114
+
115
+ You can use either the `origin` or `originGroup` parameter in the request.
116
+
117
+ origin_group: Origin group ID with which the CDN resource is associated.
118
+
119
+ You can use either the `origin` or `originGroup` parameter in the request.
120
+
121
+ active: Enables or disables a CDN resource.
122
+
123
+ Possible values:
124
+
125
+ - **true** - CDN resource is active. Content is being delivered.
126
+ - **false** - CDN resource is deactivated. Content is not being delivered.
127
+
128
+ description: Optional comment describing the CDN resource.
129
+
130
+ name: CDN resource name.
131
+
132
+ options: List of options that can be configured for the CDN resource.
133
+
134
+ In case of `null` value the option is not added to the CDN resource. Option may
135
+ inherit its value from the global account settings.
136
+
137
+ origin_protocol: Protocol used by CDN servers to request content from an origin source.
138
+
139
+ Possible values:
140
+
141
+ - **HTTPS** - CDN servers will connect to the origin via HTTPS.
142
+ - **HTTP** - CDN servers will connect to the origin via HTTP.
143
+ - **MATCH** - connection protocol will be chosen automatically (content on the
144
+ origin source should be available for the CDN both through HTTP and HTTPS).
145
+
146
+ If protocol is not specified, HTTP is used to connect to an origin server.
147
+
148
+ primary_resource: ID of the main CDN resource which has a shared caching zone with a reserve CDN
149
+ resource.
150
+
151
+ If the parameter is not empty, then the current CDN resource is the reserve. You
152
+ cannot change some options, create rules, set up origin shielding, or use the
153
+ reserve CDN resource for Streaming.
154
+
155
+ proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin.
156
+
157
+ It can be used only with `"`proxy_ssl_enabled`": true`.
158
+
159
+ proxy_ssl_data: ID of the SSL certificate used to verify an origin.
160
+
161
+ It can be used only with `"`proxy_ssl_enabled`": true`.
162
+
163
+ proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before
164
+ completing any connection.
165
+
166
+ Possible values:
167
+
168
+ - **true** - Origin SSL certificate validation is enabled.
169
+ - **false** - Origin SSL certificate validation is disabled.
170
+
171
+ secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via
172
+ the CDN.
173
+
174
+ Up to ten additional CNAMEs are possible.
175
+
176
+ ssl_data: ID of the SSL certificate linked to the CDN resource.
177
+
178
+ Can be used only with `"sslEnabled": true`.
179
+
180
+ ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery.
181
+
182
+ Possible values:
183
+
184
+ - **true** - HTTPS is enabled.
185
+ - **false** - HTTPS is disabled.
186
+
187
+ waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain.
188
+
189
+ Possible values:
190
+
191
+ - **true** - The associated WAAP Domain is designated as an API Domain.
192
+ - **false** - The associated WAAP Domain is not designated as an API Domain.
193
+
194
+ extra_headers: Send extra headers
195
+
196
+ extra_query: Add additional query parameters to the request
197
+
198
+ extra_body: Add additional JSON properties to the request
199
+
200
+ timeout: Override the client-level default timeout for this request, in seconds
201
+ """
202
+ return self._post(
203
+ "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources",
204
+ body=maybe_transform(
205
+ {
206
+ "cname": cname,
207
+ "origin": origin,
208
+ "origin_group": origin_group,
209
+ "active": active,
210
+ "description": description,
211
+ "name": name,
212
+ "options": options,
213
+ "origin_protocol": origin_protocol,
214
+ "primary_resource": primary_resource,
215
+ "proxy_ssl_ca": proxy_ssl_ca,
216
+ "proxy_ssl_data": proxy_ssl_data,
217
+ "proxy_ssl_enabled": proxy_ssl_enabled,
218
+ "secondary_hostnames": secondary_hostnames,
219
+ "ssl_data": ssl_data,
220
+ "ssl_enabled": ssl_enabled,
221
+ "waap_api_domain_enabled": waap_api_domain_enabled,
222
+ },
223
+ resource_create_params.ResourceCreateParams,
224
+ ),
225
+ options=make_request_options(
226
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
227
+ ),
228
+ cast_to=CdnResource,
229
+ )
230
+
231
+ def update(
232
+ self,
233
+ resource_id: int,
234
+ *,
235
+ active: bool | Omit = omit,
236
+ description: str | Omit = omit,
237
+ name: Optional[str] | Omit = omit,
238
+ options: resource_update_params.Options | Omit = omit,
239
+ origin_group: int | Omit = omit,
240
+ origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit,
241
+ proxy_ssl_ca: Optional[int] | Omit = omit,
242
+ proxy_ssl_data: Optional[int] | Omit = omit,
243
+ proxy_ssl_enabled: bool | Omit = omit,
244
+ secondary_hostnames: SequenceNotStr[str] | Omit = omit,
245
+ ssl_data: Optional[int] | Omit = omit,
246
+ ssl_enabled: bool | Omit = omit,
247
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
248
+ # The extra values given here take precedence over values defined on the client or passed to this method.
249
+ extra_headers: Headers | None = None,
250
+ extra_query: Query | None = None,
251
+ extra_body: Body | None = None,
252
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
253
+ ) -> CdnResource:
254
+ """
255
+ Change CDN resource
256
+
257
+ Args:
258
+ active: Enables or disables a CDN resource.
259
+
260
+ Possible values:
261
+
262
+ - **true** - CDN resource is active. Content is being delivered.
263
+ - **false** - CDN resource is deactivated. Content is not being delivered.
264
+
265
+ description: Optional comment describing the CDN resource.
266
+
267
+ name: CDN resource name.
268
+
269
+ options: List of options that can be configured for the CDN resource.
270
+
271
+ In case of `null` value the option is not added to the CDN resource. Option may
272
+ inherit its value from the global account settings.
273
+
274
+ origin_group: Origin group ID with which the CDN resource is associated.
275
+
276
+ You can use either the `origin` or `originGroup` parameter in the request.
277
+
278
+ origin_protocol: Protocol used by CDN servers to request content from an origin source.
279
+
280
+ Possible values:
281
+
282
+ - **HTTPS** - CDN servers will connect to the origin via HTTPS.
283
+ - **HTTP** - CDN servers will connect to the origin via HTTP.
284
+ - **MATCH** - connection protocol will be chosen automatically (content on the
285
+ origin source should be available for the CDN both through HTTP and HTTPS).
286
+
287
+ If protocol is not specified, HTTP is used to connect to an origin server.
288
+
289
+ proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin.
290
+
291
+ It can be used only with `"`proxy_ssl_enabled`": true`.
292
+
293
+ proxy_ssl_data: ID of the SSL certificate used to verify an origin.
294
+
295
+ It can be used only with `"`proxy_ssl_enabled`": true`.
296
+
297
+ proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before
298
+ completing any connection.
299
+
300
+ Possible values:
301
+
302
+ - **true** - Origin SSL certificate validation is enabled.
303
+ - **false** - Origin SSL certificate validation is disabled.
304
+
305
+ secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via
306
+ the CDN.
307
+
308
+ Up to ten additional CNAMEs are possible.
309
+
310
+ ssl_data: ID of the SSL certificate linked to the CDN resource.
311
+
312
+ Can be used only with `"sslEnabled": true`.
313
+
314
+ ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery.
315
+
316
+ Possible values:
317
+
318
+ - **true** - HTTPS is enabled.
319
+ - **false** - HTTPS is disabled.
320
+
321
+ extra_headers: Send extra headers
322
+
323
+ extra_query: Add additional query parameters to the request
324
+
325
+ extra_body: Add additional JSON properties to the request
326
+
327
+ timeout: Override the client-level default timeout for this request, in seconds
328
+ """
329
+ return self._patch(
330
+ f"/cdn/resources/{resource_id}"
331
+ if self._client._base_url_overridden
332
+ else f"https://api.gcore.com//cdn/resources/{resource_id}",
333
+ body=maybe_transform(
334
+ {
335
+ "active": active,
336
+ "description": description,
337
+ "name": name,
338
+ "options": options,
339
+ "origin_group": origin_group,
340
+ "origin_protocol": origin_protocol,
341
+ "proxy_ssl_ca": proxy_ssl_ca,
342
+ "proxy_ssl_data": proxy_ssl_data,
343
+ "proxy_ssl_enabled": proxy_ssl_enabled,
344
+ "secondary_hostnames": secondary_hostnames,
345
+ "ssl_data": ssl_data,
346
+ "ssl_enabled": ssl_enabled,
347
+ },
348
+ resource_update_params.ResourceUpdateParams,
349
+ ),
350
+ options=make_request_options(
351
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
352
+ ),
353
+ cast_to=CdnResource,
354
+ )
355
+
356
+ def list(
357
+ self,
358
+ *,
359
+ cname: str | Omit = omit,
360
+ deleted: bool | Omit = omit,
361
+ enabled: bool | Omit = omit,
362
+ max_created: str | Omit = omit,
363
+ min_created: str | Omit = omit,
364
+ origin_group: int | Omit = omit,
365
+ rules: str | Omit = omit,
366
+ secondary_hostnames: str | Omit = omit,
367
+ shield_dc: str | Omit = omit,
368
+ shielded: bool | Omit = omit,
369
+ ssl_data: int | Omit = omit,
370
+ ssl_data_in: int | Omit = omit,
371
+ ssl_enabled: bool | Omit = omit,
372
+ status: Literal["active", "processed", "suspended", "deleted"] | Omit = omit,
373
+ suspend: bool | Omit = omit,
374
+ vp_enabled: bool | Omit = omit,
375
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
376
+ # The extra values given here take precedence over values defined on the client or passed to this method.
377
+ extra_headers: Headers | None = None,
378
+ extra_query: Query | None = None,
379
+ extra_body: Body | None = None,
380
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
381
+ ) -> CdnResourceList:
382
+ """
383
+ Get information about all CDN resources in your account.
384
+
385
+ Args:
386
+ cname: Delivery domain (CNAME) of the CDN resource.
387
+
388
+ deleted: Defines whether a CDN resource has been deleted.
389
+
390
+ Possible values:
391
+
392
+ - **true** - CDN resource has been deleted.
393
+ - **false** - CDN resource has not been deleted.
394
+
395
+ enabled: Enables or disables a CDN resource change by a user.
396
+
397
+ Possible values:
398
+
399
+ - **true** - CDN resource is enabled.
400
+ - **false** - CDN resource is disabled.
401
+
402
+ max_created: Most recent date of CDN resource creation for which CDN resources should be
403
+ returned (ISO 8601/RFC 3339 format, UTC.)
404
+
405
+ min_created: Earliest date of CDN resource creation for which CDN resources should be
406
+ returned (ISO 8601/RFC 3339 format, UTC.)
407
+
408
+ origin_group: Origin group ID.
409
+
410
+ rules: Rule name or pattern.
411
+
412
+ secondary_hostnames: Additional delivery domains (CNAMEs) of the CDN resource.
413
+
414
+ shield_dc: Name of the origin shielding data center location.
415
+
416
+ shielded: Defines whether origin shielding is enabled for the CDN resource.
417
+
418
+ Possible values:
419
+
420
+ - **true** - Origin shielding is enabled for the CDN resource.
421
+ - **false** - Origin shielding is disabled for the CDN resource.
422
+
423
+ ssl_data: SSL certificate ID.
424
+
425
+ ssl_data_in: SSL certificates IDs.
426
+
427
+ Example:
428
+
429
+ - ?`sslData_in`=1643,1644,1652
430
+
431
+ ssl_enabled: Defines whether the HTTPS protocol is enabled for content delivery.
432
+
433
+ Possible values:
434
+
435
+ - **true** - HTTPS protocol is enabled for CDN resource.
436
+ - **false** - HTTPS protocol is disabled for CDN resource.
437
+
438
+ status: CDN resource status.
439
+
440
+ suspend: Defines whether the CDN resource was automatically suspended by the system.
441
+
442
+ Possible values:
443
+
444
+ - **true** - CDN resource is selected for automatic suspension in the next 7
445
+ days.
446
+ - **false** - CDN resource is not selected for automatic suspension.
447
+
448
+ vp_enabled: Defines whether the CDN resource is integrated with the Streaming platform.
449
+
450
+ Possible values:
451
+
452
+ - **true** - CDN resource is used for Streaming platform.
453
+ - **false** - CDN resource is not used for Streaming platform.
454
+
455
+ extra_headers: Send extra headers
456
+
457
+ extra_query: Add additional query parameters to the request
458
+
459
+ extra_body: Add additional JSON properties to the request
460
+
461
+ timeout: Override the client-level default timeout for this request, in seconds
462
+ """
463
+ return self._get(
464
+ "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources",
465
+ options=make_request_options(
466
+ extra_headers=extra_headers,
467
+ extra_query=extra_query,
468
+ extra_body=extra_body,
469
+ timeout=timeout,
470
+ query=maybe_transform(
471
+ {
472
+ "cname": cname,
473
+ "deleted": deleted,
474
+ "enabled": enabled,
475
+ "max_created": max_created,
476
+ "min_created": min_created,
477
+ "origin_group": origin_group,
478
+ "rules": rules,
479
+ "secondary_hostnames": secondary_hostnames,
480
+ "shield_dc": shield_dc,
481
+ "shielded": shielded,
482
+ "ssl_data": ssl_data,
483
+ "ssl_data_in": ssl_data_in,
484
+ "ssl_enabled": ssl_enabled,
485
+ "status": status,
486
+ "suspend": suspend,
487
+ "vp_enabled": vp_enabled,
488
+ },
489
+ resource_list_params.ResourceListParams,
490
+ ),
491
+ ),
492
+ cast_to=CdnResourceList,
493
+ )
494
+
495
+ def delete(
496
+ self,
497
+ resource_id: int,
498
+ *,
499
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
500
+ # The extra values given here take precedence over values defined on the client or passed to this method.
501
+ extra_headers: Headers | None = None,
502
+ extra_query: Query | None = None,
503
+ extra_body: Body | None = None,
504
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
505
+ ) -> None:
506
+ """
507
+ Delete the CDN resource from the system permanently.
508
+
509
+ Notes:
510
+
511
+ - **Deactivation Requirement**: Set the `active` attribute to `false` before
512
+ deletion.
513
+ - **Statistics Availability**: Statistics will be available for **365 days**
514
+ after deletion through the
515
+ [statistics endpoints](/docs/api-reference/cdn/cdn-statistics/cdn-resource-statistics).
516
+ - **Irreversibility**: This action is irreversible. Once deleted, the CDN
517
+ resource cannot be recovered.
518
+
519
+ Args:
520
+ extra_headers: Send extra headers
521
+
522
+ extra_query: Add additional query parameters to the request
523
+
524
+ extra_body: Add additional JSON properties to the request
525
+
526
+ timeout: Override the client-level default timeout for this request, in seconds
527
+ """
528
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
529
+ return self._delete(
530
+ f"/cdn/resources/{resource_id}"
531
+ if self._client._base_url_overridden
532
+ else f"https://api.gcore.com//cdn/resources/{resource_id}",
533
+ options=make_request_options(
534
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
535
+ ),
536
+ cast_to=NoneType,
537
+ )
538
+
539
+ def get(
540
+ self,
541
+ resource_id: int,
542
+ *,
543
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
544
+ # The extra values given here take precedence over values defined on the client or passed to this method.
545
+ extra_headers: Headers | None = None,
546
+ extra_query: Query | None = None,
547
+ extra_body: Body | None = None,
548
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
549
+ ) -> CdnResource:
550
+ """
551
+ Get CDN resource details
552
+
553
+ Args:
554
+ extra_headers: Send extra headers
555
+
556
+ extra_query: Add additional query parameters to the request
557
+
558
+ extra_body: Add additional JSON properties to the request
559
+
560
+ timeout: Override the client-level default timeout for this request, in seconds
561
+ """
562
+ return self._get(
563
+ f"/cdn/resources/{resource_id}"
564
+ if self._client._base_url_overridden
565
+ else f"https://api.gcore.com//cdn/resources/{resource_id}",
566
+ options=make_request_options(
567
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
568
+ ),
569
+ cast_to=CdnResource,
570
+ )
571
+
572
+ def prefetch(
573
+ self,
574
+ resource_id: int,
575
+ *,
576
+ paths: SequenceNotStr[str],
577
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
578
+ # The extra values given here take precedence over values defined on the client or passed to this method.
579
+ extra_headers: Headers | None = None,
580
+ extra_query: Query | None = None,
581
+ extra_body: Body | None = None,
582
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
583
+ ) -> None:
584
+ """Pre-populate files to a CDN cache before users requests.
585
+
586
+ Prefetch is recommended
587
+ only for files that **more than 200 MB** and **less than 5 GB**.
588
+
589
+ You can make one prefetch request for a CDN resource per minute. One request for
590
+ prefetch may content only up to 100 paths to files.
591
+
592
+ The time of procedure depends on the number and size of the files.
593
+
594
+ If you need to update files stored in the CDN, first purge these files and then
595
+ prefetch.
596
+
597
+ Args:
598
+ paths: Paths to files that should be pre-populated to the CDN.
599
+
600
+ Paths to the files should be specified without a domain name.
601
+
602
+ extra_headers: Send extra headers
603
+
604
+ extra_query: Add additional query parameters to the request
605
+
606
+ extra_body: Add additional JSON properties to the request
607
+
608
+ timeout: Override the client-level default timeout for this request, in seconds
609
+ """
610
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
611
+ return self._post(
612
+ f"/cdn/resources/{resource_id}/prefetch"
613
+ if self._client._base_url_overridden
614
+ else f"https://api.gcore.com//cdn/resources/{resource_id}/prefetch",
615
+ body=maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams),
616
+ options=make_request_options(
617
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
618
+ ),
619
+ cast_to=NoneType,
620
+ )
621
+
622
+ def prevalidate_ssl_le_certificate(
623
+ self,
624
+ resource_id: int,
625
+ *,
626
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
627
+ # The extra values given here take precedence over values defined on the client or passed to this method.
628
+ extra_headers: Headers | None = None,
629
+ extra_query: Query | None = None,
630
+ extra_body: Body | None = None,
631
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
632
+ ) -> None:
633
+ """
634
+ Check whether a Let's Encrypt certificate can be issued for the CDN resource.
635
+
636
+ Args:
637
+ extra_headers: Send extra headers
638
+
639
+ extra_query: Add additional query parameters to the request
640
+
641
+ extra_body: Add additional JSON properties to the request
642
+
643
+ timeout: Override the client-level default timeout for this request, in seconds
644
+ """
645
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
646
+ return self._post(
647
+ f"/cdn/resources/{resource_id}/ssl/le/pre-validate"
648
+ if self._client._base_url_overridden
649
+ else f"https://api.gcore.com//cdn/resources/{resource_id}/ssl/le/pre-validate",
650
+ options=make_request_options(
651
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
652
+ ),
653
+ cast_to=NoneType,
654
+ )
655
+
656
+ @overload
657
+ def purge(
658
+ self,
659
+ resource_id: int,
660
+ *,
661
+ urls: SequenceNotStr[str] | Omit = omit,
662
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
663
+ # The extra values given here take precedence over values defined on the client or passed to this method.
664
+ extra_headers: Headers | None = None,
665
+ extra_query: Query | None = None,
666
+ extra_body: Body | None = None,
667
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
668
+ ) -> None:
669
+ """Delete cache from CDN servers.
670
+
671
+ This is necessary to update CDN content.
672
+
673
+ We have different limits for different purge types:
674
+
675
+ - **Purge all cache** - One purge request for a CDN resource per minute.
676
+ - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge
677
+ request is limited to 100 URLs.
678
+ - **Purge by pattern** - One purge request for a CDN resource per minute. One
679
+ purge request is limited to 10 patterns.
680
+
681
+ Args:
682
+ urls: **Purge by URL** clears the cache of a specific files. This purge type is
683
+ recommended.
684
+
685
+ Specify file URLs including query strings. URLs should start with / without a
686
+ domain name.
687
+
688
+ Purge by URL depends on the following CDN options:
689
+
690
+ 1. "vary response header" is used. If your origin serves variants of the same
691
+ content depending on the Vary HTTP response header, purge by URL will delete
692
+ only one version of the file.
693
+ 2. "slice" is used. If you update several files in the origin without clearing
694
+ the CDN cache, purge by URL will delete only the first slice (with bytes=0…
695
+ .)
696
+ 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request.
697
+ 4. "`query_params_blacklist`" is used. Only files with the listed in the option
698
+ parameters will be cached as different objects. Files with other parameters
699
+ will be cached as one object. In this case, specify the listed parameters in
700
+ the Purge request. Don't specify other parameters.
701
+ 5. "`query_params_whitelist`" is used. Files with listed in the option
702
+ parameters will be cached as one object. Files with other parameters will be
703
+ cached as different objects. In this case, specify other parameters (if any)
704
+ besides the ones listed in the purge request.
705
+
706
+ extra_headers: Send extra headers
707
+
708
+ extra_query: Add additional query parameters to the request
709
+
710
+ extra_body: Add additional JSON properties to the request
711
+
712
+ timeout: Override the client-level default timeout for this request, in seconds
713
+ """
714
+ ...
715
+
716
+ @overload
717
+ def purge(
718
+ self,
719
+ resource_id: int,
720
+ *,
721
+ paths: SequenceNotStr[str] | Omit = omit,
722
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
723
+ # The extra values given here take precedence over values defined on the client or passed to this method.
724
+ extra_headers: Headers | None = None,
725
+ extra_query: Query | None = None,
726
+ extra_body: Body | None = None,
727
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
728
+ ) -> None:
729
+ """Delete cache from CDN servers.
730
+
731
+ This is necessary to update CDN content.
732
+
733
+ We have different limits for different purge types:
734
+
735
+ - **Purge all cache** - One purge request for a CDN resource per minute.
736
+ - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge
737
+ request is limited to 100 URLs.
738
+ - **Purge by pattern** - One purge request for a CDN resource per minute. One
739
+ purge request is limited to 10 patterns.
740
+
741
+ Args:
742
+ paths: **Purge by pattern** clears the cache that matches the pattern.
743
+
744
+ Use \\** operator, which replaces any number of symbols in your path. It's
745
+ important to note that wildcard usage (\\**) is permitted only at the end of a
746
+ pattern.
747
+
748
+ Query string added to any patterns will be ignored, and purge request will be
749
+ processed as if there weren't any parameters.
750
+
751
+ Purge by pattern is recursive. Both /path and /path\\** will result in recursive
752
+ purging, meaning all content under the specified path will be affected. As such,
753
+ using the pattern /path\\** is functionally equivalent to simply using /path.
754
+
755
+ extra_headers: Send extra headers
756
+
757
+ extra_query: Add additional query parameters to the request
758
+
759
+ extra_body: Add additional JSON properties to the request
760
+
761
+ timeout: Override the client-level default timeout for this request, in seconds
762
+ """
763
+ ...
764
+
765
+ @overload
766
+ def purge(
767
+ self,
768
+ resource_id: int,
769
+ *,
770
+ paths: SequenceNotStr[str] | Omit = omit,
771
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
772
+ # The extra values given here take precedence over values defined on the client or passed to this method.
773
+ extra_headers: Headers | None = None,
774
+ extra_query: Query | None = None,
775
+ extra_body: Body | None = None,
776
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
777
+ ) -> None:
778
+ """Delete cache from CDN servers.
779
+
780
+ This is necessary to update CDN content.
781
+
782
+ We have different limits for different purge types:
783
+
784
+ - **Purge all cache** - One purge request for a CDN resource per minute.
785
+ - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge
786
+ request is limited to 100 URLs.
787
+ - **Purge by pattern** - One purge request for a CDN resource per minute. One
788
+ purge request is limited to 10 patterns.
789
+
790
+ Args:
791
+ paths: **Purge all cache** clears the entire cache for the CDN resource.
792
+
793
+ Specify an empty array to purge all content for the resource.
794
+
795
+ When you purge all assets, CDN servers request content from your origin server
796
+ and cause a high load. Therefore, we recommend to use purge by URL for large
797
+ content quantities.
798
+
799
+ extra_headers: Send extra headers
800
+
801
+ extra_query: Add additional query parameters to the request
802
+
803
+ extra_body: Add additional JSON properties to the request
804
+
805
+ timeout: Override the client-level default timeout for this request, in seconds
806
+ """
807
+ ...
808
+
809
+ def purge(
810
+ self,
811
+ resource_id: int,
812
+ *,
813
+ urls: SequenceNotStr[str] | Omit = omit,
814
+ paths: SequenceNotStr[str] | Omit = omit,
815
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
816
+ # The extra values given here take precedence over values defined on the client or passed to this method.
817
+ extra_headers: Headers | None = None,
818
+ extra_query: Query | None = None,
819
+ extra_body: Body | None = None,
820
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
821
+ ) -> None:
822
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
823
+ return self._post(
824
+ f"/cdn/resources/{resource_id}/purge"
825
+ if self._client._base_url_overridden
826
+ else f"https://api.gcore.com//cdn/resources/{resource_id}/purge",
827
+ body=maybe_transform(
828
+ {
829
+ "urls": urls,
830
+ "paths": paths,
831
+ },
832
+ resource_purge_params.ResourcePurgeParams,
833
+ ),
834
+ options=make_request_options(
835
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
836
+ ),
837
+ cast_to=NoneType,
838
+ )
839
+
840
+ def replace(
841
+ self,
842
+ resource_id: int,
843
+ *,
844
+ origin_group: int,
845
+ active: bool | Omit = omit,
846
+ description: str | Omit = omit,
847
+ name: Optional[str] | Omit = omit,
848
+ options: resource_replace_params.Options | Omit = omit,
849
+ origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit,
850
+ proxy_ssl_ca: Optional[int] | Omit = omit,
851
+ proxy_ssl_data: Optional[int] | Omit = omit,
852
+ proxy_ssl_enabled: bool | Omit = omit,
853
+ secondary_hostnames: SequenceNotStr[str] | Omit = omit,
854
+ ssl_data: Optional[int] | Omit = omit,
855
+ ssl_enabled: bool | Omit = omit,
856
+ waap_api_domain_enabled: bool | Omit = omit,
857
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
858
+ # The extra values given here take precedence over values defined on the client or passed to this method.
859
+ extra_headers: Headers | None = None,
860
+ extra_query: Query | None = None,
861
+ extra_body: Body | None = None,
862
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
863
+ ) -> CdnResource:
864
+ """
865
+ Change CDN resource
866
+
867
+ Args:
868
+ origin_group: Origin group ID with which the CDN resource is associated.
869
+
870
+ You can use either the `origin` or `originGroup` parameter in the request.
871
+
872
+ active: Enables or disables a CDN resource.
873
+
874
+ Possible values:
875
+
876
+ - **true** - CDN resource is active. Content is being delivered.
877
+ - **false** - CDN resource is deactivated. Content is not being delivered.
878
+
879
+ description: Optional comment describing the CDN resource.
880
+
881
+ name: CDN resource name.
882
+
883
+ options: List of options that can be configured for the CDN resource.
884
+
885
+ In case of `null` value the option is not added to the CDN resource. Option may
886
+ inherit its value from the global account settings.
887
+
888
+ origin_protocol: Protocol used by CDN servers to request content from an origin source.
889
+
890
+ Possible values:
891
+
892
+ - **HTTPS** - CDN servers will connect to the origin via HTTPS.
893
+ - **HTTP** - CDN servers will connect to the origin via HTTP.
894
+ - **MATCH** - connection protocol will be chosen automatically (content on the
895
+ origin source should be available for the CDN both through HTTP and HTTPS).
896
+
897
+ If protocol is not specified, HTTP is used to connect to an origin server.
898
+
899
+ proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin.
900
+
901
+ It can be used only with `"`proxy_ssl_enabled`": true`.
902
+
903
+ proxy_ssl_data: ID of the SSL certificate used to verify an origin.
904
+
905
+ It can be used only with `"`proxy_ssl_enabled`": true`.
906
+
907
+ proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before
908
+ completing any connection.
909
+
910
+ Possible values:
911
+
912
+ - **true** - Origin SSL certificate validation is enabled.
913
+ - **false** - Origin SSL certificate validation is disabled.
914
+
915
+ secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via
916
+ the CDN.
917
+
918
+ Up to ten additional CNAMEs are possible.
919
+
920
+ ssl_data: ID of the SSL certificate linked to the CDN resource.
921
+
922
+ Can be used only with `"sslEnabled": true`.
923
+
924
+ ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery.
925
+
926
+ Possible values:
927
+
928
+ - **true** - HTTPS is enabled.
929
+ - **false** - HTTPS is disabled.
930
+
931
+ waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain.
932
+
933
+ Possible values:
934
+
935
+ - **true** - The associated WAAP Domain is designated as an API Domain.
936
+ - **false** - The associated WAAP Domain is not designated as an API Domain.
937
+
938
+ extra_headers: Send extra headers
939
+
940
+ extra_query: Add additional query parameters to the request
941
+
942
+ extra_body: Add additional JSON properties to the request
943
+
944
+ timeout: Override the client-level default timeout for this request, in seconds
945
+ """
946
+ return self._put(
947
+ f"/cdn/resources/{resource_id}"
948
+ if self._client._base_url_overridden
949
+ else f"https://api.gcore.com//cdn/resources/{resource_id}",
950
+ body=maybe_transform(
951
+ {
952
+ "origin_group": origin_group,
953
+ "active": active,
954
+ "description": description,
955
+ "name": name,
956
+ "options": options,
957
+ "origin_protocol": origin_protocol,
958
+ "proxy_ssl_ca": proxy_ssl_ca,
959
+ "proxy_ssl_data": proxy_ssl_data,
960
+ "proxy_ssl_enabled": proxy_ssl_enabled,
961
+ "secondary_hostnames": secondary_hostnames,
962
+ "ssl_data": ssl_data,
963
+ "ssl_enabled": ssl_enabled,
964
+ "waap_api_domain_enabled": waap_api_domain_enabled,
965
+ },
966
+ resource_replace_params.ResourceReplaceParams,
967
+ ),
968
+ options=make_request_options(
969
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
970
+ ),
971
+ cast_to=CdnResource,
972
+ )
973
+
974
+
975
+ class AsyncResourcesResource(AsyncAPIResource):
976
+ @cached_property
977
+ def shield(self) -> AsyncShieldResource:
978
+ return AsyncShieldResource(self._client)
979
+
980
+ @cached_property
981
+ def rules(self) -> AsyncRulesResource:
982
+ return AsyncRulesResource(self._client)
983
+
984
+ @cached_property
985
+ def with_raw_response(self) -> AsyncResourcesResourceWithRawResponse:
986
+ """
987
+ This property can be used as a prefix for any HTTP method call to return
988
+ the raw response object instead of the parsed content.
989
+
990
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
991
+ """
992
+ return AsyncResourcesResourceWithRawResponse(self)
993
+
994
+ @cached_property
995
+ def with_streaming_response(self) -> AsyncResourcesResourceWithStreamingResponse:
996
+ """
997
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
998
+
999
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
1000
+ """
1001
+ return AsyncResourcesResourceWithStreamingResponse(self)
1002
+
1003
+ async def create(
1004
+ self,
1005
+ *,
1006
+ cname: str,
1007
+ origin: str,
1008
+ origin_group: int,
1009
+ active: bool | Omit = omit,
1010
+ description: str | Omit = omit,
1011
+ name: Optional[str] | Omit = omit,
1012
+ options: resource_create_params.Options | Omit = omit,
1013
+ origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit,
1014
+ primary_resource: Optional[int] | Omit = omit,
1015
+ proxy_ssl_ca: Optional[int] | Omit = omit,
1016
+ proxy_ssl_data: Optional[int] | Omit = omit,
1017
+ proxy_ssl_enabled: bool | Omit = omit,
1018
+ secondary_hostnames: SequenceNotStr[str] | Omit = omit,
1019
+ ssl_data: Optional[int] | Omit = omit,
1020
+ ssl_enabled: bool | Omit = omit,
1021
+ waap_api_domain_enabled: bool | Omit = omit,
1022
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1023
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1024
+ extra_headers: Headers | None = None,
1025
+ extra_query: Query | None = None,
1026
+ extra_body: Body | None = None,
1027
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1028
+ ) -> CdnResource:
1029
+ """
1030
+ Create CDN resource
1031
+
1032
+ Args:
1033
+ cname: Delivery domains that will be used for content delivery through a CDN.
1034
+
1035
+ Delivery domains should be added to your DNS settings.
1036
+
1037
+ origin: IP address or domain name of the origin and the port, if custom port is used.
1038
+
1039
+ You can use either the `origin` or `originGroup` parameter in the request.
1040
+
1041
+ origin_group: Origin group ID with which the CDN resource is associated.
1042
+
1043
+ You can use either the `origin` or `originGroup` parameter in the request.
1044
+
1045
+ active: Enables or disables a CDN resource.
1046
+
1047
+ Possible values:
1048
+
1049
+ - **true** - CDN resource is active. Content is being delivered.
1050
+ - **false** - CDN resource is deactivated. Content is not being delivered.
1051
+
1052
+ description: Optional comment describing the CDN resource.
1053
+
1054
+ name: CDN resource name.
1055
+
1056
+ options: List of options that can be configured for the CDN resource.
1057
+
1058
+ In case of `null` value the option is not added to the CDN resource. Option may
1059
+ inherit its value from the global account settings.
1060
+
1061
+ origin_protocol: Protocol used by CDN servers to request content from an origin source.
1062
+
1063
+ Possible values:
1064
+
1065
+ - **HTTPS** - CDN servers will connect to the origin via HTTPS.
1066
+ - **HTTP** - CDN servers will connect to the origin via HTTP.
1067
+ - **MATCH** - connection protocol will be chosen automatically (content on the
1068
+ origin source should be available for the CDN both through HTTP and HTTPS).
1069
+
1070
+ If protocol is not specified, HTTP is used to connect to an origin server.
1071
+
1072
+ primary_resource: ID of the main CDN resource which has a shared caching zone with a reserve CDN
1073
+ resource.
1074
+
1075
+ If the parameter is not empty, then the current CDN resource is the reserve. You
1076
+ cannot change some options, create rules, set up origin shielding, or use the
1077
+ reserve CDN resource for Streaming.
1078
+
1079
+ proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin.
1080
+
1081
+ It can be used only with `"`proxy_ssl_enabled`": true`.
1082
+
1083
+ proxy_ssl_data: ID of the SSL certificate used to verify an origin.
1084
+
1085
+ It can be used only with `"`proxy_ssl_enabled`": true`.
1086
+
1087
+ proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before
1088
+ completing any connection.
1089
+
1090
+ Possible values:
1091
+
1092
+ - **true** - Origin SSL certificate validation is enabled.
1093
+ - **false** - Origin SSL certificate validation is disabled.
1094
+
1095
+ secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via
1096
+ the CDN.
1097
+
1098
+ Up to ten additional CNAMEs are possible.
1099
+
1100
+ ssl_data: ID of the SSL certificate linked to the CDN resource.
1101
+
1102
+ Can be used only with `"sslEnabled": true`.
1103
+
1104
+ ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery.
1105
+
1106
+ Possible values:
1107
+
1108
+ - **true** - HTTPS is enabled.
1109
+ - **false** - HTTPS is disabled.
1110
+
1111
+ waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain.
1112
+
1113
+ Possible values:
1114
+
1115
+ - **true** - The associated WAAP Domain is designated as an API Domain.
1116
+ - **false** - The associated WAAP Domain is not designated as an API Domain.
1117
+
1118
+ extra_headers: Send extra headers
1119
+
1120
+ extra_query: Add additional query parameters to the request
1121
+
1122
+ extra_body: Add additional JSON properties to the request
1123
+
1124
+ timeout: Override the client-level default timeout for this request, in seconds
1125
+ """
1126
+ return await self._post(
1127
+ "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources",
1128
+ body=await async_maybe_transform(
1129
+ {
1130
+ "cname": cname,
1131
+ "origin": origin,
1132
+ "origin_group": origin_group,
1133
+ "active": active,
1134
+ "description": description,
1135
+ "name": name,
1136
+ "options": options,
1137
+ "origin_protocol": origin_protocol,
1138
+ "primary_resource": primary_resource,
1139
+ "proxy_ssl_ca": proxy_ssl_ca,
1140
+ "proxy_ssl_data": proxy_ssl_data,
1141
+ "proxy_ssl_enabled": proxy_ssl_enabled,
1142
+ "secondary_hostnames": secondary_hostnames,
1143
+ "ssl_data": ssl_data,
1144
+ "ssl_enabled": ssl_enabled,
1145
+ "waap_api_domain_enabled": waap_api_domain_enabled,
1146
+ },
1147
+ resource_create_params.ResourceCreateParams,
1148
+ ),
1149
+ options=make_request_options(
1150
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1151
+ ),
1152
+ cast_to=CdnResource,
1153
+ )
1154
+
1155
+ async def update(
1156
+ self,
1157
+ resource_id: int,
1158
+ *,
1159
+ active: bool | Omit = omit,
1160
+ description: str | Omit = omit,
1161
+ name: Optional[str] | Omit = omit,
1162
+ options: resource_update_params.Options | Omit = omit,
1163
+ origin_group: int | Omit = omit,
1164
+ origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit,
1165
+ proxy_ssl_ca: Optional[int] | Omit = omit,
1166
+ proxy_ssl_data: Optional[int] | Omit = omit,
1167
+ proxy_ssl_enabled: bool | Omit = omit,
1168
+ secondary_hostnames: SequenceNotStr[str] | Omit = omit,
1169
+ ssl_data: Optional[int] | Omit = omit,
1170
+ ssl_enabled: bool | Omit = omit,
1171
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1172
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1173
+ extra_headers: Headers | None = None,
1174
+ extra_query: Query | None = None,
1175
+ extra_body: Body | None = None,
1176
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1177
+ ) -> CdnResource:
1178
+ """
1179
+ Change CDN resource
1180
+
1181
+ Args:
1182
+ active: Enables or disables a CDN resource.
1183
+
1184
+ Possible values:
1185
+
1186
+ - **true** - CDN resource is active. Content is being delivered.
1187
+ - **false** - CDN resource is deactivated. Content is not being delivered.
1188
+
1189
+ description: Optional comment describing the CDN resource.
1190
+
1191
+ name: CDN resource name.
1192
+
1193
+ options: List of options that can be configured for the CDN resource.
1194
+
1195
+ In case of `null` value the option is not added to the CDN resource. Option may
1196
+ inherit its value from the global account settings.
1197
+
1198
+ origin_group: Origin group ID with which the CDN resource is associated.
1199
+
1200
+ You can use either the `origin` or `originGroup` parameter in the request.
1201
+
1202
+ origin_protocol: Protocol used by CDN servers to request content from an origin source.
1203
+
1204
+ Possible values:
1205
+
1206
+ - **HTTPS** - CDN servers will connect to the origin via HTTPS.
1207
+ - **HTTP** - CDN servers will connect to the origin via HTTP.
1208
+ - **MATCH** - connection protocol will be chosen automatically (content on the
1209
+ origin source should be available for the CDN both through HTTP and HTTPS).
1210
+
1211
+ If protocol is not specified, HTTP is used to connect to an origin server.
1212
+
1213
+ proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin.
1214
+
1215
+ It can be used only with `"`proxy_ssl_enabled`": true`.
1216
+
1217
+ proxy_ssl_data: ID of the SSL certificate used to verify an origin.
1218
+
1219
+ It can be used only with `"`proxy_ssl_enabled`": true`.
1220
+
1221
+ proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before
1222
+ completing any connection.
1223
+
1224
+ Possible values:
1225
+
1226
+ - **true** - Origin SSL certificate validation is enabled.
1227
+ - **false** - Origin SSL certificate validation is disabled.
1228
+
1229
+ secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via
1230
+ the CDN.
1231
+
1232
+ Up to ten additional CNAMEs are possible.
1233
+
1234
+ ssl_data: ID of the SSL certificate linked to the CDN resource.
1235
+
1236
+ Can be used only with `"sslEnabled": true`.
1237
+
1238
+ ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery.
1239
+
1240
+ Possible values:
1241
+
1242
+ - **true** - HTTPS is enabled.
1243
+ - **false** - HTTPS is disabled.
1244
+
1245
+ extra_headers: Send extra headers
1246
+
1247
+ extra_query: Add additional query parameters to the request
1248
+
1249
+ extra_body: Add additional JSON properties to the request
1250
+
1251
+ timeout: Override the client-level default timeout for this request, in seconds
1252
+ """
1253
+ return await self._patch(
1254
+ f"/cdn/resources/{resource_id}"
1255
+ if self._client._base_url_overridden
1256
+ else f"https://api.gcore.com//cdn/resources/{resource_id}",
1257
+ body=await async_maybe_transform(
1258
+ {
1259
+ "active": active,
1260
+ "description": description,
1261
+ "name": name,
1262
+ "options": options,
1263
+ "origin_group": origin_group,
1264
+ "origin_protocol": origin_protocol,
1265
+ "proxy_ssl_ca": proxy_ssl_ca,
1266
+ "proxy_ssl_data": proxy_ssl_data,
1267
+ "proxy_ssl_enabled": proxy_ssl_enabled,
1268
+ "secondary_hostnames": secondary_hostnames,
1269
+ "ssl_data": ssl_data,
1270
+ "ssl_enabled": ssl_enabled,
1271
+ },
1272
+ resource_update_params.ResourceUpdateParams,
1273
+ ),
1274
+ options=make_request_options(
1275
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1276
+ ),
1277
+ cast_to=CdnResource,
1278
+ )
1279
+
1280
+ async def list(
1281
+ self,
1282
+ *,
1283
+ cname: str | Omit = omit,
1284
+ deleted: bool | Omit = omit,
1285
+ enabled: bool | Omit = omit,
1286
+ max_created: str | Omit = omit,
1287
+ min_created: str | Omit = omit,
1288
+ origin_group: int | Omit = omit,
1289
+ rules: str | Omit = omit,
1290
+ secondary_hostnames: str | Omit = omit,
1291
+ shield_dc: str | Omit = omit,
1292
+ shielded: bool | Omit = omit,
1293
+ ssl_data: int | Omit = omit,
1294
+ ssl_data_in: int | Omit = omit,
1295
+ ssl_enabled: bool | Omit = omit,
1296
+ status: Literal["active", "processed", "suspended", "deleted"] | Omit = omit,
1297
+ suspend: bool | Omit = omit,
1298
+ vp_enabled: bool | Omit = omit,
1299
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1300
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1301
+ extra_headers: Headers | None = None,
1302
+ extra_query: Query | None = None,
1303
+ extra_body: Body | None = None,
1304
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1305
+ ) -> CdnResourceList:
1306
+ """
1307
+ Get information about all CDN resources in your account.
1308
+
1309
+ Args:
1310
+ cname: Delivery domain (CNAME) of the CDN resource.
1311
+
1312
+ deleted: Defines whether a CDN resource has been deleted.
1313
+
1314
+ Possible values:
1315
+
1316
+ - **true** - CDN resource has been deleted.
1317
+ - **false** - CDN resource has not been deleted.
1318
+
1319
+ enabled: Enables or disables a CDN resource change by a user.
1320
+
1321
+ Possible values:
1322
+
1323
+ - **true** - CDN resource is enabled.
1324
+ - **false** - CDN resource is disabled.
1325
+
1326
+ max_created: Most recent date of CDN resource creation for which CDN resources should be
1327
+ returned (ISO 8601/RFC 3339 format, UTC.)
1328
+
1329
+ min_created: Earliest date of CDN resource creation for which CDN resources should be
1330
+ returned (ISO 8601/RFC 3339 format, UTC.)
1331
+
1332
+ origin_group: Origin group ID.
1333
+
1334
+ rules: Rule name or pattern.
1335
+
1336
+ secondary_hostnames: Additional delivery domains (CNAMEs) of the CDN resource.
1337
+
1338
+ shield_dc: Name of the origin shielding data center location.
1339
+
1340
+ shielded: Defines whether origin shielding is enabled for the CDN resource.
1341
+
1342
+ Possible values:
1343
+
1344
+ - **true** - Origin shielding is enabled for the CDN resource.
1345
+ - **false** - Origin shielding is disabled for the CDN resource.
1346
+
1347
+ ssl_data: SSL certificate ID.
1348
+
1349
+ ssl_data_in: SSL certificates IDs.
1350
+
1351
+ Example:
1352
+
1353
+ - ?`sslData_in`=1643,1644,1652
1354
+
1355
+ ssl_enabled: Defines whether the HTTPS protocol is enabled for content delivery.
1356
+
1357
+ Possible values:
1358
+
1359
+ - **true** - HTTPS protocol is enabled for CDN resource.
1360
+ - **false** - HTTPS protocol is disabled for CDN resource.
1361
+
1362
+ status: CDN resource status.
1363
+
1364
+ suspend: Defines whether the CDN resource was automatically suspended by the system.
1365
+
1366
+ Possible values:
1367
+
1368
+ - **true** - CDN resource is selected for automatic suspension in the next 7
1369
+ days.
1370
+ - **false** - CDN resource is not selected for automatic suspension.
1371
+
1372
+ vp_enabled: Defines whether the CDN resource is integrated with the Streaming platform.
1373
+
1374
+ Possible values:
1375
+
1376
+ - **true** - CDN resource is used for Streaming platform.
1377
+ - **false** - CDN resource is not used for Streaming platform.
1378
+
1379
+ extra_headers: Send extra headers
1380
+
1381
+ extra_query: Add additional query parameters to the request
1382
+
1383
+ extra_body: Add additional JSON properties to the request
1384
+
1385
+ timeout: Override the client-level default timeout for this request, in seconds
1386
+ """
1387
+ return await self._get(
1388
+ "/cdn/resources" if self._client._base_url_overridden else "https://api.gcore.com//cdn/resources",
1389
+ options=make_request_options(
1390
+ extra_headers=extra_headers,
1391
+ extra_query=extra_query,
1392
+ extra_body=extra_body,
1393
+ timeout=timeout,
1394
+ query=await async_maybe_transform(
1395
+ {
1396
+ "cname": cname,
1397
+ "deleted": deleted,
1398
+ "enabled": enabled,
1399
+ "max_created": max_created,
1400
+ "min_created": min_created,
1401
+ "origin_group": origin_group,
1402
+ "rules": rules,
1403
+ "secondary_hostnames": secondary_hostnames,
1404
+ "shield_dc": shield_dc,
1405
+ "shielded": shielded,
1406
+ "ssl_data": ssl_data,
1407
+ "ssl_data_in": ssl_data_in,
1408
+ "ssl_enabled": ssl_enabled,
1409
+ "status": status,
1410
+ "suspend": suspend,
1411
+ "vp_enabled": vp_enabled,
1412
+ },
1413
+ resource_list_params.ResourceListParams,
1414
+ ),
1415
+ ),
1416
+ cast_to=CdnResourceList,
1417
+ )
1418
+
1419
+ async def delete(
1420
+ self,
1421
+ resource_id: int,
1422
+ *,
1423
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1424
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1425
+ extra_headers: Headers | None = None,
1426
+ extra_query: Query | None = None,
1427
+ extra_body: Body | None = None,
1428
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1429
+ ) -> None:
1430
+ """
1431
+ Delete the CDN resource from the system permanently.
1432
+
1433
+ Notes:
1434
+
1435
+ - **Deactivation Requirement**: Set the `active` attribute to `false` before
1436
+ deletion.
1437
+ - **Statistics Availability**: Statistics will be available for **365 days**
1438
+ after deletion through the
1439
+ [statistics endpoints](/docs/api-reference/cdn/cdn-statistics/cdn-resource-statistics).
1440
+ - **Irreversibility**: This action is irreversible. Once deleted, the CDN
1441
+ resource cannot be recovered.
1442
+
1443
+ Args:
1444
+ extra_headers: Send extra headers
1445
+
1446
+ extra_query: Add additional query parameters to the request
1447
+
1448
+ extra_body: Add additional JSON properties to the request
1449
+
1450
+ timeout: Override the client-level default timeout for this request, in seconds
1451
+ """
1452
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1453
+ return await self._delete(
1454
+ f"/cdn/resources/{resource_id}"
1455
+ if self._client._base_url_overridden
1456
+ else f"https://api.gcore.com//cdn/resources/{resource_id}",
1457
+ options=make_request_options(
1458
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1459
+ ),
1460
+ cast_to=NoneType,
1461
+ )
1462
+
1463
+ async def get(
1464
+ self,
1465
+ resource_id: int,
1466
+ *,
1467
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1468
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1469
+ extra_headers: Headers | None = None,
1470
+ extra_query: Query | None = None,
1471
+ extra_body: Body | None = None,
1472
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1473
+ ) -> CdnResource:
1474
+ """
1475
+ Get CDN resource details
1476
+
1477
+ Args:
1478
+ extra_headers: Send extra headers
1479
+
1480
+ extra_query: Add additional query parameters to the request
1481
+
1482
+ extra_body: Add additional JSON properties to the request
1483
+
1484
+ timeout: Override the client-level default timeout for this request, in seconds
1485
+ """
1486
+ return await self._get(
1487
+ f"/cdn/resources/{resource_id}"
1488
+ if self._client._base_url_overridden
1489
+ else f"https://api.gcore.com//cdn/resources/{resource_id}",
1490
+ options=make_request_options(
1491
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1492
+ ),
1493
+ cast_to=CdnResource,
1494
+ )
1495
+
1496
+ async def prefetch(
1497
+ self,
1498
+ resource_id: int,
1499
+ *,
1500
+ paths: SequenceNotStr[str],
1501
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1502
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1503
+ extra_headers: Headers | None = None,
1504
+ extra_query: Query | None = None,
1505
+ extra_body: Body | None = None,
1506
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1507
+ ) -> None:
1508
+ """Pre-populate files to a CDN cache before users requests.
1509
+
1510
+ Prefetch is recommended
1511
+ only for files that **more than 200 MB** and **less than 5 GB**.
1512
+
1513
+ You can make one prefetch request for a CDN resource per minute. One request for
1514
+ prefetch may content only up to 100 paths to files.
1515
+
1516
+ The time of procedure depends on the number and size of the files.
1517
+
1518
+ If you need to update files stored in the CDN, first purge these files and then
1519
+ prefetch.
1520
+
1521
+ Args:
1522
+ paths: Paths to files that should be pre-populated to the CDN.
1523
+
1524
+ Paths to the files should be specified without a domain name.
1525
+
1526
+ extra_headers: Send extra headers
1527
+
1528
+ extra_query: Add additional query parameters to the request
1529
+
1530
+ extra_body: Add additional JSON properties to the request
1531
+
1532
+ timeout: Override the client-level default timeout for this request, in seconds
1533
+ """
1534
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1535
+ return await self._post(
1536
+ f"/cdn/resources/{resource_id}/prefetch"
1537
+ if self._client._base_url_overridden
1538
+ else f"https://api.gcore.com//cdn/resources/{resource_id}/prefetch",
1539
+ body=await async_maybe_transform({"paths": paths}, resource_prefetch_params.ResourcePrefetchParams),
1540
+ options=make_request_options(
1541
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1542
+ ),
1543
+ cast_to=NoneType,
1544
+ )
1545
+
1546
+ async def prevalidate_ssl_le_certificate(
1547
+ self,
1548
+ resource_id: int,
1549
+ *,
1550
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1551
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1552
+ extra_headers: Headers | None = None,
1553
+ extra_query: Query | None = None,
1554
+ extra_body: Body | None = None,
1555
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1556
+ ) -> None:
1557
+ """
1558
+ Check whether a Let's Encrypt certificate can be issued for the CDN resource.
1559
+
1560
+ Args:
1561
+ extra_headers: Send extra headers
1562
+
1563
+ extra_query: Add additional query parameters to the request
1564
+
1565
+ extra_body: Add additional JSON properties to the request
1566
+
1567
+ timeout: Override the client-level default timeout for this request, in seconds
1568
+ """
1569
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1570
+ return await self._post(
1571
+ f"/cdn/resources/{resource_id}/ssl/le/pre-validate"
1572
+ if self._client._base_url_overridden
1573
+ else f"https://api.gcore.com//cdn/resources/{resource_id}/ssl/le/pre-validate",
1574
+ options=make_request_options(
1575
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1576
+ ),
1577
+ cast_to=NoneType,
1578
+ )
1579
+
1580
+ @overload
1581
+ async def purge(
1582
+ self,
1583
+ resource_id: int,
1584
+ *,
1585
+ urls: SequenceNotStr[str] | Omit = omit,
1586
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1587
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1588
+ extra_headers: Headers | None = None,
1589
+ extra_query: Query | None = None,
1590
+ extra_body: Body | None = None,
1591
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1592
+ ) -> None:
1593
+ """Delete cache from CDN servers.
1594
+
1595
+ This is necessary to update CDN content.
1596
+
1597
+ We have different limits for different purge types:
1598
+
1599
+ - **Purge all cache** - One purge request for a CDN resource per minute.
1600
+ - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge
1601
+ request is limited to 100 URLs.
1602
+ - **Purge by pattern** - One purge request for a CDN resource per minute. One
1603
+ purge request is limited to 10 patterns.
1604
+
1605
+ Args:
1606
+ urls: **Purge by URL** clears the cache of a specific files. This purge type is
1607
+ recommended.
1608
+
1609
+ Specify file URLs including query strings. URLs should start with / without a
1610
+ domain name.
1611
+
1612
+ Purge by URL depends on the following CDN options:
1613
+
1614
+ 1. "vary response header" is used. If your origin serves variants of the same
1615
+ content depending on the Vary HTTP response header, purge by URL will delete
1616
+ only one version of the file.
1617
+ 2. "slice" is used. If you update several files in the origin without clearing
1618
+ the CDN cache, purge by URL will delete only the first slice (with bytes=0…
1619
+ .)
1620
+ 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request.
1621
+ 4. "`query_params_blacklist`" is used. Only files with the listed in the option
1622
+ parameters will be cached as different objects. Files with other parameters
1623
+ will be cached as one object. In this case, specify the listed parameters in
1624
+ the Purge request. Don't specify other parameters.
1625
+ 5. "`query_params_whitelist`" is used. Files with listed in the option
1626
+ parameters will be cached as one object. Files with other parameters will be
1627
+ cached as different objects. In this case, specify other parameters (if any)
1628
+ besides the ones listed in the purge request.
1629
+
1630
+ extra_headers: Send extra headers
1631
+
1632
+ extra_query: Add additional query parameters to the request
1633
+
1634
+ extra_body: Add additional JSON properties to the request
1635
+
1636
+ timeout: Override the client-level default timeout for this request, in seconds
1637
+ """
1638
+ ...
1639
+
1640
+ @overload
1641
+ async def purge(
1642
+ self,
1643
+ resource_id: int,
1644
+ *,
1645
+ paths: SequenceNotStr[str] | Omit = omit,
1646
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1647
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1648
+ extra_headers: Headers | None = None,
1649
+ extra_query: Query | None = None,
1650
+ extra_body: Body | None = None,
1651
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1652
+ ) -> None:
1653
+ """Delete cache from CDN servers.
1654
+
1655
+ This is necessary to update CDN content.
1656
+
1657
+ We have different limits for different purge types:
1658
+
1659
+ - **Purge all cache** - One purge request for a CDN resource per minute.
1660
+ - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge
1661
+ request is limited to 100 URLs.
1662
+ - **Purge by pattern** - One purge request for a CDN resource per minute. One
1663
+ purge request is limited to 10 patterns.
1664
+
1665
+ Args:
1666
+ paths: **Purge by pattern** clears the cache that matches the pattern.
1667
+
1668
+ Use \\** operator, which replaces any number of symbols in your path. It's
1669
+ important to note that wildcard usage (\\**) is permitted only at the end of a
1670
+ pattern.
1671
+
1672
+ Query string added to any patterns will be ignored, and purge request will be
1673
+ processed as if there weren't any parameters.
1674
+
1675
+ Purge by pattern is recursive. Both /path and /path\\** will result in recursive
1676
+ purging, meaning all content under the specified path will be affected. As such,
1677
+ using the pattern /path\\** is functionally equivalent to simply using /path.
1678
+
1679
+ extra_headers: Send extra headers
1680
+
1681
+ extra_query: Add additional query parameters to the request
1682
+
1683
+ extra_body: Add additional JSON properties to the request
1684
+
1685
+ timeout: Override the client-level default timeout for this request, in seconds
1686
+ """
1687
+ ...
1688
+
1689
+ @overload
1690
+ async def purge(
1691
+ self,
1692
+ resource_id: int,
1693
+ *,
1694
+ paths: SequenceNotStr[str] | Omit = omit,
1695
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1696
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1697
+ extra_headers: Headers | None = None,
1698
+ extra_query: Query | None = None,
1699
+ extra_body: Body | None = None,
1700
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1701
+ ) -> None:
1702
+ """Delete cache from CDN servers.
1703
+
1704
+ This is necessary to update CDN content.
1705
+
1706
+ We have different limits for different purge types:
1707
+
1708
+ - **Purge all cache** - One purge request for a CDN resource per minute.
1709
+ - **Purge by URL** - Two purge requests for a CDN resource per minute. One purge
1710
+ request is limited to 100 URLs.
1711
+ - **Purge by pattern** - One purge request for a CDN resource per minute. One
1712
+ purge request is limited to 10 patterns.
1713
+
1714
+ Args:
1715
+ paths: **Purge all cache** clears the entire cache for the CDN resource.
1716
+
1717
+ Specify an empty array to purge all content for the resource.
1718
+
1719
+ When you purge all assets, CDN servers request content from your origin server
1720
+ and cause a high load. Therefore, we recommend to use purge by URL for large
1721
+ content quantities.
1722
+
1723
+ extra_headers: Send extra headers
1724
+
1725
+ extra_query: Add additional query parameters to the request
1726
+
1727
+ extra_body: Add additional JSON properties to the request
1728
+
1729
+ timeout: Override the client-level default timeout for this request, in seconds
1730
+ """
1731
+ ...
1732
+
1733
+ async def purge(
1734
+ self,
1735
+ resource_id: int,
1736
+ *,
1737
+ urls: SequenceNotStr[str] | Omit = omit,
1738
+ paths: SequenceNotStr[str] | Omit = omit,
1739
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1740
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1741
+ extra_headers: Headers | None = None,
1742
+ extra_query: Query | None = None,
1743
+ extra_body: Body | None = None,
1744
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1745
+ ) -> None:
1746
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1747
+ return await self._post(
1748
+ f"/cdn/resources/{resource_id}/purge"
1749
+ if self._client._base_url_overridden
1750
+ else f"https://api.gcore.com//cdn/resources/{resource_id}/purge",
1751
+ body=await async_maybe_transform(
1752
+ {
1753
+ "urls": urls,
1754
+ "paths": paths,
1755
+ },
1756
+ resource_purge_params.ResourcePurgeParams,
1757
+ ),
1758
+ options=make_request_options(
1759
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1760
+ ),
1761
+ cast_to=NoneType,
1762
+ )
1763
+
1764
+ async def replace(
1765
+ self,
1766
+ resource_id: int,
1767
+ *,
1768
+ origin_group: int,
1769
+ active: bool | Omit = omit,
1770
+ description: str | Omit = omit,
1771
+ name: Optional[str] | Omit = omit,
1772
+ options: resource_replace_params.Options | Omit = omit,
1773
+ origin_protocol: Literal["HTTP", "HTTPS", "MATCH"] | Omit = omit,
1774
+ proxy_ssl_ca: Optional[int] | Omit = omit,
1775
+ proxy_ssl_data: Optional[int] | Omit = omit,
1776
+ proxy_ssl_enabled: bool | Omit = omit,
1777
+ secondary_hostnames: SequenceNotStr[str] | Omit = omit,
1778
+ ssl_data: Optional[int] | Omit = omit,
1779
+ ssl_enabled: bool | Omit = omit,
1780
+ waap_api_domain_enabled: bool | Omit = omit,
1781
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1782
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1783
+ extra_headers: Headers | None = None,
1784
+ extra_query: Query | None = None,
1785
+ extra_body: Body | None = None,
1786
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1787
+ ) -> CdnResource:
1788
+ """
1789
+ Change CDN resource
1790
+
1791
+ Args:
1792
+ origin_group: Origin group ID with which the CDN resource is associated.
1793
+
1794
+ You can use either the `origin` or `originGroup` parameter in the request.
1795
+
1796
+ active: Enables or disables a CDN resource.
1797
+
1798
+ Possible values:
1799
+
1800
+ - **true** - CDN resource is active. Content is being delivered.
1801
+ - **false** - CDN resource is deactivated. Content is not being delivered.
1802
+
1803
+ description: Optional comment describing the CDN resource.
1804
+
1805
+ name: CDN resource name.
1806
+
1807
+ options: List of options that can be configured for the CDN resource.
1808
+
1809
+ In case of `null` value the option is not added to the CDN resource. Option may
1810
+ inherit its value from the global account settings.
1811
+
1812
+ origin_protocol: Protocol used by CDN servers to request content from an origin source.
1813
+
1814
+ Possible values:
1815
+
1816
+ - **HTTPS** - CDN servers will connect to the origin via HTTPS.
1817
+ - **HTTP** - CDN servers will connect to the origin via HTTP.
1818
+ - **MATCH** - connection protocol will be chosen automatically (content on the
1819
+ origin source should be available for the CDN both through HTTP and HTTPS).
1820
+
1821
+ If protocol is not specified, HTTP is used to connect to an origin server.
1822
+
1823
+ proxy_ssl_ca: ID of the trusted CA certificate used to verify an origin.
1824
+
1825
+ It can be used only with `"`proxy_ssl_enabled`": true`.
1826
+
1827
+ proxy_ssl_data: ID of the SSL certificate used to verify an origin.
1828
+
1829
+ It can be used only with `"`proxy_ssl_enabled`": true`.
1830
+
1831
+ proxy_ssl_enabled: Enables or disables SSL certificate validation of the origin server before
1832
+ completing any connection.
1833
+
1834
+ Possible values:
1835
+
1836
+ - **true** - Origin SSL certificate validation is enabled.
1837
+ - **false** - Origin SSL certificate validation is disabled.
1838
+
1839
+ secondary_hostnames: Additional delivery domains (CNAMEs) that will be used to deliver content via
1840
+ the CDN.
1841
+
1842
+ Up to ten additional CNAMEs are possible.
1843
+
1844
+ ssl_data: ID of the SSL certificate linked to the CDN resource.
1845
+
1846
+ Can be used only with `"sslEnabled": true`.
1847
+
1848
+ ssl_enabled: Defines whether the HTTPS protocol enabled for content delivery.
1849
+
1850
+ Possible values:
1851
+
1852
+ - **true** - HTTPS is enabled.
1853
+ - **false** - HTTPS is disabled.
1854
+
1855
+ waap_api_domain_enabled: Defines whether the associated WAAP Domain is identified as an API Domain.
1856
+
1857
+ Possible values:
1858
+
1859
+ - **true** - The associated WAAP Domain is designated as an API Domain.
1860
+ - **false** - The associated WAAP Domain is not designated as an API Domain.
1861
+
1862
+ extra_headers: Send extra headers
1863
+
1864
+ extra_query: Add additional query parameters to the request
1865
+
1866
+ extra_body: Add additional JSON properties to the request
1867
+
1868
+ timeout: Override the client-level default timeout for this request, in seconds
1869
+ """
1870
+ return await self._put(
1871
+ f"/cdn/resources/{resource_id}"
1872
+ if self._client._base_url_overridden
1873
+ else f"https://api.gcore.com//cdn/resources/{resource_id}",
1874
+ body=await async_maybe_transform(
1875
+ {
1876
+ "origin_group": origin_group,
1877
+ "active": active,
1878
+ "description": description,
1879
+ "name": name,
1880
+ "options": options,
1881
+ "origin_protocol": origin_protocol,
1882
+ "proxy_ssl_ca": proxy_ssl_ca,
1883
+ "proxy_ssl_data": proxy_ssl_data,
1884
+ "proxy_ssl_enabled": proxy_ssl_enabled,
1885
+ "secondary_hostnames": secondary_hostnames,
1886
+ "ssl_data": ssl_data,
1887
+ "ssl_enabled": ssl_enabled,
1888
+ "waap_api_domain_enabled": waap_api_domain_enabled,
1889
+ },
1890
+ resource_replace_params.ResourceReplaceParams,
1891
+ ),
1892
+ options=make_request_options(
1893
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1894
+ ),
1895
+ cast_to=CdnResource,
1896
+ )
1897
+
1898
+
1899
+ class ResourcesResourceWithRawResponse:
1900
+ def __init__(self, resources: ResourcesResource) -> None:
1901
+ self._resources = resources
1902
+
1903
+ self.create = to_raw_response_wrapper(
1904
+ resources.create,
1905
+ )
1906
+ self.update = to_raw_response_wrapper(
1907
+ resources.update,
1908
+ )
1909
+ self.list = to_raw_response_wrapper(
1910
+ resources.list,
1911
+ )
1912
+ self.delete = to_raw_response_wrapper(
1913
+ resources.delete,
1914
+ )
1915
+ self.get = to_raw_response_wrapper(
1916
+ resources.get,
1917
+ )
1918
+ self.prefetch = to_raw_response_wrapper(
1919
+ resources.prefetch,
1920
+ )
1921
+ self.prevalidate_ssl_le_certificate = to_raw_response_wrapper(
1922
+ resources.prevalidate_ssl_le_certificate,
1923
+ )
1924
+ self.purge = to_raw_response_wrapper(
1925
+ resources.purge,
1926
+ )
1927
+ self.replace = to_raw_response_wrapper(
1928
+ resources.replace,
1929
+ )
1930
+
1931
+ @cached_property
1932
+ def shield(self) -> ShieldResourceWithRawResponse:
1933
+ return ShieldResourceWithRawResponse(self._resources.shield)
1934
+
1935
+ @cached_property
1936
+ def rules(self) -> RulesResourceWithRawResponse:
1937
+ return RulesResourceWithRawResponse(self._resources.rules)
1938
+
1939
+
1940
+ class AsyncResourcesResourceWithRawResponse:
1941
+ def __init__(self, resources: AsyncResourcesResource) -> None:
1942
+ self._resources = resources
1943
+
1944
+ self.create = async_to_raw_response_wrapper(
1945
+ resources.create,
1946
+ )
1947
+ self.update = async_to_raw_response_wrapper(
1948
+ resources.update,
1949
+ )
1950
+ self.list = async_to_raw_response_wrapper(
1951
+ resources.list,
1952
+ )
1953
+ self.delete = async_to_raw_response_wrapper(
1954
+ resources.delete,
1955
+ )
1956
+ self.get = async_to_raw_response_wrapper(
1957
+ resources.get,
1958
+ )
1959
+ self.prefetch = async_to_raw_response_wrapper(
1960
+ resources.prefetch,
1961
+ )
1962
+ self.prevalidate_ssl_le_certificate = async_to_raw_response_wrapper(
1963
+ resources.prevalidate_ssl_le_certificate,
1964
+ )
1965
+ self.purge = async_to_raw_response_wrapper(
1966
+ resources.purge,
1967
+ )
1968
+ self.replace = async_to_raw_response_wrapper(
1969
+ resources.replace,
1970
+ )
1971
+
1972
+ @cached_property
1973
+ def shield(self) -> AsyncShieldResourceWithRawResponse:
1974
+ return AsyncShieldResourceWithRawResponse(self._resources.shield)
1975
+
1976
+ @cached_property
1977
+ def rules(self) -> AsyncRulesResourceWithRawResponse:
1978
+ return AsyncRulesResourceWithRawResponse(self._resources.rules)
1979
+
1980
+
1981
+ class ResourcesResourceWithStreamingResponse:
1982
+ def __init__(self, resources: ResourcesResource) -> None:
1983
+ self._resources = resources
1984
+
1985
+ self.create = to_streamed_response_wrapper(
1986
+ resources.create,
1987
+ )
1988
+ self.update = to_streamed_response_wrapper(
1989
+ resources.update,
1990
+ )
1991
+ self.list = to_streamed_response_wrapper(
1992
+ resources.list,
1993
+ )
1994
+ self.delete = to_streamed_response_wrapper(
1995
+ resources.delete,
1996
+ )
1997
+ self.get = to_streamed_response_wrapper(
1998
+ resources.get,
1999
+ )
2000
+ self.prefetch = to_streamed_response_wrapper(
2001
+ resources.prefetch,
2002
+ )
2003
+ self.prevalidate_ssl_le_certificate = to_streamed_response_wrapper(
2004
+ resources.prevalidate_ssl_le_certificate,
2005
+ )
2006
+ self.purge = to_streamed_response_wrapper(
2007
+ resources.purge,
2008
+ )
2009
+ self.replace = to_streamed_response_wrapper(
2010
+ resources.replace,
2011
+ )
2012
+
2013
+ @cached_property
2014
+ def shield(self) -> ShieldResourceWithStreamingResponse:
2015
+ return ShieldResourceWithStreamingResponse(self._resources.shield)
2016
+
2017
+ @cached_property
2018
+ def rules(self) -> RulesResourceWithStreamingResponse:
2019
+ return RulesResourceWithStreamingResponse(self._resources.rules)
2020
+
2021
+
2022
+ class AsyncResourcesResourceWithStreamingResponse:
2023
+ def __init__(self, resources: AsyncResourcesResource) -> None:
2024
+ self._resources = resources
2025
+
2026
+ self.create = async_to_streamed_response_wrapper(
2027
+ resources.create,
2028
+ )
2029
+ self.update = async_to_streamed_response_wrapper(
2030
+ resources.update,
2031
+ )
2032
+ self.list = async_to_streamed_response_wrapper(
2033
+ resources.list,
2034
+ )
2035
+ self.delete = async_to_streamed_response_wrapper(
2036
+ resources.delete,
2037
+ )
2038
+ self.get = async_to_streamed_response_wrapper(
2039
+ resources.get,
2040
+ )
2041
+ self.prefetch = async_to_streamed_response_wrapper(
2042
+ resources.prefetch,
2043
+ )
2044
+ self.prevalidate_ssl_le_certificate = async_to_streamed_response_wrapper(
2045
+ resources.prevalidate_ssl_le_certificate,
2046
+ )
2047
+ self.purge = async_to_streamed_response_wrapper(
2048
+ resources.purge,
2049
+ )
2050
+ self.replace = async_to_streamed_response_wrapper(
2051
+ resources.replace,
2052
+ )
2053
+
2054
+ @cached_property
2055
+ def shield(self) -> AsyncShieldResourceWithStreamingResponse:
2056
+ return AsyncShieldResourceWithStreamingResponse(self._resources.shield)
2057
+
2058
+ @cached_property
2059
+ def rules(self) -> AsyncRulesResourceWithStreamingResponse:
2060
+ return AsyncRulesResourceWithStreamingResponse(self._resources.rules)