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