gcore 0.1.0a2__py3-none-any.whl → 0.3.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 (293) hide show
  1. gcore/__init__.py +5 -0
  2. gcore/_base_client.py +22 -2
  3. gcore/_client.py +9 -0
  4. gcore/_models.py +2 -0
  5. gcore/_types.py +2 -0
  6. gcore/_utils/_proxy.py +4 -1
  7. gcore/_utils/_resources_proxy.py +24 -0
  8. gcore/_version.py +1 -1
  9. gcore/resources/__init__.py +14 -0
  10. gcore/resources/cloud/baremetal/flavors.py +2 -2
  11. gcore/resources/cloud/baremetal/images.py +2 -2
  12. gcore/resources/cloud/baremetal/servers.py +280 -52
  13. gcore/resources/cloud/billing_reservations.py +24 -0
  14. gcore/resources/cloud/file_shares/file_shares.py +16 -0
  15. gcore/resources/cloud/floating_ips.py +4 -4
  16. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +358 -8
  17. gcore/resources/cloud/gpu_baremetal_clusters/images.py +206 -2
  18. gcore/resources/cloud/gpu_baremetal_clusters/servers.py +84 -4
  19. gcore/resources/cloud/inference/deployments/deployments.py +328 -10
  20. gcore/resources/cloud/instances/flavors.py +2 -2
  21. gcore/resources/cloud/instances/images.py +318 -2
  22. gcore/resources/cloud/instances/instances.py +534 -70
  23. gcore/resources/cloud/instances/interfaces.py +4 -4
  24. gcore/resources/cloud/load_balancers/flavors.py +2 -2
  25. gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +302 -20
  26. gcore/resources/cloud/load_balancers/l7_policies/rules.py +326 -0
  27. gcore/resources/cloud/load_balancers/listeners.py +385 -20
  28. gcore/resources/cloud/load_balancers/load_balancers.py +392 -24
  29. gcore/resources/cloud/load_balancers/pools/health_monitors.py +24 -0
  30. gcore/resources/cloud/load_balancers/pools/members.py +34 -6
  31. gcore/resources/cloud/load_balancers/pools/pools.py +388 -8
  32. gcore/resources/cloud/networks/networks.py +72 -16
  33. gcore/resources/cloud/networks/subnets.py +6 -6
  34. gcore/resources/cloud/registries/registries.py +6 -10
  35. gcore/resources/cloud/registries/users.py +4 -10
  36. gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +10 -10
  37. gcore/resources/cloud/secrets.py +56 -11
  38. gcore/resources/cloud/security_groups/security_groups.py +2 -2
  39. gcore/resources/cloud/ssh_keys.py +2 -2
  40. gcore/resources/cloud/tasks.py +203 -184
  41. gcore/resources/cloud/users/role_assignments.py +4 -4
  42. gcore/resources/cloud/volumes.py +18 -18
  43. gcore/resources/waap/__init__.py +131 -0
  44. gcore/resources/waap/advanced_rules.py +135 -0
  45. gcore/resources/waap/clients.py +135 -0
  46. gcore/resources/waap/custom_page_sets.py +805 -0
  47. gcore/resources/waap/domains/__init__.py +173 -0
  48. gcore/resources/waap/domains/advanced_rules.py +876 -0
  49. gcore/resources/waap/domains/analytics/__init__.py +33 -0
  50. gcore/resources/waap/domains/analytics/analytics.py +676 -0
  51. gcore/resources/waap/domains/analytics/requests.py +378 -0
  52. gcore/resources/waap/domains/api_discovery/__init__.py +33 -0
  53. gcore/resources/waap/domains/api_discovery/api_discovery.py +530 -0
  54. gcore/resources/waap/domains/api_discovery/scan_results.py +352 -0
  55. gcore/resources/waap/domains/api_path_groups.py +163 -0
  56. gcore/resources/waap/domains/api_paths.py +771 -0
  57. gcore/resources/waap/domains/custom_rules.py +889 -0
  58. gcore/resources/waap/domains/domains.py +914 -0
  59. gcore/resources/waap/domains/firewall_rules.py +884 -0
  60. gcore/resources/waap/domains/insight_silences.py +689 -0
  61. gcore/resources/waap/domains/insights.py +425 -0
  62. gcore/resources/waap/domains/policies.py +173 -0
  63. gcore/resources/waap/domains/settings.py +271 -0
  64. gcore/resources/waap/ip_info.py +1017 -0
  65. gcore/resources/waap/organizations.py +217 -0
  66. gcore/resources/waap/statistics.py +225 -0
  67. gcore/resources/waap/tags.py +233 -0
  68. gcore/resources/waap/waap.py +391 -0
  69. gcore/types/cloud/__init__.py +1 -0
  70. gcore/types/cloud/allowed_address_pairs.py +2 -2
  71. gcore/types/cloud/baremetal/baremetal_server.py +1 -1
  72. gcore/types/cloud/baremetal/image_list_params.py +1 -1
  73. gcore/types/cloud/baremetal/server_create_params.py +9 -9
  74. gcore/types/cloud/baremetal/server_list_params.py +8 -8
  75. gcore/types/cloud/baremetal/server_rebuild_params.py +1 -1
  76. gcore/types/cloud/baremetal_flavor.py +3 -3
  77. gcore/types/cloud/billing_reservation_list_params.py +5 -0
  78. gcore/types/cloud/container_probe_config.py +1 -1
  79. gcore/types/cloud/container_probe_config_create_param.py +2 -3
  80. gcore/types/cloud/container_scale_triggers.py +2 -2
  81. gcore/types/cloud/file_share.py +3 -0
  82. gcore/types/cloud/file_share_list_params.py +7 -1
  83. gcore/types/cloud/floating_ip_detailed.py +1 -1
  84. gcore/types/cloud/floating_ip_list_params.py +2 -2
  85. gcore/types/cloud/gpu_baremetal_cluster.py +1 -1
  86. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +21 -1
  87. gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +1 -1
  88. gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +1 -1
  89. gcore/types/cloud/gpu_baremetal_cluster_server.py +1 -1
  90. gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +1 -1
  91. gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py +10 -10
  92. gcore/types/cloud/gpu_baremetal_flavor.py +3 -3
  93. gcore/types/cloud/image.py +1 -1
  94. gcore/types/cloud/inference/deployment_create_params.py +4 -4
  95. gcore/types/cloud/inference/deployment_update_params.py +206 -9
  96. gcore/types/cloud/inference/inference.py +5 -5
  97. gcore/types/cloud/instance.py +1 -1
  98. gcore/types/cloud/instance_create_params.py +8 -10
  99. gcore/types/cloud/instance_list_params.py +8 -8
  100. gcore/types/cloud/instances/flavor_list_suitable_params.py +4 -1
  101. gcore/types/cloud/instances/image_list_params.py +1 -1
  102. gcore/types/cloud/instances/instance_flavor.py +3 -3
  103. gcore/types/cloud/instances/interface_attach_params.py +10 -10
  104. gcore/types/cloud/load_balancer_create_params.py +17 -15
  105. gcore/types/cloud/load_balancer_flavor_detail.py +3 -3
  106. gcore/types/cloud/load_balancer_l7_policy.py +5 -5
  107. gcore/types/cloud/load_balancer_list_params.py +5 -5
  108. gcore/types/cloud/load_balancer_listener_detail.py +17 -17
  109. gcore/types/cloud/load_balancer_pool.py +13 -13
  110. gcore/types/cloud/load_balancer_pool_list.py +99 -4
  111. gcore/types/cloud/load_balancers/l7_policy_create_params.py +5 -5
  112. gcore/types/cloud/load_balancers/l7_policy_replace_params.py +5 -5
  113. gcore/types/cloud/load_balancers/listener_create_params.py +6 -4
  114. gcore/types/cloud/load_balancers/listener_get_params.py +3 -1
  115. gcore/types/cloud/load_balancers/listener_list_params.py +4 -2
  116. gcore/types/cloud/load_balancers/listener_update_params.py +5 -3
  117. gcore/types/cloud/load_balancers/pool_create_params.py +6 -4
  118. gcore/types/cloud/load_balancers/pool_list_params.py +5 -6
  119. gcore/types/cloud/load_balancers/pool_update_params.py +6 -4
  120. gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +2 -0
  121. gcore/types/cloud/load_balancers/pools/member_add_params.py +5 -3
  122. gcore/types/cloud/member.py +2 -2
  123. gcore/types/cloud/network.py +22 -22
  124. gcore/types/cloud/network_create_params.py +2 -0
  125. gcore/types/cloud/network_details.py +25 -24
  126. gcore/types/cloud/network_list_params.py +15 -10
  127. gcore/types/cloud/network_update_params.py +2 -0
  128. gcore/types/cloud/networks/subnet_create_params.py +1 -1
  129. gcore/types/cloud/networks/subnet_list_params.py +2 -2
  130. gcore/types/cloud/quota_get_all_response.py +18 -0
  131. gcore/types/cloud/quota_get_by_region_response.py +18 -0
  132. gcore/types/cloud/quotas/request_create_params.py +9 -0
  133. gcore/types/cloud/quotas/request_get_response.py +9 -0
  134. gcore/types/cloud/quotas/request_list_response.py +9 -0
  135. gcore/types/cloud/region.py +4 -4
  136. gcore/types/cloud/registries/user_create_multiple_params.py +3 -5
  137. gcore/types/cloud/registries/user_create_params.py +3 -5
  138. gcore/types/cloud/registry_create_params.py +3 -5
  139. gcore/types/cloud/reserved_fixed_ip_create_params.py +2 -2
  140. gcore/types/cloud/reserved_fixed_ip_list_params.py +3 -3
  141. gcore/types/cloud/secret_list_params.py +24 -0
  142. gcore/types/cloud/security_group_list_params.py +1 -1
  143. gcore/types/cloud/session_persistence.py +1 -1
  144. gcore/types/cloud/ssh_key_created.py +3 -6
  145. gcore/types/cloud/task.py +1 -4
  146. gcore/types/cloud/task_list_params.py +56 -46
  147. gcore/types/cloud/users/role_assignment_create_params.py +1 -1
  148. gcore/types/cloud/users/role_assignment_update_params.py +1 -1
  149. gcore/types/cloud/volume_create_params.py +6 -6
  150. gcore/types/cloud/volume_list_params.py +3 -3
  151. gcore/types/waap/__init__.py +108 -0
  152. gcore/types/waap/client_me_response.py +34 -0
  153. gcore/types/waap/custom_page_set_create_params.py +35 -0
  154. gcore/types/waap/custom_page_set_list_params.py +25 -0
  155. gcore/types/waap/custom_page_set_preview_params.py +34 -0
  156. gcore/types/waap/custom_page_set_update_params.py +35 -0
  157. gcore/types/waap/domain_list_params.py +30 -0
  158. gcore/types/waap/domain_list_rule_sets_response.py +10 -0
  159. gcore/types/waap/domain_update_params.py +12 -0
  160. gcore/types/waap/domains/__init__.py +47 -0
  161. gcore/types/waap/domains/advanced_rule_create_params.py +80 -0
  162. gcore/types/waap/domains/advanced_rule_list_params.py +58 -0
  163. gcore/types/waap/domains/advanced_rule_update_params.py +83 -0
  164. gcore/types/waap/domains/analytics/__init__.py +5 -0
  165. gcore/types/waap/domains/analytics/request_list_params.py +53 -0
  166. gcore/types/waap/domains/analytics_get_event_statistics_params.py +34 -0
  167. gcore/types/waap/domains/analytics_list_ddos_attacks_params.py +28 -0
  168. gcore/types/waap/domains/analytics_list_ddos_info_params.py +31 -0
  169. gcore/types/waap/domains/analytics_list_event_traffic_params.py +26 -0
  170. gcore/types/waap/domains/analytics_list_event_traffic_response.py +10 -0
  171. gcore/types/waap/domains/api_discovery/__init__.py +7 -0
  172. gcore/types/waap/domains/api_discovery/scan_result_get_response.py +29 -0
  173. gcore/types/waap/domains/api_discovery/scan_result_list_params.py +41 -0
  174. gcore/types/waap/domains/api_discovery/scan_result_list_response.py +29 -0
  175. gcore/types/waap/domains/api_discovery_get_settings_response.py +36 -0
  176. gcore/types/waap/domains/api_discovery_scan_openapi_response.py +10 -0
  177. gcore/types/waap/domains/api_discovery_update_settings_params.py +34 -0
  178. gcore/types/waap/domains/api_discovery_update_settings_response.py +36 -0
  179. gcore/types/waap/domains/api_discovery_upload_openapi_params.py +19 -0
  180. gcore/types/waap/domains/api_discovery_upload_openapi_response.py +10 -0
  181. gcore/types/waap/domains/api_path_create_params.py +31 -0
  182. gcore/types/waap/domains/api_path_create_response.py +50 -0
  183. gcore/types/waap/domains/api_path_get_response.py +50 -0
  184. gcore/types/waap/domains/api_path_group_list_response.py +12 -0
  185. gcore/types/waap/domains/api_path_list_params.py +62 -0
  186. gcore/types/waap/domains/api_path_list_response.py +50 -0
  187. gcore/types/waap/domains/api_path_update_params.py +29 -0
  188. gcore/types/waap/domains/custom_rule_create_params.py +368 -0
  189. gcore/types/waap/domains/custom_rule_delete_multiple_params.py +13 -0
  190. gcore/types/waap/domains/custom_rule_list_params.py +35 -0
  191. gcore/types/waap/domains/custom_rule_update_params.py +371 -0
  192. gcore/types/waap/domains/firewall_rule_create_params.py +75 -0
  193. gcore/types/waap/domains/firewall_rule_delete_multiple_params.py +13 -0
  194. gcore/types/waap/domains/firewall_rule_list_params.py +33 -0
  195. gcore/types/waap/domains/firewall_rule_update_params.py +78 -0
  196. gcore/types/waap/domains/insight_list_params.py +34 -0
  197. gcore/types/waap/domains/insight_replace_params.py +17 -0
  198. gcore/types/waap/domains/insight_silence_create_params.py +28 -0
  199. gcore/types/waap/domains/insight_silence_list_params.py +33 -0
  200. gcore/types/waap/domains/insight_silence_update_params.py +28 -0
  201. gcore/types/waap/domains/setting_update_params.py +48 -0
  202. gcore/types/waap/ip_info_get_attack_time_series_params.py +12 -0
  203. gcore/types/waap/ip_info_get_attack_time_series_response.py +10 -0
  204. gcore/types/waap/ip_info_get_blocked_requests_params.py +15 -0
  205. gcore/types/waap/ip_info_get_blocked_requests_response.py +10 -0
  206. gcore/types/waap/ip_info_get_counts_params.py +19 -0
  207. gcore/types/waap/ip_info_get_ddos_attack_series_params.py +12 -0
  208. gcore/types/waap/ip_info_get_params.py +12 -0
  209. gcore/types/waap/ip_info_get_top_sessions_params.py +15 -0
  210. gcore/types/waap/ip_info_get_top_sessions_response.py +10 -0
  211. gcore/types/waap/ip_info_get_top_urls_params.py +15 -0
  212. gcore/types/waap/ip_info_get_top_urls_response.py +10 -0
  213. gcore/types/waap/ip_info_get_top_user_agents_params.py +15 -0
  214. gcore/types/waap/ip_info_get_top_user_agents_response.py +10 -0
  215. gcore/types/waap/ip_info_list_attacked_countries_params.py +12 -0
  216. gcore/types/waap/ip_info_list_attacked_countries_response.py +10 -0
  217. gcore/types/waap/organization_list_params.py +22 -0
  218. gcore/types/waap/statistic_get_usage_series_params.py +25 -0
  219. gcore/types/waap/tag_list_params.py +28 -0
  220. gcore/types/waap/waap_advanced_rule.py +83 -0
  221. gcore/types/waap/waap_advanced_rule_descriptor.py +49 -0
  222. gcore/types/waap/waap_advanced_rule_descriptor_list.py +15 -0
  223. gcore/types/waap/waap_block_csrf_page_data.py +28 -0
  224. gcore/types/waap/waap_block_csrf_page_data_param.py +28 -0
  225. gcore/types/waap/waap_block_page_data.py +28 -0
  226. gcore/types/waap/waap_block_page_data_param.py +28 -0
  227. gcore/types/waap/waap_blocked_statistics.py +36 -0
  228. gcore/types/waap/waap_captcha_page_data.py +31 -0
  229. gcore/types/waap/waap_captcha_page_data_param.py +31 -0
  230. gcore/types/waap/waap_common_tag.py +16 -0
  231. gcore/types/waap/waap_cookie_disabled_page_data.py +18 -0
  232. gcore/types/waap/waap_cookie_disabled_page_data_param.py +18 -0
  233. gcore/types/waap/waap_count_statistics.py +36 -0
  234. gcore/types/waap/waap_custom_page_preview.py +10 -0
  235. gcore/types/waap/waap_custom_page_set.py +36 -0
  236. gcore/types/waap/waap_custom_rule.py +373 -0
  237. gcore/types/waap/waap_customer_rule_state.py +7 -0
  238. gcore/types/waap/waap_ddos_attack.py +16 -0
  239. gcore/types/waap/waap_ddos_info.py +17 -0
  240. gcore/types/waap/waap_detailed_domain.py +37 -0
  241. gcore/types/waap/waap_domain_api_settings.py +22 -0
  242. gcore/types/waap/waap_domain_ddos_settings.py +31 -0
  243. gcore/types/waap/waap_domain_policy.py +29 -0
  244. gcore/types/waap/waap_domain_settings_model.py +15 -0
  245. gcore/types/waap/waap_domain_status.py +7 -0
  246. gcore/types/waap/waap_event_statistics.py +15 -0
  247. gcore/types/waap/waap_firewall_rule.py +78 -0
  248. gcore/types/waap/waap_get_account_overview_response.py +34 -0
  249. gcore/types/waap/waap_handshake_page_data.py +25 -0
  250. gcore/types/waap/waap_handshake_page_data_param.py +25 -0
  251. gcore/types/waap/waap_insight.py +38 -0
  252. gcore/types/waap/waap_insight_silence.py +28 -0
  253. gcore/types/waap/waap_insight_silence_sort_by.py +9 -0
  254. gcore/types/waap/waap_insight_sort_by.py +20 -0
  255. gcore/types/waap/waap_insight_status.py +7 -0
  256. gcore/types/waap/waap_ip_country_attack.py +16 -0
  257. gcore/types/waap/waap_ip_ddos_info_model.py +23 -0
  258. gcore/types/waap/waap_ip_info.py +57 -0
  259. gcore/types/waap/waap_ip_info_counts.py +16 -0
  260. gcore/types/waap/waap_javascript_disabled_page_data.py +18 -0
  261. gcore/types/waap/waap_javascript_disabled_page_data_param.py +18 -0
  262. gcore/types/waap/waap_network_details.py +17 -0
  263. gcore/types/waap/waap_organization.py +13 -0
  264. gcore/types/waap/waap_page_type.py +9 -0
  265. gcore/types/waap/waap_paginated_custom_page_set.py +22 -0
  266. gcore/types/waap/waap_paginated_ddos_attack.py +22 -0
  267. gcore/types/waap/waap_paginated_ddos_info.py +22 -0
  268. gcore/types/waap/waap_paginated_request_summary.py +22 -0
  269. gcore/types/waap/waap_pattern_matched_tag.py +37 -0
  270. gcore/types/waap/waap_policy_action.py +7 -0
  271. gcore/types/waap/waap_policy_mode.py +10 -0
  272. gcore/types/waap/waap_request_details.py +92 -0
  273. gcore/types/waap/waap_request_organization.py +13 -0
  274. gcore/types/waap/waap_request_summary.py +59 -0
  275. gcore/types/waap/waap_resolution.py +7 -0
  276. gcore/types/waap/waap_rule_action_type.py +7 -0
  277. gcore/types/waap/waap_rule_blocked_requests.py +16 -0
  278. gcore/types/waap/waap_rule_set.py +41 -0
  279. gcore/types/waap/waap_statistic_item.py +18 -0
  280. gcore/types/waap/waap_statistics_series.py +16 -0
  281. gcore/types/waap/waap_summary_domain.py +26 -0
  282. gcore/types/waap/waap_tag.py +16 -0
  283. gcore/types/waap/waap_time_series_attack.py +23 -0
  284. gcore/types/waap/waap_top_session.py +24 -0
  285. gcore/types/waap/waap_top_url.py +13 -0
  286. gcore/types/waap/waap_top_user_agent.py +13 -0
  287. gcore/types/waap/waap_traffic_metrics.py +68 -0
  288. gcore/types/waap/waap_traffic_type.py +28 -0
  289. gcore/types/waap/waap_user_agent_details.py +40 -0
  290. {gcore-0.1.0a2.dist-info → gcore-0.3.0.dist-info}/METADATA +3 -3
  291. {gcore-0.1.0a2.dist-info → gcore-0.3.0.dist-info}/RECORD +293 -126
  292. {gcore-0.1.0a2.dist-info → gcore-0.3.0.dist-info}/WHEEL +0 -0
  293. {gcore-0.1.0a2.dist-info → gcore-0.3.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,889 @@
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 Iterable, Optional
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
11
+ from ...._utils import maybe_transform, async_maybe_transform
12
+ from ...._compat import cached_property
13
+ from ...._resource import SyncAPIResource, AsyncAPIResource
14
+ from ...._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from ....pagination import SyncOffsetPage, AsyncOffsetPage
21
+ from ....types.waap import WaapRuleActionType, WaapCustomerRuleState
22
+ from ...._base_client import AsyncPaginator, make_request_options
23
+ from ....types.waap.domains import (
24
+ custom_rule_list_params,
25
+ custom_rule_create_params,
26
+ custom_rule_update_params,
27
+ custom_rule_delete_multiple_params,
28
+ )
29
+ from ....types.waap.waap_custom_rule import WaapCustomRule
30
+ from ....types.waap.waap_rule_action_type import WaapRuleActionType
31
+ from ....types.waap.waap_customer_rule_state import WaapCustomerRuleState
32
+
33
+ __all__ = ["CustomRulesResource", "AsyncCustomRulesResource"]
34
+
35
+
36
+ class CustomRulesResource(SyncAPIResource):
37
+ @cached_property
38
+ def with_raw_response(self) -> CustomRulesResourceWithRawResponse:
39
+ """
40
+ This property can be used as a prefix for any HTTP method call to return
41
+ the raw response object instead of the parsed content.
42
+
43
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
44
+ """
45
+ return CustomRulesResourceWithRawResponse(self)
46
+
47
+ @cached_property
48
+ def with_streaming_response(self) -> CustomRulesResourceWithStreamingResponse:
49
+ """
50
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
51
+
52
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
53
+ """
54
+ return CustomRulesResourceWithStreamingResponse(self)
55
+
56
+ def create(
57
+ self,
58
+ domain_id: int,
59
+ *,
60
+ action: custom_rule_create_params.Action,
61
+ conditions: Iterable[custom_rule_create_params.Condition],
62
+ enabled: bool,
63
+ name: str,
64
+ description: Optional[str] | NotGiven = NOT_GIVEN,
65
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
66
+ # The extra values given here take precedence over values defined on the client or passed to this method.
67
+ extra_headers: Headers | None = None,
68
+ extra_query: Query | None = None,
69
+ extra_body: Body | None = None,
70
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
71
+ ) -> WaapCustomRule:
72
+ """
73
+ Create a custom rule
74
+
75
+ Args:
76
+ domain_id: The domain ID
77
+
78
+ action: The action that a WAAP rule takes when triggered
79
+
80
+ conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have
81
+ between 1 and 5 conditions. All conditions must pass for the rule to trigger
82
+
83
+ enabled: Whether or not the rule is enabled
84
+
85
+ name: The name assigned to the rule
86
+
87
+ description: The description assigned to the rule
88
+
89
+ extra_headers: Send extra headers
90
+
91
+ extra_query: Add additional query parameters to the request
92
+
93
+ extra_body: Add additional JSON properties to the request
94
+
95
+ timeout: Override the client-level default timeout for this request, in seconds
96
+ """
97
+ return self._post(
98
+ f"/waap/v1/domains/{domain_id}/custom-rules",
99
+ body=maybe_transform(
100
+ {
101
+ "action": action,
102
+ "conditions": conditions,
103
+ "enabled": enabled,
104
+ "name": name,
105
+ "description": description,
106
+ },
107
+ custom_rule_create_params.CustomRuleCreateParams,
108
+ ),
109
+ options=make_request_options(
110
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
111
+ ),
112
+ cast_to=WaapCustomRule,
113
+ )
114
+
115
+ def update(
116
+ self,
117
+ rule_id: int,
118
+ *,
119
+ domain_id: int,
120
+ action: Optional[custom_rule_update_params.Action] | NotGiven = NOT_GIVEN,
121
+ conditions: Optional[Iterable[custom_rule_update_params.Condition]] | NotGiven = NOT_GIVEN,
122
+ description: Optional[str] | NotGiven = NOT_GIVEN,
123
+ enabled: Optional[bool] | NotGiven = NOT_GIVEN,
124
+ name: Optional[str] | NotGiven = NOT_GIVEN,
125
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
126
+ # The extra values given here take precedence over values defined on the client or passed to this method.
127
+ extra_headers: Headers | None = None,
128
+ extra_query: Query | None = None,
129
+ extra_body: Body | None = None,
130
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
131
+ ) -> None:
132
+ """
133
+ Only properties present in the request will be updated
134
+
135
+ Args:
136
+ domain_id: The domain ID
137
+
138
+ rule_id: The custom rule ID
139
+
140
+ action: The action that a WAAP rule takes when triggered
141
+
142
+ conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have
143
+ between 1 and 5 conditions. All conditions must pass for the rule to trigger
144
+
145
+ description: The description assigned to the rule
146
+
147
+ enabled: Whether or not the rule is enabled
148
+
149
+ name: The name assigned to the rule
150
+
151
+ extra_headers: Send extra headers
152
+
153
+ extra_query: Add additional query parameters to the request
154
+
155
+ extra_body: Add additional JSON properties to the request
156
+
157
+ timeout: Override the client-level default timeout for this request, in seconds
158
+ """
159
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
160
+ return self._patch(
161
+ f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}",
162
+ body=maybe_transform(
163
+ {
164
+ "action": action,
165
+ "conditions": conditions,
166
+ "description": description,
167
+ "enabled": enabled,
168
+ "name": name,
169
+ },
170
+ custom_rule_update_params.CustomRuleUpdateParams,
171
+ ),
172
+ options=make_request_options(
173
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
174
+ ),
175
+ cast_to=NoneType,
176
+ )
177
+
178
+ def list(
179
+ self,
180
+ domain_id: int,
181
+ *,
182
+ action: WaapRuleActionType | NotGiven = NOT_GIVEN,
183
+ description: str | NotGiven = NOT_GIVEN,
184
+ enabled: bool | NotGiven = NOT_GIVEN,
185
+ limit: int | NotGiven = NOT_GIVEN,
186
+ name: str | NotGiven = NOT_GIVEN,
187
+ offset: int | NotGiven = NOT_GIVEN,
188
+ ordering: Optional[
189
+ Literal[
190
+ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action"
191
+ ]
192
+ ]
193
+ | NotGiven = NOT_GIVEN,
194
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195
+ # The extra values given here take precedence over values defined on the client or passed to this method.
196
+ extra_headers: Headers | None = None,
197
+ extra_query: Query | None = None,
198
+ extra_body: Body | None = None,
199
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
200
+ ) -> SyncOffsetPage[WaapCustomRule]:
201
+ """
202
+ Extracts a list of custom rules assigned to a domain, offering filter, ordering,
203
+ and pagination capabilities
204
+
205
+ Args:
206
+ domain_id: The domain ID
207
+
208
+ action: Filter to refine results by specific actions
209
+
210
+ description: Filter rules based on their description. Supports '\\**' as a wildcard character.
211
+
212
+ enabled: Filter rules based on their active status
213
+
214
+ limit: Number of items to return
215
+
216
+ name: Filter rules based on their name. Supports '\\**' as a wildcard character.
217
+
218
+ offset: Number of items to skip
219
+
220
+ ordering: Determine the field to order results by
221
+
222
+ extra_headers: Send extra headers
223
+
224
+ extra_query: Add additional query parameters to the request
225
+
226
+ extra_body: Add additional JSON properties to the request
227
+
228
+ timeout: Override the client-level default timeout for this request, in seconds
229
+ """
230
+ return self._get_api_list(
231
+ f"/waap/v1/domains/{domain_id}/custom-rules",
232
+ page=SyncOffsetPage[WaapCustomRule],
233
+ options=make_request_options(
234
+ extra_headers=extra_headers,
235
+ extra_query=extra_query,
236
+ extra_body=extra_body,
237
+ timeout=timeout,
238
+ query=maybe_transform(
239
+ {
240
+ "action": action,
241
+ "description": description,
242
+ "enabled": enabled,
243
+ "limit": limit,
244
+ "name": name,
245
+ "offset": offset,
246
+ "ordering": ordering,
247
+ },
248
+ custom_rule_list_params.CustomRuleListParams,
249
+ ),
250
+ ),
251
+ model=WaapCustomRule,
252
+ )
253
+
254
+ def delete(
255
+ self,
256
+ rule_id: int,
257
+ *,
258
+ domain_id: int,
259
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
260
+ # The extra values given here take precedence over values defined on the client or passed to this method.
261
+ extra_headers: Headers | None = None,
262
+ extra_query: Query | None = None,
263
+ extra_body: Body | None = None,
264
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
265
+ ) -> None:
266
+ """
267
+ Delete a custom rule
268
+
269
+ Args:
270
+ domain_id: The domain ID
271
+
272
+ rule_id: The custom rule ID
273
+
274
+ extra_headers: Send extra headers
275
+
276
+ extra_query: Add additional query parameters to the request
277
+
278
+ extra_body: Add additional JSON properties to the request
279
+
280
+ timeout: Override the client-level default timeout for this request, in seconds
281
+ """
282
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
283
+ return self._delete(
284
+ f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}",
285
+ options=make_request_options(
286
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
287
+ ),
288
+ cast_to=NoneType,
289
+ )
290
+
291
+ def delete_multiple(
292
+ self,
293
+ domain_id: int,
294
+ *,
295
+ rule_ids: Iterable[int],
296
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
297
+ # The extra values given here take precedence over values defined on the client or passed to this method.
298
+ extra_headers: Headers | None = None,
299
+ extra_query: Query | None = None,
300
+ extra_body: Body | None = None,
301
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
302
+ ) -> None:
303
+ """
304
+ Delete multiple WAAP rules
305
+
306
+ Args:
307
+ domain_id: The domain ID
308
+
309
+ rule_ids: The IDs of the rules to delete
310
+
311
+ extra_headers: Send extra headers
312
+
313
+ extra_query: Add additional query parameters to the request
314
+
315
+ extra_body: Add additional JSON properties to the request
316
+
317
+ timeout: Override the client-level default timeout for this request, in seconds
318
+ """
319
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
320
+ return self._post(
321
+ f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete",
322
+ body=maybe_transform(
323
+ {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams
324
+ ),
325
+ options=make_request_options(
326
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
327
+ ),
328
+ cast_to=NoneType,
329
+ )
330
+
331
+ def get(
332
+ self,
333
+ rule_id: int,
334
+ *,
335
+ domain_id: int,
336
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
337
+ # The extra values given here take precedence over values defined on the client or passed to this method.
338
+ extra_headers: Headers | None = None,
339
+ extra_query: Query | None = None,
340
+ extra_body: Body | None = None,
341
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
342
+ ) -> WaapCustomRule:
343
+ """
344
+ Extracts a specific custom rule assigned to a domain
345
+
346
+ Args:
347
+ domain_id: The domain ID
348
+
349
+ rule_id: The custom rule ID
350
+
351
+ extra_headers: Send extra headers
352
+
353
+ extra_query: Add additional query parameters to the request
354
+
355
+ extra_body: Add additional JSON properties to the request
356
+
357
+ timeout: Override the client-level default timeout for this request, in seconds
358
+ """
359
+ return self._get(
360
+ f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}",
361
+ options=make_request_options(
362
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
363
+ ),
364
+ cast_to=WaapCustomRule,
365
+ )
366
+
367
+ def toggle(
368
+ self,
369
+ action: WaapCustomerRuleState,
370
+ *,
371
+ domain_id: int,
372
+ rule_id: int,
373
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
374
+ # The extra values given here take precedence over values defined on the client or passed to this method.
375
+ extra_headers: Headers | None = None,
376
+ extra_query: Query | None = None,
377
+ extra_body: Body | None = None,
378
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
379
+ ) -> None:
380
+ """
381
+ Toggle a custom rule
382
+
383
+ Args:
384
+ domain_id: The domain ID
385
+
386
+ rule_id: The custom rule ID
387
+
388
+ action: Enable or disable a custom rule
389
+
390
+ extra_headers: Send extra headers
391
+
392
+ extra_query: Add additional query parameters to the request
393
+
394
+ extra_body: Add additional JSON properties to the request
395
+
396
+ timeout: Override the client-level default timeout for this request, in seconds
397
+ """
398
+ if not action:
399
+ raise ValueError(f"Expected a non-empty value for `action` but received {action!r}")
400
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
401
+ return self._patch(
402
+ f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}",
403
+ options=make_request_options(
404
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
405
+ ),
406
+ cast_to=NoneType,
407
+ )
408
+
409
+
410
+ class AsyncCustomRulesResource(AsyncAPIResource):
411
+ @cached_property
412
+ def with_raw_response(self) -> AsyncCustomRulesResourceWithRawResponse:
413
+ """
414
+ This property can be used as a prefix for any HTTP method call to return
415
+ the raw response object instead of the parsed content.
416
+
417
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
418
+ """
419
+ return AsyncCustomRulesResourceWithRawResponse(self)
420
+
421
+ @cached_property
422
+ def with_streaming_response(self) -> AsyncCustomRulesResourceWithStreamingResponse:
423
+ """
424
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
425
+
426
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
427
+ """
428
+ return AsyncCustomRulesResourceWithStreamingResponse(self)
429
+
430
+ async def create(
431
+ self,
432
+ domain_id: int,
433
+ *,
434
+ action: custom_rule_create_params.Action,
435
+ conditions: Iterable[custom_rule_create_params.Condition],
436
+ enabled: bool,
437
+ name: str,
438
+ description: Optional[str] | NotGiven = NOT_GIVEN,
439
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
440
+ # The extra values given here take precedence over values defined on the client or passed to this method.
441
+ extra_headers: Headers | None = None,
442
+ extra_query: Query | None = None,
443
+ extra_body: Body | None = None,
444
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
445
+ ) -> WaapCustomRule:
446
+ """
447
+ Create a custom rule
448
+
449
+ Args:
450
+ domain_id: The domain ID
451
+
452
+ action: The action that a WAAP rule takes when triggered
453
+
454
+ conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have
455
+ between 1 and 5 conditions. All conditions must pass for the rule to trigger
456
+
457
+ enabled: Whether or not the rule is enabled
458
+
459
+ name: The name assigned to the rule
460
+
461
+ description: The description assigned to the rule
462
+
463
+ extra_headers: Send extra headers
464
+
465
+ extra_query: Add additional query parameters to the request
466
+
467
+ extra_body: Add additional JSON properties to the request
468
+
469
+ timeout: Override the client-level default timeout for this request, in seconds
470
+ """
471
+ return await self._post(
472
+ f"/waap/v1/domains/{domain_id}/custom-rules",
473
+ body=await async_maybe_transform(
474
+ {
475
+ "action": action,
476
+ "conditions": conditions,
477
+ "enabled": enabled,
478
+ "name": name,
479
+ "description": description,
480
+ },
481
+ custom_rule_create_params.CustomRuleCreateParams,
482
+ ),
483
+ options=make_request_options(
484
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
485
+ ),
486
+ cast_to=WaapCustomRule,
487
+ )
488
+
489
+ async def update(
490
+ self,
491
+ rule_id: int,
492
+ *,
493
+ domain_id: int,
494
+ action: Optional[custom_rule_update_params.Action] | NotGiven = NOT_GIVEN,
495
+ conditions: Optional[Iterable[custom_rule_update_params.Condition]] | NotGiven = NOT_GIVEN,
496
+ description: Optional[str] | NotGiven = NOT_GIVEN,
497
+ enabled: Optional[bool] | NotGiven = NOT_GIVEN,
498
+ name: Optional[str] | NotGiven = NOT_GIVEN,
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
+ Only properties present in the request will be updated
508
+
509
+ Args:
510
+ domain_id: The domain ID
511
+
512
+ rule_id: The custom rule ID
513
+
514
+ action: The action that a WAAP rule takes when triggered
515
+
516
+ conditions: The conditions required for the WAAP engine to trigger the rule. Rules may have
517
+ between 1 and 5 conditions. All conditions must pass for the rule to trigger
518
+
519
+ description: The description assigned to the rule
520
+
521
+ enabled: Whether or not the rule is enabled
522
+
523
+ name: The name assigned to the rule
524
+
525
+ extra_headers: Send extra headers
526
+
527
+ extra_query: Add additional query parameters to the request
528
+
529
+ extra_body: Add additional JSON properties to the request
530
+
531
+ timeout: Override the client-level default timeout for this request, in seconds
532
+ """
533
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
534
+ return await self._patch(
535
+ f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}",
536
+ body=await async_maybe_transform(
537
+ {
538
+ "action": action,
539
+ "conditions": conditions,
540
+ "description": description,
541
+ "enabled": enabled,
542
+ "name": name,
543
+ },
544
+ custom_rule_update_params.CustomRuleUpdateParams,
545
+ ),
546
+ options=make_request_options(
547
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
548
+ ),
549
+ cast_to=NoneType,
550
+ )
551
+
552
+ def list(
553
+ self,
554
+ domain_id: int,
555
+ *,
556
+ action: WaapRuleActionType | NotGiven = NOT_GIVEN,
557
+ description: str | NotGiven = NOT_GIVEN,
558
+ enabled: bool | NotGiven = NOT_GIVEN,
559
+ limit: int | NotGiven = NOT_GIVEN,
560
+ name: str | NotGiven = NOT_GIVEN,
561
+ offset: int | NotGiven = NOT_GIVEN,
562
+ ordering: Optional[
563
+ Literal[
564
+ "id", "name", "description", "enabled", "action", "-id", "-name", "-description", "-enabled", "-action"
565
+ ]
566
+ ]
567
+ | NotGiven = NOT_GIVEN,
568
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
569
+ # The extra values given here take precedence over values defined on the client or passed to this method.
570
+ extra_headers: Headers | None = None,
571
+ extra_query: Query | None = None,
572
+ extra_body: Body | None = None,
573
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
574
+ ) -> AsyncPaginator[WaapCustomRule, AsyncOffsetPage[WaapCustomRule]]:
575
+ """
576
+ Extracts a list of custom rules assigned to a domain, offering filter, ordering,
577
+ and pagination capabilities
578
+
579
+ Args:
580
+ domain_id: The domain ID
581
+
582
+ action: Filter to refine results by specific actions
583
+
584
+ description: Filter rules based on their description. Supports '\\**' as a wildcard character.
585
+
586
+ enabled: Filter rules based on their active status
587
+
588
+ limit: Number of items to return
589
+
590
+ name: Filter rules based on their name. Supports '\\**' as a wildcard character.
591
+
592
+ offset: Number of items to skip
593
+
594
+ ordering: Determine the field to order results by
595
+
596
+ extra_headers: Send extra headers
597
+
598
+ extra_query: Add additional query parameters to the request
599
+
600
+ extra_body: Add additional JSON properties to the request
601
+
602
+ timeout: Override the client-level default timeout for this request, in seconds
603
+ """
604
+ return self._get_api_list(
605
+ f"/waap/v1/domains/{domain_id}/custom-rules",
606
+ page=AsyncOffsetPage[WaapCustomRule],
607
+ options=make_request_options(
608
+ extra_headers=extra_headers,
609
+ extra_query=extra_query,
610
+ extra_body=extra_body,
611
+ timeout=timeout,
612
+ query=maybe_transform(
613
+ {
614
+ "action": action,
615
+ "description": description,
616
+ "enabled": enabled,
617
+ "limit": limit,
618
+ "name": name,
619
+ "offset": offset,
620
+ "ordering": ordering,
621
+ },
622
+ custom_rule_list_params.CustomRuleListParams,
623
+ ),
624
+ ),
625
+ model=WaapCustomRule,
626
+ )
627
+
628
+ async def delete(
629
+ self,
630
+ rule_id: int,
631
+ *,
632
+ domain_id: int,
633
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
634
+ # The extra values given here take precedence over values defined on the client or passed to this method.
635
+ extra_headers: Headers | None = None,
636
+ extra_query: Query | None = None,
637
+ extra_body: Body | None = None,
638
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
639
+ ) -> None:
640
+ """
641
+ Delete a custom rule
642
+
643
+ Args:
644
+ domain_id: The domain ID
645
+
646
+ rule_id: The custom rule ID
647
+
648
+ extra_headers: Send extra headers
649
+
650
+ extra_query: Add additional query parameters to the request
651
+
652
+ extra_body: Add additional JSON properties to the request
653
+
654
+ timeout: Override the client-level default timeout for this request, in seconds
655
+ """
656
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
657
+ return await self._delete(
658
+ f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}",
659
+ options=make_request_options(
660
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
661
+ ),
662
+ cast_to=NoneType,
663
+ )
664
+
665
+ async def delete_multiple(
666
+ self,
667
+ domain_id: int,
668
+ *,
669
+ rule_ids: Iterable[int],
670
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
671
+ # The extra values given here take precedence over values defined on the client or passed to this method.
672
+ extra_headers: Headers | None = None,
673
+ extra_query: Query | None = None,
674
+ extra_body: Body | None = None,
675
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
676
+ ) -> None:
677
+ """
678
+ Delete multiple WAAP rules
679
+
680
+ Args:
681
+ domain_id: The domain ID
682
+
683
+ rule_ids: The IDs of the rules to delete
684
+
685
+ extra_headers: Send extra headers
686
+
687
+ extra_query: Add additional query parameters to the request
688
+
689
+ extra_body: Add additional JSON properties to the request
690
+
691
+ timeout: Override the client-level default timeout for this request, in seconds
692
+ """
693
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
694
+ return await self._post(
695
+ f"/waap/v1/domains/{domain_id}/custom-rules/bulk_delete",
696
+ body=await async_maybe_transform(
697
+ {"rule_ids": rule_ids}, custom_rule_delete_multiple_params.CustomRuleDeleteMultipleParams
698
+ ),
699
+ options=make_request_options(
700
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
701
+ ),
702
+ cast_to=NoneType,
703
+ )
704
+
705
+ async def get(
706
+ self,
707
+ rule_id: int,
708
+ *,
709
+ domain_id: int,
710
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
711
+ # The extra values given here take precedence over values defined on the client or passed to this method.
712
+ extra_headers: Headers | None = None,
713
+ extra_query: Query | None = None,
714
+ extra_body: Body | None = None,
715
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
716
+ ) -> WaapCustomRule:
717
+ """
718
+ Extracts a specific custom rule assigned to a domain
719
+
720
+ Args:
721
+ domain_id: The domain ID
722
+
723
+ rule_id: The custom rule ID
724
+
725
+ extra_headers: Send extra headers
726
+
727
+ extra_query: Add additional query parameters to the request
728
+
729
+ extra_body: Add additional JSON properties to the request
730
+
731
+ timeout: Override the client-level default timeout for this request, in seconds
732
+ """
733
+ return await self._get(
734
+ f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}",
735
+ options=make_request_options(
736
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
737
+ ),
738
+ cast_to=WaapCustomRule,
739
+ )
740
+
741
+ async def toggle(
742
+ self,
743
+ action: WaapCustomerRuleState,
744
+ *,
745
+ domain_id: int,
746
+ rule_id: int,
747
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
748
+ # The extra values given here take precedence over values defined on the client or passed to this method.
749
+ extra_headers: Headers | None = None,
750
+ extra_query: Query | None = None,
751
+ extra_body: Body | None = None,
752
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
753
+ ) -> None:
754
+ """
755
+ Toggle a custom rule
756
+
757
+ Args:
758
+ domain_id: The domain ID
759
+
760
+ rule_id: The custom rule ID
761
+
762
+ action: Enable or disable a custom rule
763
+
764
+ extra_headers: Send extra headers
765
+
766
+ extra_query: Add additional query parameters to the request
767
+
768
+ extra_body: Add additional JSON properties to the request
769
+
770
+ timeout: Override the client-level default timeout for this request, in seconds
771
+ """
772
+ if not action:
773
+ raise ValueError(f"Expected a non-empty value for `action` but received {action!r}")
774
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
775
+ return await self._patch(
776
+ f"/waap/v1/domains/{domain_id}/custom-rules/{rule_id}/{action}",
777
+ options=make_request_options(
778
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
779
+ ),
780
+ cast_to=NoneType,
781
+ )
782
+
783
+
784
+ class CustomRulesResourceWithRawResponse:
785
+ def __init__(self, custom_rules: CustomRulesResource) -> None:
786
+ self._custom_rules = custom_rules
787
+
788
+ self.create = to_raw_response_wrapper(
789
+ custom_rules.create,
790
+ )
791
+ self.update = to_raw_response_wrapper(
792
+ custom_rules.update,
793
+ )
794
+ self.list = to_raw_response_wrapper(
795
+ custom_rules.list,
796
+ )
797
+ self.delete = to_raw_response_wrapper(
798
+ custom_rules.delete,
799
+ )
800
+ self.delete_multiple = to_raw_response_wrapper(
801
+ custom_rules.delete_multiple,
802
+ )
803
+ self.get = to_raw_response_wrapper(
804
+ custom_rules.get,
805
+ )
806
+ self.toggle = to_raw_response_wrapper(
807
+ custom_rules.toggle,
808
+ )
809
+
810
+
811
+ class AsyncCustomRulesResourceWithRawResponse:
812
+ def __init__(self, custom_rules: AsyncCustomRulesResource) -> None:
813
+ self._custom_rules = custom_rules
814
+
815
+ self.create = async_to_raw_response_wrapper(
816
+ custom_rules.create,
817
+ )
818
+ self.update = async_to_raw_response_wrapper(
819
+ custom_rules.update,
820
+ )
821
+ self.list = async_to_raw_response_wrapper(
822
+ custom_rules.list,
823
+ )
824
+ self.delete = async_to_raw_response_wrapper(
825
+ custom_rules.delete,
826
+ )
827
+ self.delete_multiple = async_to_raw_response_wrapper(
828
+ custom_rules.delete_multiple,
829
+ )
830
+ self.get = async_to_raw_response_wrapper(
831
+ custom_rules.get,
832
+ )
833
+ self.toggle = async_to_raw_response_wrapper(
834
+ custom_rules.toggle,
835
+ )
836
+
837
+
838
+ class CustomRulesResourceWithStreamingResponse:
839
+ def __init__(self, custom_rules: CustomRulesResource) -> None:
840
+ self._custom_rules = custom_rules
841
+
842
+ self.create = to_streamed_response_wrapper(
843
+ custom_rules.create,
844
+ )
845
+ self.update = to_streamed_response_wrapper(
846
+ custom_rules.update,
847
+ )
848
+ self.list = to_streamed_response_wrapper(
849
+ custom_rules.list,
850
+ )
851
+ self.delete = to_streamed_response_wrapper(
852
+ custom_rules.delete,
853
+ )
854
+ self.delete_multiple = to_streamed_response_wrapper(
855
+ custom_rules.delete_multiple,
856
+ )
857
+ self.get = to_streamed_response_wrapper(
858
+ custom_rules.get,
859
+ )
860
+ self.toggle = to_streamed_response_wrapper(
861
+ custom_rules.toggle,
862
+ )
863
+
864
+
865
+ class AsyncCustomRulesResourceWithStreamingResponse:
866
+ def __init__(self, custom_rules: AsyncCustomRulesResource) -> None:
867
+ self._custom_rules = custom_rules
868
+
869
+ self.create = async_to_streamed_response_wrapper(
870
+ custom_rules.create,
871
+ )
872
+ self.update = async_to_streamed_response_wrapper(
873
+ custom_rules.update,
874
+ )
875
+ self.list = async_to_streamed_response_wrapper(
876
+ custom_rules.list,
877
+ )
878
+ self.delete = async_to_streamed_response_wrapper(
879
+ custom_rules.delete,
880
+ )
881
+ self.delete_multiple = async_to_streamed_response_wrapper(
882
+ custom_rules.delete_multiple,
883
+ )
884
+ self.get = async_to_streamed_response_wrapper(
885
+ custom_rules.get,
886
+ )
887
+ self.toggle = async_to_streamed_response_wrapper(
888
+ custom_rules.toggle,
889
+ )