gcore 0.16.0__py3-none-any.whl → 0.23.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/_client.py +16 -0
- gcore/_models.py +37 -15
- gcore/_streaming.py +12 -12
- gcore/_utils/_sync.py +3 -31
- gcore/_utils/_utils.py +1 -1
- gcore/_version.py +1 -1
- gcore/resources/cdn/audit_log.py +4 -4
- gcore/resources/cdn/cdn.py +120 -21
- gcore/resources/cdn/ip_ranges.py +97 -5
- gcore/resources/cdn/{logs/logs.py → logs.py} +9 -9
- gcore/resources/cdn/resources/resources.py +20 -20
- gcore/resources/cdn/statistics.py +56 -58
- gcore/resources/cloud/__init__.py +40 -12
- gcore/resources/cloud/audit_logs.py +20 -0
- gcore/resources/cloud/baremetal/servers.py +48 -14
- gcore/resources/cloud/billing_reservations.py +2 -2
- gcore/resources/cloud/cloud.py +100 -18
- gcore/resources/cloud/databases/__init__.py +33 -0
- gcore/resources/cloud/databases/databases.py +102 -0
- gcore/resources/cloud/databases/postgres/__init__.py +61 -0
- gcore/resources/cloud/databases/postgres/clusters/__init__.py +33 -0
- gcore/resources/cloud/databases/postgres/clusters/clusters.py +716 -0
- gcore/resources/cloud/databases/postgres/clusters/user_credentials.py +281 -0
- gcore/resources/cloud/databases/postgres/configurations.py +169 -0
- gcore/resources/cloud/databases/postgres/custom_configurations.py +197 -0
- gcore/resources/cloud/databases/postgres/postgres.py +166 -0
- gcore/resources/cloud/file_shares/file_shares.py +154 -49
- gcore/resources/cloud/floating_ips.py +42 -10
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +70 -10
- gcore/resources/cloud/gpu_baremetal_clusters/images.py +40 -6
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +16 -0
- gcore/resources/cloud/gpu_virtual_clusters/__init__.py +89 -0
- gcore/resources/cloud/gpu_virtual_clusters/flavors.py +211 -0
- gcore/resources/cloud/gpu_virtual_clusters/gpu_virtual_clusters.py +1551 -0
- gcore/resources/cloud/gpu_virtual_clusters/images.py +582 -0
- gcore/resources/cloud/gpu_virtual_clusters/interfaces.py +187 -0
- gcore/resources/cloud/gpu_virtual_clusters/servers.py +506 -0
- gcore/resources/cloud/gpu_virtual_clusters/volumes.py +187 -0
- gcore/resources/cloud/inference/deployments/deployments.py +52 -4
- gcore/resources/cloud/instances/images.py +72 -18
- gcore/resources/cloud/instances/instances.py +110 -18
- gcore/resources/cloud/instances/interfaces.py +12 -0
- gcore/resources/cloud/k8s/__init__.py +12 -12
- gcore/resources/cloud/k8s/clusters/clusters.py +25 -25
- gcore/resources/cloud/k8s/clusters/pools/pools.py +14 -14
- gcore/resources/cloud/k8s/k8s.py +24 -24
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +1420 -218
- gcore/resources/cloud/load_balancers/l7_policies/rules.py +134 -22
- gcore/resources/cloud/load_balancers/listeners.py +77 -6
- gcore/resources/cloud/load_balancers/load_balancers.py +92 -14
- gcore/resources/cloud/load_balancers/pools/pools.py +52 -4
- gcore/resources/cloud/networks/networks.py +30 -10
- gcore/resources/cloud/networks/subnets.py +26 -10
- gcore/resources/cloud/placement_groups.py +8 -0
- gcore/resources/cloud/projects.py +99 -119
- gcore/resources/cloud/quotas/requests.py +0 -8
- gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +18 -0
- gcore/resources/cloud/secrets.py +16 -0
- gcore/resources/cloud/security_groups/security_groups.py +38 -12
- gcore/resources/cloud/ssh_keys.py +10 -0
- gcore/resources/cloud/tasks.py +22 -7
- gcore/resources/cloud/volumes.py +65 -23
- gcore/resources/dns/zones/rrsets.py +10 -10
- gcore/resources/dns/zones/zones.py +2 -2
- gcore/resources/security/bgp_announces.py +0 -4
- gcore/resources/security/profiles.py +31 -7
- gcore/resources/storage/credentials.py +0 -28
- gcore/resources/storage/storage.py +2 -2
- gcore/types/cdn/__init__.py +5 -0
- gcore/types/cdn/alibaba_regions.py +22 -0
- gcore/types/cdn/audit_log_list_params.py +2 -2
- gcore/types/cdn/aws_regions.py +22 -0
- gcore/types/cdn/cdn_list_purge_statuses_response.py +10 -0
- gcore/types/cdn/cdn_resource.py +17 -12
- gcore/types/cdn/ip_range_list_ips_params.py +19 -0
- gcore/types/cdn/ip_range_list_params.py +19 -0
- gcore/types/cdn/resource_create_params.py +17 -12
- gcore/types/cdn/resource_purge_params.py +4 -4
- gcore/types/cdn/resource_replace_params.py +17 -12
- gcore/types/cdn/resource_update_params.py +17 -12
- gcore/types/cdn/resource_usage_stats.py +16 -15
- gcore/types/cdn/resources/cdn_resource_rule.py +15 -10
- gcore/types/cdn/resources/rule_create_params.py +15 -10
- gcore/types/cdn/resources/rule_replace_params.py +15 -10
- gcore/types/cdn/resources/rule_update_params.py +15 -10
- gcore/types/cdn/rule_template.py +15 -10
- gcore/types/cdn/rule_template_create_params.py +15 -10
- gcore/types/cdn/rule_template_replace_params.py +15 -10
- gcore/types/cdn/rule_template_update_params.py +15 -10
- gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py +4 -1
- gcore/types/cdn/statistic_get_logs_usage_series_params.py +5 -12
- gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py +10 -21
- gcore/types/cdn/statistic_get_resource_usage_series_params.py +6 -1
- gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py +5 -2
- gcore/types/cdn/statistic_get_shield_usage_series_params.py +3 -0
- gcore/types/cloud/__init__.py +9 -3
- gcore/types/cloud/audit_log_entry.py +9 -3
- gcore/types/cloud/audit_log_list_params.py +12 -0
- gcore/types/cloud/baremetal/server_create_params.py +7 -7
- gcore/types/cloud/baremetal_flavor.py +0 -6
- gcore/types/cloud/billing_reservation_list_params.py +1 -1
- gcore/types/cloud/blackhole_port.py +4 -1
- gcore/types/cloud/databases/postgres/__init__.py +12 -0
- gcore/types/cloud/databases/postgres/cluster_create_params.py +108 -0
- gcore/types/cloud/databases/postgres/cluster_list_params.py +19 -0
- gcore/types/cloud/databases/postgres/cluster_update_params.py +102 -0
- gcore/types/cloud/databases/postgres/clusters/__init__.py +5 -0
- gcore/types/cloud/databases/postgres/clusters/postgres_user_credentials.py +13 -0
- gcore/types/cloud/databases/postgres/custom_configuration_validate_params.py +19 -0
- gcore/types/cloud/databases/postgres/pg_conf_validation.py +15 -0
- gcore/types/cloud/databases/postgres/postgres_cluster.py +118 -0
- gcore/types/cloud/databases/postgres/postgres_cluster_short.py +22 -0
- gcore/types/cloud/databases/postgres/postgres_configuration.py +31 -0
- gcore/types/cloud/file_share_create_params.py +8 -8
- gcore/types/cloud/file_share_update_params.py +7 -2
- gcore/types/cloud/floating_ip.py +5 -1
- gcore/types/cloud/floating_ip_create_params.py +4 -4
- gcore/types/cloud/floating_ip_detailed.py +5 -1
- gcore/types/cloud/floating_ip_list_params.py +8 -0
- gcore/types/cloud/floating_ip_update_params.py +7 -2
- gcore/types/cloud/gpu_baremetal_cluster.py +18 -3
- gcore/types/cloud/gpu_baremetal_cluster_action_params.py +7 -2
- gcore/types/cloud/gpu_baremetal_cluster_create_params.py +16 -4
- gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_cluster_server.py +5 -2
- gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +4 -4
- gcore/types/cloud/gpu_image.py +9 -0
- gcore/types/cloud/gpu_virtual_cluster.py +189 -0
- gcore/types/cloud/gpu_virtual_cluster_action_params.py +127 -0
- gcore/types/cloud/gpu_virtual_cluster_create_params.py +213 -0
- gcore/types/cloud/gpu_virtual_cluster_delete_params.py +41 -0
- gcore/types/cloud/gpu_virtual_cluster_list_params.py +21 -0
- gcore/types/cloud/gpu_virtual_cluster_update_params.py +18 -0
- gcore/types/cloud/gpu_virtual_clusters/__init__.py +16 -0
- gcore/types/cloud/gpu_virtual_clusters/flavor_list_params.py +21 -0
- gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server.py +77 -0
- gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_server_list.py +16 -0
- gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume.py +64 -0
- gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_cluster_volume_list.py +16 -0
- gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor.py +155 -0
- gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_flavor_list.py +16 -0
- gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface.py +190 -0
- gcore/types/cloud/gpu_virtual_clusters/gpu_virtual_interface_list.py +16 -0
- gcore/types/cloud/gpu_virtual_clusters/image_upload_params.py +56 -0
- gcore/types/cloud/gpu_virtual_clusters/server_delete_params.py +44 -0
- gcore/types/cloud/gpu_virtual_clusters/server_list_params.py +75 -0
- gcore/types/cloud/image.py +9 -0
- gcore/types/cloud/inference/deployment_create_params.py +1 -1
- gcore/types/cloud/inference/deployment_update_params.py +1 -1
- gcore/types/cloud/inference/inference_deployment.py +1 -1
- gcore/types/cloud/instance_create_params.py +27 -27
- gcore/types/cloud/instance_update_params.py +7 -2
- gcore/types/cloud/instances/image_create_from_volume_params.py +4 -4
- gcore/types/cloud/instances/image_update_params.py +4 -4
- gcore/types/cloud/instances/image_upload_params.py +4 -4
- gcore/types/cloud/k8s/__init__.py +4 -4
- gcore/types/cloud/k8s/cluster_update_params.py +5 -5
- gcore/types/cloud/k8s/clusters/__init__.py +2 -2
- gcore/types/cloud/k8s/clusters/k8s_cluster_pool.py +2 -2
- gcore/types/cloud/k8s/clusters/k8s_cluster_pool_list.py +4 -4
- gcore/types/cloud/k8s/k8s_cluster.py +4 -4
- gcore/types/cloud/k8s/k8s_cluster_certificate.py +2 -2
- gcore/types/cloud/k8s/k8s_cluster_kubeconfig.py +14 -2
- gcore/types/cloud/k8s/k8s_cluster_list.py +4 -4
- gcore/types/cloud/k8s_cluster_version.py +2 -2
- gcore/types/cloud/k8s_cluster_version_list.py +4 -4
- gcore/types/cloud/load_balancer_create_params.py +14 -8
- gcore/types/cloud/load_balancer_flavor_detail.py +2 -2
- gcore/types/cloud/load_balancer_l7_policy.py +29 -16
- gcore/types/cloud/load_balancer_l7_policy_list.py +3 -3
- gcore/types/cloud/load_balancer_l7_rule.py +14 -23
- gcore/types/cloud/load_balancer_l7_rule_list.py +3 -3
- gcore/types/cloud/load_balancer_listener_detail.py +2 -2
- gcore/types/cloud/load_balancer_update_params.py +7 -2
- gcore/types/cloud/load_balancers/__init__.py +1 -0
- gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py +5 -10
- gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py +7 -11
- gcore/types/cloud/load_balancers/l7_policy_create_params.py +102 -18
- gcore/types/cloud/load_balancers/l7_policy_replace_params.py +94 -16
- gcore/types/cloud/load_balancers/listener_create_params.py +4 -1
- gcore/types/cloud/load_balancers/listener_delete_params.py +18 -0
- gcore/types/cloud/load_balancers/listener_update_params.py +4 -1
- gcore/types/cloud/load_balancers/pool_create_params.py +1 -1
- gcore/types/cloud/network_create_params.py +4 -4
- gcore/types/cloud/network_update_params.py +7 -2
- gcore/types/cloud/networks/subnet_create_params.py +4 -4
- gcore/types/cloud/networks/subnet_update_params.py +7 -2
- gcore/types/cloud/project_create_params.py +0 -6
- gcore/types/cloud/{project_replace_params.py → project_update_params.py} +2 -2
- gcore/types/cloud/quotas/request_create_params.py +0 -3
- gcore/types/cloud/region.py +3 -3
- gcore/types/cloud/security_group.py +8 -1
- gcore/types/cloud/security_group_create_params.py +7 -5
- gcore/types/cloud/security_group_list_params.py +6 -4
- gcore/types/cloud/security_group_update_params.py +7 -2
- gcore/types/cloud/ssh_key_list_params.py +7 -0
- gcore/types/cloud/tag.py +2 -2
- gcore/types/cloud/task_id_list.py +3 -3
- gcore/types/cloud/volume_create_params.py +12 -12
- gcore/types/cloud/volume_update_params.py +7 -2
- gcore/types/dns/zone_list_params.py +1 -1
- gcore/types/iam/api_token_create.py +70 -1
- gcore/types/security/bgp_announce_list_params.py +0 -2
- gcore/types/security/client_profile.py +1 -0
- gcore/types/security/profile_create_params.py +4 -2
- gcore/types/security/profile_recreate_params.py +4 -2
- gcore/types/security/profile_replace_params.py +4 -2
- gcore/types/storage/credential_recreate_params.py +0 -17
- gcore/types/storage/storage.py +1 -1
- gcore/types/storage/storage_create_params.py +1 -1
- gcore/types/streaming/stream.py +3 -2
- gcore/types/streaming/video.py +1 -1
- gcore/types/waap/domains/custom_rule_create_params.py +1 -1
- gcore/types/waap/domains/custom_rule_update_params.py +1 -1
- gcore/types/waap/domains/waap_custom_rule.py +1 -1
- {gcore-0.16.0.dist-info → gcore-0.23.0.dist-info}/METADATA +14 -14
- {gcore-0.16.0.dist-info → gcore-0.23.0.dist-info}/RECORD +219 -168
- gcore/resources/cdn/logs/__init__.py +0 -19
- /gcore/types/{cdn/logs → cloud/databases}/__init__.py +0 -0
- {gcore-0.16.0.dist-info → gcore-0.23.0.dist-info}/WHEEL +0 -0
- {gcore-0.16.0.dist-info → gcore-0.23.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing_extensions import Literal
|
|
5
|
+
from typing_extensions import Literal, overload
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ from .rules import (
|
|
|
15
15
|
AsyncRulesResourceWithStreamingResponse,
|
|
16
16
|
)
|
|
17
17
|
from ....._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
18
|
-
from ....._utils import maybe_transform, async_maybe_transform
|
|
18
|
+
from ....._utils import required_args, maybe_transform, async_maybe_transform
|
|
19
19
|
from ....._compat import cached_property
|
|
20
20
|
from ....._resource import SyncAPIResource, AsyncAPIResource
|
|
21
21
|
from ....._response import (
|
|
@@ -57,19 +57,18 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
57
57
|
"""
|
|
58
58
|
return L7PoliciesResourceWithStreamingResponse(self)
|
|
59
59
|
|
|
60
|
+
@overload
|
|
60
61
|
def create(
|
|
61
62
|
self,
|
|
62
63
|
*,
|
|
63
64
|
project_id: int | None = None,
|
|
64
65
|
region_id: int | None = None,
|
|
65
|
-
action: Literal["
|
|
66
|
+
action: Literal["REDIRECT_TO_URL"],
|
|
66
67
|
listener_id: str,
|
|
68
|
+
redirect_url: str,
|
|
67
69
|
name: str | Omit = omit,
|
|
68
70
|
position: int | Omit = omit,
|
|
69
71
|
redirect_http_code: int | Omit = omit,
|
|
70
|
-
redirect_pool_id: str | Omit = omit,
|
|
71
|
-
redirect_prefix: str | Omit = omit,
|
|
72
|
-
redirect_url: str | Omit = omit,
|
|
73
72
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
74
73
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
75
74
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -82,26 +81,172 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
82
81
|
Create load balancer L7 policy
|
|
83
82
|
|
|
84
83
|
Args:
|
|
84
|
+
project_id: Project ID
|
|
85
|
+
|
|
86
|
+
region_id: Region ID
|
|
87
|
+
|
|
85
88
|
action: Action
|
|
86
89
|
|
|
87
90
|
listener_id: Listener ID
|
|
88
91
|
|
|
92
|
+
redirect_url: Requests matching this policy will be redirected to this URL.
|
|
93
|
+
|
|
89
94
|
name: Human-readable name of the policy
|
|
90
95
|
|
|
91
|
-
position: The position of this policy on the listener
|
|
96
|
+
position: The position of this policy on the listener
|
|
92
97
|
|
|
93
98
|
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
94
|
-
URL with the HTTP response code. Valid
|
|
95
|
-
|
|
99
|
+
URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308.
|
|
100
|
+
Default is 302.
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
valid if action is `REDIRECT_TO_POOL`.
|
|
102
|
+
tags: A list of simple strings assigned to the resource.
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
if action is `REDIRECT_PREFIX`.
|
|
104
|
+
extra_headers: Send extra headers
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
extra_query: Add additional query parameters to the request
|
|
107
|
+
|
|
108
|
+
extra_body: Add additional JSON properties to the request
|
|
109
|
+
|
|
110
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
111
|
+
"""
|
|
112
|
+
...
|
|
113
|
+
|
|
114
|
+
@overload
|
|
115
|
+
def create(
|
|
116
|
+
self,
|
|
117
|
+
*,
|
|
118
|
+
project_id: int | None = None,
|
|
119
|
+
region_id: int | None = None,
|
|
120
|
+
action: Literal["REDIRECT_PREFIX"],
|
|
121
|
+
listener_id: str,
|
|
122
|
+
redirect_prefix: str,
|
|
123
|
+
name: str | Omit = omit,
|
|
124
|
+
position: int | Omit = omit,
|
|
125
|
+
redirect_http_code: int | Omit = omit,
|
|
126
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
127
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
128
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
129
|
+
extra_headers: Headers | None = None,
|
|
130
|
+
extra_query: Query | None = None,
|
|
131
|
+
extra_body: Body | None = None,
|
|
132
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
133
|
+
) -> TaskIDList:
|
|
134
|
+
"""
|
|
135
|
+
Create load balancer L7 policy
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
project_id: Project ID
|
|
139
|
+
|
|
140
|
+
region_id: Region ID
|
|
141
|
+
|
|
142
|
+
action: Action
|
|
143
|
+
|
|
144
|
+
listener_id: Listener ID
|
|
145
|
+
|
|
146
|
+
redirect_prefix: Requests matching this policy will be redirected to this Prefix URL.
|
|
147
|
+
|
|
148
|
+
name: Human-readable name of the policy
|
|
149
|
+
|
|
150
|
+
position: The position of this policy on the listener
|
|
151
|
+
|
|
152
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
153
|
+
URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308.
|
|
154
|
+
Default is 302.
|
|
155
|
+
|
|
156
|
+
tags: A list of simple strings assigned to the resource.
|
|
157
|
+
|
|
158
|
+
extra_headers: Send extra headers
|
|
159
|
+
|
|
160
|
+
extra_query: Add additional query parameters to the request
|
|
161
|
+
|
|
162
|
+
extra_body: Add additional JSON properties to the request
|
|
163
|
+
|
|
164
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
165
|
+
"""
|
|
166
|
+
...
|
|
167
|
+
|
|
168
|
+
@overload
|
|
169
|
+
def create(
|
|
170
|
+
self,
|
|
171
|
+
*,
|
|
172
|
+
project_id: int | None = None,
|
|
173
|
+
region_id: int | None = None,
|
|
174
|
+
action: Literal["REDIRECT_TO_POOL"],
|
|
175
|
+
listener_id: str,
|
|
176
|
+
redirect_pool_id: str,
|
|
177
|
+
name: str | Omit = omit,
|
|
178
|
+
position: int | Omit = omit,
|
|
179
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
180
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
181
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
182
|
+
extra_headers: Headers | None = None,
|
|
183
|
+
extra_query: Query | None = None,
|
|
184
|
+
extra_body: Body | None = None,
|
|
185
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
186
|
+
) -> TaskIDList:
|
|
187
|
+
"""
|
|
188
|
+
Create load balancer L7 policy
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
project_id: Project ID
|
|
192
|
+
|
|
193
|
+
region_id: Region ID
|
|
194
|
+
|
|
195
|
+
action: Action
|
|
196
|
+
|
|
197
|
+
listener_id: Listener ID
|
|
198
|
+
|
|
199
|
+
redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID.
|
|
200
|
+
|
|
201
|
+
name: Human-readable name of the policy
|
|
202
|
+
|
|
203
|
+
position: The position of this policy on the listener
|
|
204
|
+
|
|
205
|
+
tags: A list of simple strings assigned to the resource.
|
|
206
|
+
|
|
207
|
+
extra_headers: Send extra headers
|
|
208
|
+
|
|
209
|
+
extra_query: Add additional query parameters to the request
|
|
210
|
+
|
|
211
|
+
extra_body: Add additional JSON properties to the request
|
|
212
|
+
|
|
213
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
214
|
+
"""
|
|
215
|
+
...
|
|
216
|
+
|
|
217
|
+
@overload
|
|
218
|
+
def create(
|
|
219
|
+
self,
|
|
220
|
+
*,
|
|
221
|
+
project_id: int | None = None,
|
|
222
|
+
region_id: int | None = None,
|
|
223
|
+
action: Literal["REJECT"],
|
|
224
|
+
listener_id: str,
|
|
225
|
+
name: str | Omit = omit,
|
|
226
|
+
position: int | Omit = omit,
|
|
227
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
228
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
229
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
230
|
+
extra_headers: Headers | None = None,
|
|
231
|
+
extra_query: Query | None = None,
|
|
232
|
+
extra_body: Body | None = None,
|
|
233
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
234
|
+
) -> TaskIDList:
|
|
235
|
+
"""
|
|
236
|
+
Create load balancer L7 policy
|
|
237
|
+
|
|
238
|
+
Args:
|
|
239
|
+
project_id: Project ID
|
|
240
|
+
|
|
241
|
+
region_id: Region ID
|
|
242
|
+
|
|
243
|
+
action: Action
|
|
244
|
+
|
|
245
|
+
listener_id: Listener ID
|
|
246
|
+
|
|
247
|
+
name: Human-readable name of the policy
|
|
248
|
+
|
|
249
|
+
position: The position of this policy on the listener
|
|
105
250
|
|
|
106
251
|
tags: A list of simple strings assigned to the resource.
|
|
107
252
|
|
|
@@ -113,6 +258,38 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
113
258
|
|
|
114
259
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
115
260
|
"""
|
|
261
|
+
...
|
|
262
|
+
|
|
263
|
+
@required_args(
|
|
264
|
+
["action", "listener_id", "redirect_url"],
|
|
265
|
+
["action", "listener_id", "redirect_prefix"],
|
|
266
|
+
["action", "listener_id", "redirect_pool_id"],
|
|
267
|
+
["action", "listener_id"],
|
|
268
|
+
)
|
|
269
|
+
def create(
|
|
270
|
+
self,
|
|
271
|
+
*,
|
|
272
|
+
project_id: int | None = None,
|
|
273
|
+
region_id: int | None = None,
|
|
274
|
+
action: Literal["REDIRECT_TO_URL"]
|
|
275
|
+
| Literal["REDIRECT_PREFIX"]
|
|
276
|
+
| Literal["REDIRECT_TO_POOL"]
|
|
277
|
+
| Literal["REJECT"],
|
|
278
|
+
listener_id: str,
|
|
279
|
+
redirect_url: str | Omit = omit,
|
|
280
|
+
name: str | Omit = omit,
|
|
281
|
+
position: int | Omit = omit,
|
|
282
|
+
redirect_http_code: int | Omit = omit,
|
|
283
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
284
|
+
redirect_prefix: str | Omit = omit,
|
|
285
|
+
redirect_pool_id: str | Omit = omit,
|
|
286
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
287
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
288
|
+
extra_headers: Headers | None = None,
|
|
289
|
+
extra_query: Query | None = None,
|
|
290
|
+
extra_body: Body | None = None,
|
|
291
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
292
|
+
) -> TaskIDList:
|
|
116
293
|
if project_id is None:
|
|
117
294
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
118
295
|
if region_id is None:
|
|
@@ -123,13 +300,13 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
123
300
|
{
|
|
124
301
|
"action": action,
|
|
125
302
|
"listener_id": listener_id,
|
|
303
|
+
"redirect_url": redirect_url,
|
|
126
304
|
"name": name,
|
|
127
305
|
"position": position,
|
|
128
306
|
"redirect_http_code": redirect_http_code,
|
|
129
|
-
"redirect_pool_id": redirect_pool_id,
|
|
130
|
-
"redirect_prefix": redirect_prefix,
|
|
131
|
-
"redirect_url": redirect_url,
|
|
132
307
|
"tags": tags,
|
|
308
|
+
"redirect_prefix": redirect_prefix,
|
|
309
|
+
"redirect_pool_id": redirect_pool_id,
|
|
133
310
|
},
|
|
134
311
|
l7_policy_create_params.L7PolicyCreateParams,
|
|
135
312
|
),
|
|
@@ -155,6 +332,10 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
155
332
|
List load balancer L7 policies
|
|
156
333
|
|
|
157
334
|
Args:
|
|
335
|
+
project_id: Project ID
|
|
336
|
+
|
|
337
|
+
region_id: Region ID
|
|
338
|
+
|
|
158
339
|
extra_headers: Send extra headers
|
|
159
340
|
|
|
160
341
|
extra_query: Add additional query parameters to the request
|
|
@@ -192,6 +373,12 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
192
373
|
Delete load balancer L7 policy
|
|
193
374
|
|
|
194
375
|
Args:
|
|
376
|
+
project_id: Project ID
|
|
377
|
+
|
|
378
|
+
region_id: Region ID
|
|
379
|
+
|
|
380
|
+
l7policy_id: L7 policy ID
|
|
381
|
+
|
|
195
382
|
extra_headers: Send extra headers
|
|
196
383
|
|
|
197
384
|
extra_query: Add additional query parameters to the request
|
|
@@ -231,6 +418,12 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
231
418
|
Get load balancer L7 policy
|
|
232
419
|
|
|
233
420
|
Args:
|
|
421
|
+
project_id: Project ID
|
|
422
|
+
|
|
423
|
+
region_id: Region ID
|
|
424
|
+
|
|
425
|
+
l7policy_id: L7 policy ID
|
|
426
|
+
|
|
234
427
|
extra_headers: Send extra headers
|
|
235
428
|
|
|
236
429
|
extra_query: Add additional query parameters to the request
|
|
@@ -253,19 +446,18 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
253
446
|
cast_to=LoadBalancerL7Policy,
|
|
254
447
|
)
|
|
255
448
|
|
|
449
|
+
@overload
|
|
256
450
|
def replace(
|
|
257
451
|
self,
|
|
258
452
|
l7policy_id: str,
|
|
259
453
|
*,
|
|
260
454
|
project_id: int | None = None,
|
|
261
455
|
region_id: int | None = None,
|
|
262
|
-
action: Literal["
|
|
456
|
+
action: Literal["REDIRECT_TO_URL"],
|
|
457
|
+
redirect_url: str,
|
|
263
458
|
name: str | Omit = omit,
|
|
264
459
|
position: int | Omit = omit,
|
|
265
460
|
redirect_http_code: int | Omit = omit,
|
|
266
|
-
redirect_pool_id: str | Omit = omit,
|
|
267
|
-
redirect_prefix: str | Omit = omit,
|
|
268
|
-
redirect_url: str | Omit = omit,
|
|
269
461
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
270
462
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
271
463
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -274,28 +466,90 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
274
466
|
extra_body: Body | None = None,
|
|
275
467
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
276
468
|
) -> TaskIDList:
|
|
277
|
-
"""
|
|
278
|
-
|
|
469
|
+
"""Replaces the entire L7 policy configuration with the provided data.
|
|
470
|
+
|
|
471
|
+
Any fields
|
|
472
|
+
omitted from the request body will be unset (set to null) or reset to their
|
|
473
|
+
default values (such as "`redirect_http_code`") depending on the "action". This
|
|
474
|
+
is a destructive operation that overwrites the complete policy configuration.
|
|
279
475
|
|
|
280
476
|
Args:
|
|
477
|
+
project_id: Project ID
|
|
478
|
+
|
|
479
|
+
region_id: Region ID
|
|
480
|
+
|
|
481
|
+
l7policy_id: L7 policy ID
|
|
482
|
+
|
|
281
483
|
action: Action
|
|
282
484
|
|
|
485
|
+
redirect_url: Requests matching this policy will be redirected to this URL. Only valid if
|
|
486
|
+
action is `REDIRECT_TO_URL`.
|
|
487
|
+
|
|
283
488
|
name: Human-readable name of the policy
|
|
284
489
|
|
|
285
|
-
position: The position of this policy on the listener
|
|
490
|
+
position: The position of this policy on the listener
|
|
286
491
|
|
|
287
492
|
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
288
493
|
URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or
|
|
289
494
|
`REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302.
|
|
290
495
|
|
|
291
|
-
|
|
292
|
-
valid if action is `REDIRECT_TO_POOL`.
|
|
496
|
+
tags: A list of simple strings assigned to the resource.
|
|
293
497
|
|
|
294
|
-
|
|
295
|
-
if action is `REDIRECT_PREFIX`.
|
|
498
|
+
extra_headers: Send extra headers
|
|
296
499
|
|
|
297
|
-
|
|
298
|
-
|
|
500
|
+
extra_query: Add additional query parameters to the request
|
|
501
|
+
|
|
502
|
+
extra_body: Add additional JSON properties to the request
|
|
503
|
+
|
|
504
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
505
|
+
"""
|
|
506
|
+
...
|
|
507
|
+
|
|
508
|
+
@overload
|
|
509
|
+
def replace(
|
|
510
|
+
self,
|
|
511
|
+
l7policy_id: str,
|
|
512
|
+
*,
|
|
513
|
+
project_id: int | None = None,
|
|
514
|
+
region_id: int | None = None,
|
|
515
|
+
action: Literal["REDIRECT_PREFIX"],
|
|
516
|
+
redirect_prefix: str,
|
|
517
|
+
name: str | Omit = omit,
|
|
518
|
+
position: int | Omit = omit,
|
|
519
|
+
redirect_http_code: int | Omit = omit,
|
|
520
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
521
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
522
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
523
|
+
extra_headers: Headers | None = None,
|
|
524
|
+
extra_query: Query | None = None,
|
|
525
|
+
extra_body: Body | None = None,
|
|
526
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
527
|
+
) -> TaskIDList:
|
|
528
|
+
"""Replaces the entire L7 policy configuration with the provided data.
|
|
529
|
+
|
|
530
|
+
Any fields
|
|
531
|
+
omitted from the request body will be unset (set to null) or reset to their
|
|
532
|
+
default values (such as "`redirect_http_code`") depending on the "action". This
|
|
533
|
+
is a destructive operation that overwrites the complete policy configuration.
|
|
534
|
+
|
|
535
|
+
Args:
|
|
536
|
+
project_id: Project ID
|
|
537
|
+
|
|
538
|
+
region_id: Region ID
|
|
539
|
+
|
|
540
|
+
l7policy_id: L7 policy ID
|
|
541
|
+
|
|
542
|
+
action: Action
|
|
543
|
+
|
|
544
|
+
redirect_prefix: Requests matching this policy will be redirected to this Prefix URL.
|
|
545
|
+
|
|
546
|
+
name: Human-readable name of the policy
|
|
547
|
+
|
|
548
|
+
position: The position of this policy on the listener
|
|
549
|
+
|
|
550
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
551
|
+
URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308.
|
|
552
|
+
Default is 302.
|
|
299
553
|
|
|
300
554
|
tags: A list of simple strings assigned to the resource.
|
|
301
555
|
|
|
@@ -307,57 +561,287 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
307
561
|
|
|
308
562
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
309
563
|
"""
|
|
310
|
-
|
|
311
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
312
|
-
if region_id is None:
|
|
313
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
314
|
-
if not l7policy_id:
|
|
315
|
-
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
316
|
-
return self._put(
|
|
317
|
-
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
318
|
-
body=maybe_transform(
|
|
319
|
-
{
|
|
320
|
-
"action": action,
|
|
321
|
-
"name": name,
|
|
322
|
-
"position": position,
|
|
323
|
-
"redirect_http_code": redirect_http_code,
|
|
324
|
-
"redirect_pool_id": redirect_pool_id,
|
|
325
|
-
"redirect_prefix": redirect_prefix,
|
|
326
|
-
"redirect_url": redirect_url,
|
|
327
|
-
"tags": tags,
|
|
328
|
-
},
|
|
329
|
-
l7_policy_replace_params.L7PolicyReplaceParams,
|
|
330
|
-
),
|
|
331
|
-
options=make_request_options(
|
|
332
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
333
|
-
),
|
|
334
|
-
cast_to=TaskIDList,
|
|
335
|
-
)
|
|
564
|
+
...
|
|
336
565
|
|
|
337
|
-
|
|
566
|
+
@overload
|
|
567
|
+
def replace(
|
|
338
568
|
self,
|
|
569
|
+
l7policy_id: str,
|
|
339
570
|
*,
|
|
340
571
|
project_id: int | None = None,
|
|
341
572
|
region_id: int | None = None,
|
|
342
|
-
action: Literal["
|
|
343
|
-
|
|
573
|
+
action: Literal["REDIRECT_TO_POOL"],
|
|
574
|
+
redirect_pool_id: str,
|
|
344
575
|
name: str | Omit = omit,
|
|
345
576
|
position: int | Omit = omit,
|
|
346
|
-
redirect_http_code: int | Omit = omit,
|
|
347
|
-
redirect_pool_id: str | Omit = omit,
|
|
348
|
-
redirect_prefix: str | Omit = omit,
|
|
349
|
-
redirect_url: str | Omit = omit,
|
|
350
577
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
351
|
-
polling_interval_seconds: int | Omit = omit,
|
|
352
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
353
578
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
354
579
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
355
580
|
extra_headers: Headers | None = None,
|
|
356
581
|
extra_query: Query | None = None,
|
|
357
582
|
extra_body: Body | None = None,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
583
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
584
|
+
) -> TaskIDList:
|
|
585
|
+
"""Replaces the entire L7 policy configuration with the provided data.
|
|
586
|
+
|
|
587
|
+
Any fields
|
|
588
|
+
omitted from the request body will be unset (set to null) or reset to their
|
|
589
|
+
default values (such as "`redirect_http_code`") depending on the "action". This
|
|
590
|
+
is a destructive operation that overwrites the complete policy configuration.
|
|
591
|
+
|
|
592
|
+
Args:
|
|
593
|
+
project_id: Project ID
|
|
594
|
+
|
|
595
|
+
region_id: Region ID
|
|
596
|
+
|
|
597
|
+
l7policy_id: L7 policy ID
|
|
598
|
+
|
|
599
|
+
action: Action
|
|
600
|
+
|
|
601
|
+
redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID.
|
|
602
|
+
|
|
603
|
+
name: Human-readable name of the policy
|
|
604
|
+
|
|
605
|
+
position: The position of this policy on the listener
|
|
606
|
+
|
|
607
|
+
tags: A list of simple strings assigned to the resource.
|
|
608
|
+
|
|
609
|
+
extra_headers: Send extra headers
|
|
610
|
+
|
|
611
|
+
extra_query: Add additional query parameters to the request
|
|
612
|
+
|
|
613
|
+
extra_body: Add additional JSON properties to the request
|
|
614
|
+
|
|
615
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
616
|
+
"""
|
|
617
|
+
...
|
|
618
|
+
|
|
619
|
+
@overload
|
|
620
|
+
def replace(
|
|
621
|
+
self,
|
|
622
|
+
l7policy_id: str,
|
|
623
|
+
*,
|
|
624
|
+
project_id: int | None = None,
|
|
625
|
+
region_id: int | None = None,
|
|
626
|
+
action: Literal["REJECT"],
|
|
627
|
+
name: str | Omit = omit,
|
|
628
|
+
position: int | Omit = omit,
|
|
629
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
630
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
631
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
632
|
+
extra_headers: Headers | None = None,
|
|
633
|
+
extra_query: Query | None = None,
|
|
634
|
+
extra_body: Body | None = None,
|
|
635
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
636
|
+
) -> TaskIDList:
|
|
637
|
+
"""Replaces the entire L7 policy configuration with the provided data.
|
|
638
|
+
|
|
639
|
+
Any fields
|
|
640
|
+
omitted from the request body will be unset (set to null) or reset to their
|
|
641
|
+
default values (such as "`redirect_http_code`") depending on the "action". This
|
|
642
|
+
is a destructive operation that overwrites the complete policy configuration.
|
|
643
|
+
|
|
644
|
+
Args:
|
|
645
|
+
project_id: Project ID
|
|
646
|
+
|
|
647
|
+
region_id: Region ID
|
|
648
|
+
|
|
649
|
+
l7policy_id: L7 policy ID
|
|
650
|
+
|
|
651
|
+
action: Action
|
|
652
|
+
|
|
653
|
+
name: Human-readable name of the policy
|
|
654
|
+
|
|
655
|
+
position: The position of this policy on the listener
|
|
656
|
+
|
|
657
|
+
tags: A list of simple strings assigned to the resource.
|
|
658
|
+
|
|
659
|
+
extra_headers: Send extra headers
|
|
660
|
+
|
|
661
|
+
extra_query: Add additional query parameters to the request
|
|
662
|
+
|
|
663
|
+
extra_body: Add additional JSON properties to the request
|
|
664
|
+
|
|
665
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
666
|
+
"""
|
|
667
|
+
...
|
|
668
|
+
|
|
669
|
+
@required_args(
|
|
670
|
+
["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"]
|
|
671
|
+
)
|
|
672
|
+
def replace(
|
|
673
|
+
self,
|
|
674
|
+
l7policy_id: str,
|
|
675
|
+
*,
|
|
676
|
+
project_id: int | None = None,
|
|
677
|
+
region_id: int | None = None,
|
|
678
|
+
action: Literal["REDIRECT_TO_URL"]
|
|
679
|
+
| Literal["REDIRECT_PREFIX"]
|
|
680
|
+
| Literal["REDIRECT_TO_POOL"]
|
|
681
|
+
| Literal["REJECT"],
|
|
682
|
+
redirect_url: str | Omit = omit,
|
|
683
|
+
name: str | Omit = omit,
|
|
684
|
+
position: int | Omit = omit,
|
|
685
|
+
redirect_http_code: int | Omit = omit,
|
|
686
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
687
|
+
redirect_prefix: str | Omit = omit,
|
|
688
|
+
redirect_pool_id: str | Omit = omit,
|
|
689
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
690
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
691
|
+
extra_headers: Headers | None = None,
|
|
692
|
+
extra_query: Query | None = None,
|
|
693
|
+
extra_body: Body | None = None,
|
|
694
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
695
|
+
) -> TaskIDList:
|
|
696
|
+
if project_id is None:
|
|
697
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
698
|
+
if region_id is None:
|
|
699
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
700
|
+
if not l7policy_id:
|
|
701
|
+
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
702
|
+
return self._put(
|
|
703
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
704
|
+
body=maybe_transform(
|
|
705
|
+
{
|
|
706
|
+
"action": action,
|
|
707
|
+
"redirect_url": redirect_url,
|
|
708
|
+
"name": name,
|
|
709
|
+
"position": position,
|
|
710
|
+
"redirect_http_code": redirect_http_code,
|
|
711
|
+
"tags": tags,
|
|
712
|
+
"redirect_prefix": redirect_prefix,
|
|
713
|
+
"redirect_pool_id": redirect_pool_id,
|
|
714
|
+
},
|
|
715
|
+
l7_policy_replace_params.L7PolicyReplaceParams,
|
|
716
|
+
),
|
|
717
|
+
options=make_request_options(
|
|
718
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
719
|
+
),
|
|
720
|
+
cast_to=TaskIDList,
|
|
721
|
+
)
|
|
722
|
+
|
|
723
|
+
@overload
|
|
724
|
+
def create_and_poll(
|
|
725
|
+
self,
|
|
726
|
+
*,
|
|
727
|
+
project_id: int | None = None,
|
|
728
|
+
region_id: int | None = None,
|
|
729
|
+
action: Literal["REDIRECT_TO_URL"],
|
|
730
|
+
listener_id: str,
|
|
731
|
+
redirect_url: str,
|
|
732
|
+
name: str | Omit = omit,
|
|
733
|
+
position: int | Omit = omit,
|
|
734
|
+
redirect_http_code: int | Omit = omit,
|
|
735
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
736
|
+
polling_interval_seconds: int | Omit = omit,
|
|
737
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
738
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
739
|
+
extra_headers: Headers | None = None,
|
|
740
|
+
extra_query: Query | None = None,
|
|
741
|
+
extra_body: Body | None = None,
|
|
742
|
+
) -> LoadBalancerL7Policy:
|
|
743
|
+
"""Create L7 policy and poll for completion."""
|
|
744
|
+
...
|
|
745
|
+
|
|
746
|
+
@overload
|
|
747
|
+
def create_and_poll(
|
|
748
|
+
self,
|
|
749
|
+
*,
|
|
750
|
+
project_id: int | None = None,
|
|
751
|
+
region_id: int | None = None,
|
|
752
|
+
action: Literal["REDIRECT_PREFIX"],
|
|
753
|
+
listener_id: str,
|
|
754
|
+
redirect_prefix: str,
|
|
755
|
+
name: str | Omit = omit,
|
|
756
|
+
position: int | Omit = omit,
|
|
757
|
+
redirect_http_code: int | Omit = omit,
|
|
758
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
759
|
+
polling_interval_seconds: int | Omit = omit,
|
|
760
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
761
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
762
|
+
extra_headers: Headers | None = None,
|
|
763
|
+
extra_query: Query | None = None,
|
|
764
|
+
extra_body: Body | None = None,
|
|
765
|
+
) -> LoadBalancerL7Policy:
|
|
766
|
+
"""Create L7 policy and poll for completion."""
|
|
767
|
+
...
|
|
768
|
+
|
|
769
|
+
@overload
|
|
770
|
+
def create_and_poll(
|
|
771
|
+
self,
|
|
772
|
+
*,
|
|
773
|
+
project_id: int | None = None,
|
|
774
|
+
region_id: int | None = None,
|
|
775
|
+
action: Literal["REDIRECT_TO_POOL"],
|
|
776
|
+
listener_id: str,
|
|
777
|
+
redirect_pool_id: str,
|
|
778
|
+
name: str | Omit = omit,
|
|
779
|
+
position: int | Omit = omit,
|
|
780
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
781
|
+
polling_interval_seconds: int | Omit = omit,
|
|
782
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
783
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
784
|
+
extra_headers: Headers | None = None,
|
|
785
|
+
extra_query: Query | None = None,
|
|
786
|
+
extra_body: Body | None = None,
|
|
787
|
+
) -> LoadBalancerL7Policy:
|
|
788
|
+
"""Create L7 policy and poll for completion."""
|
|
789
|
+
...
|
|
790
|
+
|
|
791
|
+
@overload
|
|
792
|
+
def create_and_poll(
|
|
793
|
+
self,
|
|
794
|
+
*,
|
|
795
|
+
project_id: int | None = None,
|
|
796
|
+
region_id: int | None = None,
|
|
797
|
+
action: Literal["REJECT"],
|
|
798
|
+
listener_id: str,
|
|
799
|
+
name: str | Omit = omit,
|
|
800
|
+
position: int | Omit = omit,
|
|
801
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
802
|
+
polling_interval_seconds: int | Omit = omit,
|
|
803
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
804
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
805
|
+
extra_headers: Headers | None = None,
|
|
806
|
+
extra_query: Query | None = None,
|
|
807
|
+
extra_body: Body | None = None,
|
|
808
|
+
) -> LoadBalancerL7Policy:
|
|
809
|
+
"""Create L7 policy and poll for completion."""
|
|
810
|
+
...
|
|
811
|
+
|
|
812
|
+
@required_args(
|
|
813
|
+
["action", "listener_id", "redirect_url"],
|
|
814
|
+
["action", "listener_id", "redirect_prefix"],
|
|
815
|
+
["action", "listener_id", "redirect_pool_id"],
|
|
816
|
+
["action", "listener_id"],
|
|
817
|
+
)
|
|
818
|
+
def create_and_poll(
|
|
819
|
+
self,
|
|
820
|
+
*,
|
|
821
|
+
project_id: int | None = None,
|
|
822
|
+
region_id: int | None = None,
|
|
823
|
+
action: Literal["REDIRECT_TO_URL"]
|
|
824
|
+
| Literal["REDIRECT_PREFIX"]
|
|
825
|
+
| Literal["REDIRECT_TO_POOL"]
|
|
826
|
+
| Literal["REJECT"],
|
|
827
|
+
listener_id: str,
|
|
828
|
+
redirect_url: str | Omit = omit,
|
|
829
|
+
name: str | Omit = omit,
|
|
830
|
+
position: int | Omit = omit,
|
|
831
|
+
redirect_http_code: int | Omit = omit,
|
|
832
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
833
|
+
redirect_prefix: str | Omit = omit,
|
|
834
|
+
redirect_pool_id: str | Omit = omit,
|
|
835
|
+
polling_interval_seconds: int | Omit = omit,
|
|
836
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
837
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
838
|
+
extra_headers: Headers | None = None,
|
|
839
|
+
extra_query: Query | None = None,
|
|
840
|
+
extra_body: Body | None = None,
|
|
841
|
+
) -> LoadBalancerL7Policy:
|
|
842
|
+
"""Create L7 policy and poll for completion."""
|
|
843
|
+
response: TaskIDList = self.create( # type: ignore
|
|
844
|
+
project_id=project_id,
|
|
361
845
|
region_id=region_id,
|
|
362
846
|
action=action,
|
|
363
847
|
listener_id=listener_id,
|
|
@@ -373,12 +857,13 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
373
857
|
extra_body=extra_body,
|
|
374
858
|
timeout=timeout,
|
|
375
859
|
)
|
|
376
|
-
if not response.tasks or len(response.tasks) != 1:
|
|
860
|
+
if not response.tasks or len(response.tasks) != 1: # type: ignore[union-attr]
|
|
377
861
|
raise ValueError(f"Expected exactly one task to be created")
|
|
378
862
|
task = self._client.cloud.tasks.poll(
|
|
379
|
-
task_id=response.tasks[0],
|
|
863
|
+
task_id=response.tasks[0], # type: ignore[index]
|
|
380
864
|
extra_headers=extra_headers,
|
|
381
865
|
polling_interval_seconds=polling_interval_seconds,
|
|
866
|
+
polling_timeout_seconds=polling_timeout_seconds,
|
|
382
867
|
)
|
|
383
868
|
if (
|
|
384
869
|
not task.created_resources
|
|
@@ -401,6 +886,7 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
401
886
|
project_id: int | None = None,
|
|
402
887
|
region_id: int | None = None,
|
|
403
888
|
polling_interval_seconds: int | Omit = omit,
|
|
889
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
404
890
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
405
891
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
406
892
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -423,100 +909,351 @@ class L7PoliciesResource(SyncAPIResource):
|
|
|
423
909
|
task_id=response.tasks[0],
|
|
424
910
|
extra_headers=extra_headers,
|
|
425
911
|
polling_interval_seconds=polling_interval_seconds,
|
|
912
|
+
polling_timeout_seconds=polling_timeout_seconds,
|
|
426
913
|
)
|
|
427
914
|
|
|
915
|
+
@overload
|
|
428
916
|
def replace_and_poll(
|
|
429
917
|
self,
|
|
430
918
|
l7policy_id: str,
|
|
431
919
|
*,
|
|
432
920
|
project_id: int | None = None,
|
|
433
921
|
region_id: int | None = None,
|
|
434
|
-
action: Literal["
|
|
922
|
+
action: Literal["REDIRECT_TO_URL"],
|
|
923
|
+
redirect_url: str,
|
|
435
924
|
name: str | Omit = omit,
|
|
436
925
|
position: int | Omit = omit,
|
|
437
926
|
redirect_http_code: int | Omit = omit,
|
|
438
|
-
|
|
439
|
-
|
|
927
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
928
|
+
polling_interval_seconds: int | Omit = omit,
|
|
929
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
930
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
931
|
+
extra_headers: Headers | None = None,
|
|
932
|
+
extra_query: Query | None = None,
|
|
933
|
+
extra_body: Body | None = None,
|
|
934
|
+
) -> LoadBalancerL7Policy:
|
|
935
|
+
"""Replace L7 policy and poll for completion."""
|
|
936
|
+
...
|
|
937
|
+
|
|
938
|
+
@overload
|
|
939
|
+
def replace_and_poll(
|
|
940
|
+
self,
|
|
941
|
+
l7policy_id: str,
|
|
942
|
+
*,
|
|
943
|
+
project_id: int | None = None,
|
|
944
|
+
region_id: int | None = None,
|
|
945
|
+
action: Literal["REDIRECT_PREFIX"],
|
|
946
|
+
redirect_prefix: str,
|
|
947
|
+
name: str | Omit = omit,
|
|
948
|
+
position: int | Omit = omit,
|
|
949
|
+
redirect_http_code: int | Omit = omit,
|
|
950
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
951
|
+
polling_interval_seconds: int | Omit = omit,
|
|
952
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
953
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
954
|
+
extra_headers: Headers | None = None,
|
|
955
|
+
extra_query: Query | None = None,
|
|
956
|
+
extra_body: Body | None = None,
|
|
957
|
+
) -> LoadBalancerL7Policy:
|
|
958
|
+
"""Replace L7 policy and poll for completion."""
|
|
959
|
+
...
|
|
960
|
+
|
|
961
|
+
@overload
|
|
962
|
+
def replace_and_poll(
|
|
963
|
+
self,
|
|
964
|
+
l7policy_id: str,
|
|
965
|
+
*,
|
|
966
|
+
project_id: int | None = None,
|
|
967
|
+
region_id: int | None = None,
|
|
968
|
+
action: Literal["REDIRECT_TO_POOL"],
|
|
969
|
+
redirect_pool_id: str,
|
|
970
|
+
name: str | Omit = omit,
|
|
971
|
+
position: int | Omit = omit,
|
|
972
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
973
|
+
polling_interval_seconds: int | Omit = omit,
|
|
974
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
975
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
976
|
+
extra_headers: Headers | None = None,
|
|
977
|
+
extra_query: Query | None = None,
|
|
978
|
+
extra_body: Body | None = None,
|
|
979
|
+
) -> LoadBalancerL7Policy:
|
|
980
|
+
"""Replace L7 policy and poll for completion."""
|
|
981
|
+
...
|
|
982
|
+
|
|
983
|
+
@overload
|
|
984
|
+
def replace_and_poll(
|
|
985
|
+
self,
|
|
986
|
+
l7policy_id: str,
|
|
987
|
+
*,
|
|
988
|
+
project_id: int | None = None,
|
|
989
|
+
region_id: int | None = None,
|
|
990
|
+
action: Literal["REJECT"],
|
|
991
|
+
name: str | Omit = omit,
|
|
992
|
+
position: int | Omit = omit,
|
|
993
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
994
|
+
polling_interval_seconds: int | Omit = omit,
|
|
995
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
996
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
997
|
+
extra_headers: Headers | None = None,
|
|
998
|
+
extra_query: Query | None = None,
|
|
999
|
+
extra_body: Body | None = None,
|
|
1000
|
+
) -> LoadBalancerL7Policy:
|
|
1001
|
+
"""Replace L7 policy and poll for completion."""
|
|
1002
|
+
...
|
|
1003
|
+
|
|
1004
|
+
@required_args(
|
|
1005
|
+
["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"]
|
|
1006
|
+
)
|
|
1007
|
+
def replace_and_poll(
|
|
1008
|
+
self,
|
|
1009
|
+
l7policy_id: str,
|
|
1010
|
+
*,
|
|
1011
|
+
project_id: int | None = None,
|
|
1012
|
+
region_id: int | None = None,
|
|
1013
|
+
action: Literal["REDIRECT_TO_URL"]
|
|
1014
|
+
| Literal["REDIRECT_PREFIX"]
|
|
1015
|
+
| Literal["REDIRECT_TO_POOL"]
|
|
1016
|
+
| Literal["REJECT"],
|
|
440
1017
|
redirect_url: str | Omit = omit,
|
|
1018
|
+
name: str | Omit = omit,
|
|
1019
|
+
position: int | Omit = omit,
|
|
1020
|
+
redirect_http_code: int | Omit = omit,
|
|
1021
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1022
|
+
redirect_prefix: str | Omit = omit,
|
|
1023
|
+
redirect_pool_id: str | Omit = omit,
|
|
1024
|
+
polling_interval_seconds: int | Omit = omit,
|
|
1025
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
1026
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1027
|
+
extra_headers: Headers | None = None,
|
|
1028
|
+
extra_query: Query | None = None,
|
|
1029
|
+
extra_body: Body | None = None,
|
|
1030
|
+
) -> LoadBalancerL7Policy:
|
|
1031
|
+
"""Replace L7 policy and poll for completion."""
|
|
1032
|
+
response: TaskIDList = self.replace( # type: ignore
|
|
1033
|
+
l7policy_id=l7policy_id,
|
|
1034
|
+
project_id=project_id,
|
|
1035
|
+
region_id=region_id,
|
|
1036
|
+
action=action,
|
|
1037
|
+
name=name,
|
|
1038
|
+
position=position,
|
|
1039
|
+
redirect_http_code=redirect_http_code,
|
|
1040
|
+
redirect_pool_id=redirect_pool_id,
|
|
1041
|
+
redirect_prefix=redirect_prefix,
|
|
1042
|
+
redirect_url=redirect_url,
|
|
1043
|
+
tags=tags,
|
|
1044
|
+
extra_headers=extra_headers,
|
|
1045
|
+
extra_query=extra_query,
|
|
1046
|
+
extra_body=extra_body,
|
|
1047
|
+
timeout=timeout,
|
|
1048
|
+
)
|
|
1049
|
+
if not response.tasks or len(response.tasks) != 1: # type: ignore[union-attr]
|
|
1050
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
1051
|
+
self._client.cloud.tasks.poll(
|
|
1052
|
+
task_id=response.tasks[0], # type: ignore[index]
|
|
1053
|
+
extra_headers=extra_headers,
|
|
1054
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1055
|
+
polling_timeout_seconds=polling_timeout_seconds,
|
|
1056
|
+
)
|
|
1057
|
+
return self.get(
|
|
1058
|
+
l7policy_id=l7policy_id,
|
|
1059
|
+
project_id=project_id,
|
|
1060
|
+
region_id=region_id,
|
|
1061
|
+
extra_headers=extra_headers,
|
|
1062
|
+
timeout=timeout,
|
|
1063
|
+
)
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
1067
|
+
@cached_property
|
|
1068
|
+
def rules(self) -> AsyncRulesResource:
|
|
1069
|
+
return AsyncRulesResource(self._client)
|
|
1070
|
+
|
|
1071
|
+
@cached_property
|
|
1072
|
+
def with_raw_response(self) -> AsyncL7PoliciesResourceWithRawResponse:
|
|
1073
|
+
"""
|
|
1074
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
1075
|
+
the raw response object instead of the parsed content.
|
|
1076
|
+
|
|
1077
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
1078
|
+
"""
|
|
1079
|
+
return AsyncL7PoliciesResourceWithRawResponse(self)
|
|
1080
|
+
|
|
1081
|
+
@cached_property
|
|
1082
|
+
def with_streaming_response(self) -> AsyncL7PoliciesResourceWithStreamingResponse:
|
|
1083
|
+
"""
|
|
1084
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
1085
|
+
|
|
1086
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
1087
|
+
"""
|
|
1088
|
+
return AsyncL7PoliciesResourceWithStreamingResponse(self)
|
|
1089
|
+
|
|
1090
|
+
@overload
|
|
1091
|
+
async def create(
|
|
1092
|
+
self,
|
|
1093
|
+
*,
|
|
1094
|
+
project_id: int | None = None,
|
|
1095
|
+
region_id: int | None = None,
|
|
1096
|
+
action: Literal["REDIRECT_TO_URL"],
|
|
1097
|
+
listener_id: str,
|
|
1098
|
+
redirect_url: str,
|
|
1099
|
+
name: str | Omit = omit,
|
|
1100
|
+
position: int | Omit = omit,
|
|
1101
|
+
redirect_http_code: int | Omit = omit,
|
|
1102
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1103
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1104
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1105
|
+
extra_headers: Headers | None = None,
|
|
1106
|
+
extra_query: Query | None = None,
|
|
1107
|
+
extra_body: Body | None = None,
|
|
1108
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1109
|
+
) -> TaskIDList:
|
|
1110
|
+
"""
|
|
1111
|
+
Create load balancer L7 policy
|
|
1112
|
+
|
|
1113
|
+
Args:
|
|
1114
|
+
project_id: Project ID
|
|
1115
|
+
|
|
1116
|
+
region_id: Region ID
|
|
1117
|
+
|
|
1118
|
+
action: Action
|
|
1119
|
+
|
|
1120
|
+
listener_id: Listener ID
|
|
1121
|
+
|
|
1122
|
+
redirect_url: Requests matching this policy will be redirected to this URL.
|
|
1123
|
+
|
|
1124
|
+
name: Human-readable name of the policy
|
|
1125
|
+
|
|
1126
|
+
position: The position of this policy on the listener
|
|
1127
|
+
|
|
1128
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
1129
|
+
URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308.
|
|
1130
|
+
Default is 302.
|
|
1131
|
+
|
|
1132
|
+
tags: A list of simple strings assigned to the resource.
|
|
1133
|
+
|
|
1134
|
+
extra_headers: Send extra headers
|
|
1135
|
+
|
|
1136
|
+
extra_query: Add additional query parameters to the request
|
|
1137
|
+
|
|
1138
|
+
extra_body: Add additional JSON properties to the request
|
|
1139
|
+
|
|
1140
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1141
|
+
"""
|
|
1142
|
+
...
|
|
1143
|
+
|
|
1144
|
+
@overload
|
|
1145
|
+
async def create(
|
|
1146
|
+
self,
|
|
1147
|
+
*,
|
|
1148
|
+
project_id: int | None = None,
|
|
1149
|
+
region_id: int | None = None,
|
|
1150
|
+
action: Literal["REDIRECT_PREFIX"],
|
|
1151
|
+
listener_id: str,
|
|
1152
|
+
redirect_prefix: str,
|
|
1153
|
+
name: str | Omit = omit,
|
|
1154
|
+
position: int | Omit = omit,
|
|
1155
|
+
redirect_http_code: int | Omit = omit,
|
|
1156
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1157
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1158
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1159
|
+
extra_headers: Headers | None = None,
|
|
1160
|
+
extra_query: Query | None = None,
|
|
1161
|
+
extra_body: Body | None = None,
|
|
1162
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1163
|
+
) -> TaskIDList:
|
|
1164
|
+
"""
|
|
1165
|
+
Create load balancer L7 policy
|
|
1166
|
+
|
|
1167
|
+
Args:
|
|
1168
|
+
project_id: Project ID
|
|
1169
|
+
|
|
1170
|
+
region_id: Region ID
|
|
1171
|
+
|
|
1172
|
+
action: Action
|
|
1173
|
+
|
|
1174
|
+
listener_id: Listener ID
|
|
1175
|
+
|
|
1176
|
+
redirect_prefix: Requests matching this policy will be redirected to this Prefix URL.
|
|
1177
|
+
|
|
1178
|
+
name: Human-readable name of the policy
|
|
1179
|
+
|
|
1180
|
+
position: The position of this policy on the listener
|
|
1181
|
+
|
|
1182
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
1183
|
+
URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308.
|
|
1184
|
+
Default is 302.
|
|
1185
|
+
|
|
1186
|
+
tags: A list of simple strings assigned to the resource.
|
|
1187
|
+
|
|
1188
|
+
extra_headers: Send extra headers
|
|
1189
|
+
|
|
1190
|
+
extra_query: Add additional query parameters to the request
|
|
1191
|
+
|
|
1192
|
+
extra_body: Add additional JSON properties to the request
|
|
1193
|
+
|
|
1194
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1195
|
+
"""
|
|
1196
|
+
...
|
|
1197
|
+
|
|
1198
|
+
@overload
|
|
1199
|
+
async def create(
|
|
1200
|
+
self,
|
|
1201
|
+
*,
|
|
1202
|
+
project_id: int | None = None,
|
|
1203
|
+
region_id: int | None = None,
|
|
1204
|
+
action: Literal["REDIRECT_TO_POOL"],
|
|
1205
|
+
listener_id: str,
|
|
1206
|
+
redirect_pool_id: str,
|
|
1207
|
+
name: str | Omit = omit,
|
|
1208
|
+
position: int | Omit = omit,
|
|
441
1209
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
442
|
-
polling_interval_seconds: int | Omit = omit,
|
|
443
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
444
1210
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
445
1211
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
446
1212
|
extra_headers: Headers | None = None,
|
|
447
1213
|
extra_query: Query | None = None,
|
|
448
1214
|
extra_body: Body | None = None,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
region_id=region_id,
|
|
454
|
-
action=action,
|
|
455
|
-
name=name,
|
|
456
|
-
position=position,
|
|
457
|
-
redirect_http_code=redirect_http_code,
|
|
458
|
-
redirect_pool_id=redirect_pool_id,
|
|
459
|
-
redirect_prefix=redirect_prefix,
|
|
460
|
-
redirect_url=redirect_url,
|
|
461
|
-
tags=tags,
|
|
462
|
-
extra_headers=extra_headers,
|
|
463
|
-
extra_query=extra_query,
|
|
464
|
-
extra_body=extra_body,
|
|
465
|
-
timeout=timeout,
|
|
466
|
-
)
|
|
467
|
-
if not response.tasks or len(response.tasks) != 1:
|
|
468
|
-
raise ValueError(f"Expected exactly one task to be created")
|
|
469
|
-
self._client.cloud.tasks.poll(
|
|
470
|
-
task_id=response.tasks[0],
|
|
471
|
-
extra_headers=extra_headers,
|
|
472
|
-
polling_interval_seconds=polling_interval_seconds,
|
|
473
|
-
)
|
|
474
|
-
return self.get(
|
|
475
|
-
l7policy_id=l7policy_id,
|
|
476
|
-
project_id=project_id,
|
|
477
|
-
region_id=region_id,
|
|
478
|
-
extra_headers=extra_headers,
|
|
479
|
-
timeout=timeout,
|
|
480
|
-
)
|
|
1215
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1216
|
+
) -> TaskIDList:
|
|
1217
|
+
"""
|
|
1218
|
+
Create load balancer L7 policy
|
|
481
1219
|
|
|
1220
|
+
Args:
|
|
1221
|
+
project_id: Project ID
|
|
482
1222
|
|
|
483
|
-
|
|
484
|
-
@cached_property
|
|
485
|
-
def rules(self) -> AsyncRulesResource:
|
|
486
|
-
return AsyncRulesResource(self._client)
|
|
1223
|
+
region_id: Region ID
|
|
487
1224
|
|
|
488
|
-
|
|
489
|
-
def with_raw_response(self) -> AsyncL7PoliciesResourceWithRawResponse:
|
|
490
|
-
"""
|
|
491
|
-
This property can be used as a prefix for any HTTP method call to return
|
|
492
|
-
the raw response object instead of the parsed content.
|
|
1225
|
+
action: Action
|
|
493
1226
|
|
|
494
|
-
|
|
495
|
-
"""
|
|
496
|
-
return AsyncL7PoliciesResourceWithRawResponse(self)
|
|
1227
|
+
listener_id: Listener ID
|
|
497
1228
|
|
|
498
|
-
|
|
499
|
-
def with_streaming_response(self) -> AsyncL7PoliciesResourceWithStreamingResponse:
|
|
500
|
-
"""
|
|
501
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
1229
|
+
redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID.
|
|
502
1230
|
|
|
503
|
-
|
|
1231
|
+
name: Human-readable name of the policy
|
|
1232
|
+
|
|
1233
|
+
position: The position of this policy on the listener
|
|
1234
|
+
|
|
1235
|
+
tags: A list of simple strings assigned to the resource.
|
|
1236
|
+
|
|
1237
|
+
extra_headers: Send extra headers
|
|
1238
|
+
|
|
1239
|
+
extra_query: Add additional query parameters to the request
|
|
1240
|
+
|
|
1241
|
+
extra_body: Add additional JSON properties to the request
|
|
1242
|
+
|
|
1243
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
504
1244
|
"""
|
|
505
|
-
|
|
1245
|
+
...
|
|
506
1246
|
|
|
1247
|
+
@overload
|
|
507
1248
|
async def create(
|
|
508
1249
|
self,
|
|
509
1250
|
*,
|
|
510
1251
|
project_id: int | None = None,
|
|
511
1252
|
region_id: int | None = None,
|
|
512
|
-
action: Literal["
|
|
1253
|
+
action: Literal["REJECT"],
|
|
513
1254
|
listener_id: str,
|
|
514
1255
|
name: str | Omit = omit,
|
|
515
1256
|
position: int | Omit = omit,
|
|
516
|
-
redirect_http_code: int | Omit = omit,
|
|
517
|
-
redirect_pool_id: str | Omit = omit,
|
|
518
|
-
redirect_prefix: str | Omit = omit,
|
|
519
|
-
redirect_url: str | Omit = omit,
|
|
520
1257
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
521
1258
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
522
1259
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -529,26 +1266,17 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
529
1266
|
Create load balancer L7 policy
|
|
530
1267
|
|
|
531
1268
|
Args:
|
|
1269
|
+
project_id: Project ID
|
|
1270
|
+
|
|
1271
|
+
region_id: Region ID
|
|
1272
|
+
|
|
532
1273
|
action: Action
|
|
533
1274
|
|
|
534
1275
|
listener_id: Listener ID
|
|
535
1276
|
|
|
536
1277
|
name: Human-readable name of the policy
|
|
537
1278
|
|
|
538
|
-
position: The position of this policy on the listener
|
|
539
|
-
|
|
540
|
-
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
541
|
-
URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or
|
|
542
|
-
`REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302.
|
|
543
|
-
|
|
544
|
-
redirect_pool_id: Requests matching this policy will be redirected to the pool withthis ID. Only
|
|
545
|
-
valid if action is `REDIRECT_TO_POOL`.
|
|
546
|
-
|
|
547
|
-
redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid
|
|
548
|
-
if action is `REDIRECT_PREFIX`.
|
|
549
|
-
|
|
550
|
-
redirect_url: Requests matching this policy will be redirected to this URL. Only valid if
|
|
551
|
-
action is `REDIRECT_TO_URL`.
|
|
1279
|
+
position: The position of this policy on the listener
|
|
552
1280
|
|
|
553
1281
|
tags: A list of simple strings assigned to the resource.
|
|
554
1282
|
|
|
@@ -560,6 +1288,38 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
560
1288
|
|
|
561
1289
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
562
1290
|
"""
|
|
1291
|
+
...
|
|
1292
|
+
|
|
1293
|
+
@required_args(
|
|
1294
|
+
["action", "listener_id", "redirect_url"],
|
|
1295
|
+
["action", "listener_id", "redirect_prefix"],
|
|
1296
|
+
["action", "listener_id", "redirect_pool_id"],
|
|
1297
|
+
["action", "listener_id"],
|
|
1298
|
+
)
|
|
1299
|
+
async def create(
|
|
1300
|
+
self,
|
|
1301
|
+
*,
|
|
1302
|
+
project_id: int | None = None,
|
|
1303
|
+
region_id: int | None = None,
|
|
1304
|
+
action: Literal["REDIRECT_TO_URL"]
|
|
1305
|
+
| Literal["REDIRECT_PREFIX"]
|
|
1306
|
+
| Literal["REDIRECT_TO_POOL"]
|
|
1307
|
+
| Literal["REJECT"],
|
|
1308
|
+
listener_id: str,
|
|
1309
|
+
redirect_url: str | Omit = omit,
|
|
1310
|
+
name: str | Omit = omit,
|
|
1311
|
+
position: int | Omit = omit,
|
|
1312
|
+
redirect_http_code: int | Omit = omit,
|
|
1313
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1314
|
+
redirect_prefix: str | Omit = omit,
|
|
1315
|
+
redirect_pool_id: str | Omit = omit,
|
|
1316
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1317
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1318
|
+
extra_headers: Headers | None = None,
|
|
1319
|
+
extra_query: Query | None = None,
|
|
1320
|
+
extra_body: Body | None = None,
|
|
1321
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1322
|
+
) -> TaskIDList:
|
|
563
1323
|
if project_id is None:
|
|
564
1324
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
565
1325
|
if region_id is None:
|
|
@@ -570,13 +1330,13 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
570
1330
|
{
|
|
571
1331
|
"action": action,
|
|
572
1332
|
"listener_id": listener_id,
|
|
1333
|
+
"redirect_url": redirect_url,
|
|
573
1334
|
"name": name,
|
|
574
1335
|
"position": position,
|
|
575
1336
|
"redirect_http_code": redirect_http_code,
|
|
576
|
-
"redirect_pool_id": redirect_pool_id,
|
|
577
|
-
"redirect_prefix": redirect_prefix,
|
|
578
|
-
"redirect_url": redirect_url,
|
|
579
1337
|
"tags": tags,
|
|
1338
|
+
"redirect_prefix": redirect_prefix,
|
|
1339
|
+
"redirect_pool_id": redirect_pool_id,
|
|
580
1340
|
},
|
|
581
1341
|
l7_policy_create_params.L7PolicyCreateParams,
|
|
582
1342
|
),
|
|
@@ -602,6 +1362,10 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
602
1362
|
List load balancer L7 policies
|
|
603
1363
|
|
|
604
1364
|
Args:
|
|
1365
|
+
project_id: Project ID
|
|
1366
|
+
|
|
1367
|
+
region_id: Region ID
|
|
1368
|
+
|
|
605
1369
|
extra_headers: Send extra headers
|
|
606
1370
|
|
|
607
1371
|
extra_query: Add additional query parameters to the request
|
|
@@ -638,7 +1402,187 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
638
1402
|
"""
|
|
639
1403
|
Delete load balancer L7 policy
|
|
640
1404
|
|
|
641
|
-
Args:
|
|
1405
|
+
Args:
|
|
1406
|
+
project_id: Project ID
|
|
1407
|
+
|
|
1408
|
+
region_id: Region ID
|
|
1409
|
+
|
|
1410
|
+
l7policy_id: L7 policy ID
|
|
1411
|
+
|
|
1412
|
+
extra_headers: Send extra headers
|
|
1413
|
+
|
|
1414
|
+
extra_query: Add additional query parameters to the request
|
|
1415
|
+
|
|
1416
|
+
extra_body: Add additional JSON properties to the request
|
|
1417
|
+
|
|
1418
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1419
|
+
"""
|
|
1420
|
+
if project_id is None:
|
|
1421
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
1422
|
+
if region_id is None:
|
|
1423
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
1424
|
+
if not l7policy_id:
|
|
1425
|
+
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
1426
|
+
return await self._delete(
|
|
1427
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
1428
|
+
options=make_request_options(
|
|
1429
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1430
|
+
),
|
|
1431
|
+
cast_to=TaskIDList,
|
|
1432
|
+
)
|
|
1433
|
+
|
|
1434
|
+
async def get(
|
|
1435
|
+
self,
|
|
1436
|
+
l7policy_id: str,
|
|
1437
|
+
*,
|
|
1438
|
+
project_id: int | None = None,
|
|
1439
|
+
region_id: int | None = None,
|
|
1440
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1441
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1442
|
+
extra_headers: Headers | None = None,
|
|
1443
|
+
extra_query: Query | None = None,
|
|
1444
|
+
extra_body: Body | None = None,
|
|
1445
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1446
|
+
) -> LoadBalancerL7Policy:
|
|
1447
|
+
"""
|
|
1448
|
+
Get load balancer L7 policy
|
|
1449
|
+
|
|
1450
|
+
Args:
|
|
1451
|
+
project_id: Project ID
|
|
1452
|
+
|
|
1453
|
+
region_id: Region ID
|
|
1454
|
+
|
|
1455
|
+
l7policy_id: L7 policy ID
|
|
1456
|
+
|
|
1457
|
+
extra_headers: Send extra headers
|
|
1458
|
+
|
|
1459
|
+
extra_query: Add additional query parameters to the request
|
|
1460
|
+
|
|
1461
|
+
extra_body: Add additional JSON properties to the request
|
|
1462
|
+
|
|
1463
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1464
|
+
"""
|
|
1465
|
+
if project_id is None:
|
|
1466
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
1467
|
+
if region_id is None:
|
|
1468
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
1469
|
+
if not l7policy_id:
|
|
1470
|
+
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
1471
|
+
return await self._get(
|
|
1472
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
1473
|
+
options=make_request_options(
|
|
1474
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1475
|
+
),
|
|
1476
|
+
cast_to=LoadBalancerL7Policy,
|
|
1477
|
+
)
|
|
1478
|
+
|
|
1479
|
+
@overload
|
|
1480
|
+
async def replace(
|
|
1481
|
+
self,
|
|
1482
|
+
l7policy_id: str,
|
|
1483
|
+
*,
|
|
1484
|
+
project_id: int | None = None,
|
|
1485
|
+
region_id: int | None = None,
|
|
1486
|
+
action: Literal["REDIRECT_TO_URL"],
|
|
1487
|
+
redirect_url: str,
|
|
1488
|
+
name: str | Omit = omit,
|
|
1489
|
+
position: int | Omit = omit,
|
|
1490
|
+
redirect_http_code: int | Omit = omit,
|
|
1491
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1492
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1493
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1494
|
+
extra_headers: Headers | None = None,
|
|
1495
|
+
extra_query: Query | None = None,
|
|
1496
|
+
extra_body: Body | None = None,
|
|
1497
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1498
|
+
) -> TaskIDList:
|
|
1499
|
+
"""Replaces the entire L7 policy configuration with the provided data.
|
|
1500
|
+
|
|
1501
|
+
Any fields
|
|
1502
|
+
omitted from the request body will be unset (set to null) or reset to their
|
|
1503
|
+
default values (such as "`redirect_http_code`") depending on the "action". This
|
|
1504
|
+
is a destructive operation that overwrites the complete policy configuration.
|
|
1505
|
+
|
|
1506
|
+
Args:
|
|
1507
|
+
project_id: Project ID
|
|
1508
|
+
|
|
1509
|
+
region_id: Region ID
|
|
1510
|
+
|
|
1511
|
+
l7policy_id: L7 policy ID
|
|
1512
|
+
|
|
1513
|
+
action: Action
|
|
1514
|
+
|
|
1515
|
+
redirect_url: Requests matching this policy will be redirected to this URL. Only valid if
|
|
1516
|
+
action is `REDIRECT_TO_URL`.
|
|
1517
|
+
|
|
1518
|
+
name: Human-readable name of the policy
|
|
1519
|
+
|
|
1520
|
+
position: The position of this policy on the listener
|
|
1521
|
+
|
|
1522
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
1523
|
+
URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or
|
|
1524
|
+
`REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302.
|
|
1525
|
+
|
|
1526
|
+
tags: A list of simple strings assigned to the resource.
|
|
1527
|
+
|
|
1528
|
+
extra_headers: Send extra headers
|
|
1529
|
+
|
|
1530
|
+
extra_query: Add additional query parameters to the request
|
|
1531
|
+
|
|
1532
|
+
extra_body: Add additional JSON properties to the request
|
|
1533
|
+
|
|
1534
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1535
|
+
"""
|
|
1536
|
+
...
|
|
1537
|
+
|
|
1538
|
+
@overload
|
|
1539
|
+
async def replace(
|
|
1540
|
+
self,
|
|
1541
|
+
l7policy_id: str,
|
|
1542
|
+
*,
|
|
1543
|
+
project_id: int | None = None,
|
|
1544
|
+
region_id: int | None = None,
|
|
1545
|
+
action: Literal["REDIRECT_PREFIX"],
|
|
1546
|
+
redirect_prefix: str,
|
|
1547
|
+
name: str | Omit = omit,
|
|
1548
|
+
position: int | Omit = omit,
|
|
1549
|
+
redirect_http_code: int | Omit = omit,
|
|
1550
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1551
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1552
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1553
|
+
extra_headers: Headers | None = None,
|
|
1554
|
+
extra_query: Query | None = None,
|
|
1555
|
+
extra_body: Body | None = None,
|
|
1556
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1557
|
+
) -> TaskIDList:
|
|
1558
|
+
"""Replaces the entire L7 policy configuration with the provided data.
|
|
1559
|
+
|
|
1560
|
+
Any fields
|
|
1561
|
+
omitted from the request body will be unset (set to null) or reset to their
|
|
1562
|
+
default values (such as "`redirect_http_code`") depending on the "action". This
|
|
1563
|
+
is a destructive operation that overwrites the complete policy configuration.
|
|
1564
|
+
|
|
1565
|
+
Args:
|
|
1566
|
+
project_id: Project ID
|
|
1567
|
+
|
|
1568
|
+
region_id: Region ID
|
|
1569
|
+
|
|
1570
|
+
l7policy_id: L7 policy ID
|
|
1571
|
+
|
|
1572
|
+
action: Action
|
|
1573
|
+
|
|
1574
|
+
redirect_prefix: Requests matching this policy will be redirected to this Prefix URL.
|
|
1575
|
+
|
|
1576
|
+
name: Human-readable name of the policy
|
|
1577
|
+
|
|
1578
|
+
position: The position of this policy on the listener
|
|
1579
|
+
|
|
1580
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
1581
|
+
URL with the HTTP response code. Valid options are 301, 302, 303, 307, or 308.
|
|
1582
|
+
Default is 302.
|
|
1583
|
+
|
|
1584
|
+
tags: A list of simple strings assigned to the resource.
|
|
1585
|
+
|
|
642
1586
|
extra_headers: Send extra headers
|
|
643
1587
|
|
|
644
1588
|
extra_query: Add additional query parameters to the request
|
|
@@ -647,37 +1591,51 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
647
1591
|
|
|
648
1592
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
649
1593
|
"""
|
|
650
|
-
|
|
651
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
652
|
-
if region_id is None:
|
|
653
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
654
|
-
if not l7policy_id:
|
|
655
|
-
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
656
|
-
return await self._delete(
|
|
657
|
-
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
658
|
-
options=make_request_options(
|
|
659
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
660
|
-
),
|
|
661
|
-
cast_to=TaskIDList,
|
|
662
|
-
)
|
|
1594
|
+
...
|
|
663
1595
|
|
|
664
|
-
|
|
1596
|
+
@overload
|
|
1597
|
+
async def replace(
|
|
665
1598
|
self,
|
|
666
1599
|
l7policy_id: str,
|
|
667
1600
|
*,
|
|
668
1601
|
project_id: int | None = None,
|
|
669
1602
|
region_id: int | None = None,
|
|
1603
|
+
action: Literal["REDIRECT_TO_POOL"],
|
|
1604
|
+
redirect_pool_id: str,
|
|
1605
|
+
name: str | Omit = omit,
|
|
1606
|
+
position: int | Omit = omit,
|
|
1607
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
670
1608
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
671
1609
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
672
1610
|
extra_headers: Headers | None = None,
|
|
673
1611
|
extra_query: Query | None = None,
|
|
674
1612
|
extra_body: Body | None = None,
|
|
675
1613
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
676
|
-
) ->
|
|
677
|
-
"""
|
|
678
|
-
|
|
1614
|
+
) -> TaskIDList:
|
|
1615
|
+
"""Replaces the entire L7 policy configuration with the provided data.
|
|
1616
|
+
|
|
1617
|
+
Any fields
|
|
1618
|
+
omitted from the request body will be unset (set to null) or reset to their
|
|
1619
|
+
default values (such as "`redirect_http_code`") depending on the "action". This
|
|
1620
|
+
is a destructive operation that overwrites the complete policy configuration.
|
|
679
1621
|
|
|
680
1622
|
Args:
|
|
1623
|
+
project_id: Project ID
|
|
1624
|
+
|
|
1625
|
+
region_id: Region ID
|
|
1626
|
+
|
|
1627
|
+
l7policy_id: L7 policy ID
|
|
1628
|
+
|
|
1629
|
+
action: Action
|
|
1630
|
+
|
|
1631
|
+
redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID.
|
|
1632
|
+
|
|
1633
|
+
name: Human-readable name of the policy
|
|
1634
|
+
|
|
1635
|
+
position: The position of this policy on the listener
|
|
1636
|
+
|
|
1637
|
+
tags: A list of simple strings assigned to the resource.
|
|
1638
|
+
|
|
681
1639
|
extra_headers: Send extra headers
|
|
682
1640
|
|
|
683
1641
|
extra_query: Add additional query parameters to the request
|
|
@@ -686,33 +1644,18 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
686
1644
|
|
|
687
1645
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
688
1646
|
"""
|
|
689
|
-
|
|
690
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
691
|
-
if region_id is None:
|
|
692
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
693
|
-
if not l7policy_id:
|
|
694
|
-
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
695
|
-
return await self._get(
|
|
696
|
-
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
697
|
-
options=make_request_options(
|
|
698
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
699
|
-
),
|
|
700
|
-
cast_to=LoadBalancerL7Policy,
|
|
701
|
-
)
|
|
1647
|
+
...
|
|
702
1648
|
|
|
1649
|
+
@overload
|
|
703
1650
|
async def replace(
|
|
704
1651
|
self,
|
|
705
1652
|
l7policy_id: str,
|
|
706
1653
|
*,
|
|
707
1654
|
project_id: int | None = None,
|
|
708
1655
|
region_id: int | None = None,
|
|
709
|
-
action: Literal["
|
|
1656
|
+
action: Literal["REJECT"],
|
|
710
1657
|
name: str | Omit = omit,
|
|
711
1658
|
position: int | Omit = omit,
|
|
712
|
-
redirect_http_code: int | Omit = omit,
|
|
713
|
-
redirect_pool_id: str | Omit = omit,
|
|
714
|
-
redirect_prefix: str | Omit = omit,
|
|
715
|
-
redirect_url: str | Omit = omit,
|
|
716
1659
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
717
1660
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
718
1661
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -721,28 +1664,25 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
721
1664
|
extra_body: Body | None = None,
|
|
722
1665
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
723
1666
|
) -> TaskIDList:
|
|
724
|
-
"""
|
|
725
|
-
Replace load balancer L7 policy
|
|
1667
|
+
"""Replaces the entire L7 policy configuration with the provided data.
|
|
726
1668
|
|
|
727
|
-
|
|
728
|
-
|
|
1669
|
+
Any fields
|
|
1670
|
+
omitted from the request body will be unset (set to null) or reset to their
|
|
1671
|
+
default values (such as "`redirect_http_code`") depending on the "action". This
|
|
1672
|
+
is a destructive operation that overwrites the complete policy configuration.
|
|
729
1673
|
|
|
730
|
-
|
|
1674
|
+
Args:
|
|
1675
|
+
project_id: Project ID
|
|
731
1676
|
|
|
732
|
-
|
|
1677
|
+
region_id: Region ID
|
|
733
1678
|
|
|
734
|
-
|
|
735
|
-
URL with the HTTP response code. Valid if action is `REDIRECT_TO_URL` or
|
|
736
|
-
`REDIRECT_PREFIX`. Valid options are 301, 302, 303, 307, or 308. Default is 302.
|
|
1679
|
+
l7policy_id: L7 policy ID
|
|
737
1680
|
|
|
738
|
-
|
|
739
|
-
valid if action is `REDIRECT_TO_POOL`.
|
|
1681
|
+
action: Action
|
|
740
1682
|
|
|
741
|
-
|
|
742
|
-
if action is `REDIRECT_PREFIX`.
|
|
1683
|
+
name: Human-readable name of the policy
|
|
743
1684
|
|
|
744
|
-
|
|
745
|
-
action is `REDIRECT_TO_URL`.
|
|
1685
|
+
position: The position of this policy on the listener
|
|
746
1686
|
|
|
747
1687
|
tags: A list of simple strings assigned to the resource.
|
|
748
1688
|
|
|
@@ -754,6 +1694,35 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
754
1694
|
|
|
755
1695
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
756
1696
|
"""
|
|
1697
|
+
...
|
|
1698
|
+
|
|
1699
|
+
@required_args(
|
|
1700
|
+
["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"]
|
|
1701
|
+
)
|
|
1702
|
+
async def replace(
|
|
1703
|
+
self,
|
|
1704
|
+
l7policy_id: str,
|
|
1705
|
+
*,
|
|
1706
|
+
project_id: int | None = None,
|
|
1707
|
+
region_id: int | None = None,
|
|
1708
|
+
action: Literal["REDIRECT_TO_URL"]
|
|
1709
|
+
| Literal["REDIRECT_PREFIX"]
|
|
1710
|
+
| Literal["REDIRECT_TO_POOL"]
|
|
1711
|
+
| Literal["REJECT"],
|
|
1712
|
+
redirect_url: str | Omit = omit,
|
|
1713
|
+
name: str | Omit = omit,
|
|
1714
|
+
position: int | Omit = omit,
|
|
1715
|
+
redirect_http_code: int | Omit = omit,
|
|
1716
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1717
|
+
redirect_prefix: str | Omit = omit,
|
|
1718
|
+
redirect_pool_id: str | Omit = omit,
|
|
1719
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1720
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1721
|
+
extra_headers: Headers | None = None,
|
|
1722
|
+
extra_query: Query | None = None,
|
|
1723
|
+
extra_body: Body | None = None,
|
|
1724
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1725
|
+
) -> TaskIDList:
|
|
757
1726
|
if project_id is None:
|
|
758
1727
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
759
1728
|
if region_id is None:
|
|
@@ -765,13 +1734,13 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
765
1734
|
body=await async_maybe_transform(
|
|
766
1735
|
{
|
|
767
1736
|
"action": action,
|
|
1737
|
+
"redirect_url": redirect_url,
|
|
768
1738
|
"name": name,
|
|
769
1739
|
"position": position,
|
|
770
1740
|
"redirect_http_code": redirect_http_code,
|
|
771
|
-
"redirect_pool_id": redirect_pool_id,
|
|
772
|
-
"redirect_prefix": redirect_prefix,
|
|
773
|
-
"redirect_url": redirect_url,
|
|
774
1741
|
"tags": tags,
|
|
1742
|
+
"redirect_prefix": redirect_prefix,
|
|
1743
|
+
"redirect_pool_id": redirect_pool_id,
|
|
775
1744
|
},
|
|
776
1745
|
l7_policy_replace_params.L7PolicyReplaceParams,
|
|
777
1746
|
),
|
|
@@ -781,29 +1750,127 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
781
1750
|
cast_to=TaskIDList,
|
|
782
1751
|
)
|
|
783
1752
|
|
|
1753
|
+
@overload
|
|
784
1754
|
async def create_and_poll(
|
|
785
1755
|
self,
|
|
786
1756
|
*,
|
|
787
1757
|
project_id: int | None = None,
|
|
788
1758
|
region_id: int | None = None,
|
|
789
|
-
action: Literal["
|
|
1759
|
+
action: Literal["REDIRECT_TO_URL"],
|
|
790
1760
|
listener_id: str,
|
|
1761
|
+
redirect_url: str,
|
|
791
1762
|
name: str | Omit = omit,
|
|
792
1763
|
position: int | Omit = omit,
|
|
793
1764
|
redirect_http_code: int | Omit = omit,
|
|
794
|
-
|
|
795
|
-
|
|
1765
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1766
|
+
polling_interval_seconds: int | Omit = omit,
|
|
1767
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
1768
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1769
|
+
extra_headers: Headers | None = None,
|
|
1770
|
+
extra_query: Query | None = None,
|
|
1771
|
+
extra_body: Body | None = None,
|
|
1772
|
+
) -> LoadBalancerL7Policy:
|
|
1773
|
+
"""Create L7 policy and poll for completion."""
|
|
1774
|
+
...
|
|
1775
|
+
|
|
1776
|
+
@overload
|
|
1777
|
+
async def create_and_poll(
|
|
1778
|
+
self,
|
|
1779
|
+
*,
|
|
1780
|
+
project_id: int | None = None,
|
|
1781
|
+
region_id: int | None = None,
|
|
1782
|
+
action: Literal["REDIRECT_PREFIX"],
|
|
1783
|
+
listener_id: str,
|
|
1784
|
+
redirect_prefix: str,
|
|
1785
|
+
name: str | Omit = omit,
|
|
1786
|
+
position: int | Omit = omit,
|
|
1787
|
+
redirect_http_code: int | Omit = omit,
|
|
1788
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1789
|
+
polling_interval_seconds: int | Omit = omit,
|
|
1790
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
1791
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1792
|
+
extra_headers: Headers | None = None,
|
|
1793
|
+
extra_query: Query | None = None,
|
|
1794
|
+
extra_body: Body | None = None,
|
|
1795
|
+
) -> LoadBalancerL7Policy:
|
|
1796
|
+
"""Create L7 policy and poll for completion."""
|
|
1797
|
+
...
|
|
1798
|
+
|
|
1799
|
+
@overload
|
|
1800
|
+
async def create_and_poll(
|
|
1801
|
+
self,
|
|
1802
|
+
*,
|
|
1803
|
+
project_id: int | None = None,
|
|
1804
|
+
region_id: int | None = None,
|
|
1805
|
+
action: Literal["REDIRECT_TO_POOL"],
|
|
1806
|
+
listener_id: str,
|
|
1807
|
+
redirect_pool_id: str,
|
|
1808
|
+
name: str | Omit = omit,
|
|
1809
|
+
position: int | Omit = omit,
|
|
1810
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1811
|
+
polling_interval_seconds: int | Omit = omit,
|
|
1812
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
1813
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1814
|
+
extra_headers: Headers | None = None,
|
|
1815
|
+
extra_query: Query | None = None,
|
|
1816
|
+
extra_body: Body | None = None,
|
|
1817
|
+
) -> LoadBalancerL7Policy:
|
|
1818
|
+
"""Create L7 policy and poll for completion."""
|
|
1819
|
+
...
|
|
1820
|
+
|
|
1821
|
+
@overload
|
|
1822
|
+
async def create_and_poll(
|
|
1823
|
+
self,
|
|
1824
|
+
*,
|
|
1825
|
+
project_id: int | None = None,
|
|
1826
|
+
region_id: int | None = None,
|
|
1827
|
+
action: Literal["REJECT"],
|
|
1828
|
+
listener_id: str,
|
|
1829
|
+
name: str | Omit = omit,
|
|
1830
|
+
position: int | Omit = omit,
|
|
1831
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1832
|
+
polling_interval_seconds: int | Omit = omit,
|
|
1833
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
1834
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1835
|
+
extra_headers: Headers | None = None,
|
|
1836
|
+
extra_query: Query | None = None,
|
|
1837
|
+
extra_body: Body | None = None,
|
|
1838
|
+
) -> LoadBalancerL7Policy:
|
|
1839
|
+
"""Create L7 policy and poll for completion."""
|
|
1840
|
+
...
|
|
1841
|
+
|
|
1842
|
+
@required_args(
|
|
1843
|
+
["action", "listener_id", "redirect_url"],
|
|
1844
|
+
["action", "listener_id", "redirect_prefix"],
|
|
1845
|
+
["action", "listener_id", "redirect_pool_id"],
|
|
1846
|
+
["action", "listener_id"],
|
|
1847
|
+
)
|
|
1848
|
+
async def create_and_poll(
|
|
1849
|
+
self,
|
|
1850
|
+
*,
|
|
1851
|
+
project_id: int | None = None,
|
|
1852
|
+
region_id: int | None = None,
|
|
1853
|
+
action: Literal["REDIRECT_TO_URL"]
|
|
1854
|
+
| Literal["REDIRECT_PREFIX"]
|
|
1855
|
+
| Literal["REDIRECT_TO_POOL"]
|
|
1856
|
+
| Literal["REJECT"],
|
|
1857
|
+
listener_id: str,
|
|
796
1858
|
redirect_url: str | Omit = omit,
|
|
1859
|
+
name: str | Omit = omit,
|
|
1860
|
+
position: int | Omit = omit,
|
|
1861
|
+
redirect_http_code: int | Omit = omit,
|
|
797
1862
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
1863
|
+
redirect_prefix: str | Omit = omit,
|
|
1864
|
+
redirect_pool_id: str | Omit = omit,
|
|
798
1865
|
polling_interval_seconds: int | Omit = omit,
|
|
1866
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
799
1867
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
800
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
801
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
802
1868
|
extra_headers: Headers | None = None,
|
|
803
1869
|
extra_query: Query | None = None,
|
|
804
1870
|
extra_body: Body | None = None,
|
|
805
1871
|
) -> LoadBalancerL7Policy:
|
|
806
|
-
|
|
1872
|
+
"""Create L7 policy and poll for completion."""
|
|
1873
|
+
response: TaskIDList = await self.create( # type: ignore
|
|
807
1874
|
project_id=project_id,
|
|
808
1875
|
region_id=region_id,
|
|
809
1876
|
action=action,
|
|
@@ -820,12 +1887,13 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
820
1887
|
extra_body=extra_body,
|
|
821
1888
|
timeout=timeout,
|
|
822
1889
|
)
|
|
823
|
-
if not response.tasks or len(response.tasks) != 1:
|
|
1890
|
+
if not response.tasks or len(response.tasks) != 1: # type: ignore[union-attr]
|
|
824
1891
|
raise ValueError(f"Expected exactly one task to be created")
|
|
825
1892
|
task = await self._client.cloud.tasks.poll(
|
|
826
|
-
task_id=response.tasks[0],
|
|
1893
|
+
task_id=response.tasks[0], # type: ignore[index]
|
|
827
1894
|
extra_headers=extra_headers,
|
|
828
1895
|
polling_interval_seconds=polling_interval_seconds,
|
|
1896
|
+
polling_timeout_seconds=polling_timeout_seconds,
|
|
829
1897
|
)
|
|
830
1898
|
if (
|
|
831
1899
|
not task.created_resources
|
|
@@ -848,6 +1916,7 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
848
1916
|
project_id: int | None = None,
|
|
849
1917
|
region_id: int | None = None,
|
|
850
1918
|
polling_interval_seconds: int | Omit = omit,
|
|
1919
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
851
1920
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
852
1921
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
853
1922
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -870,31 +1939,127 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
870
1939
|
task_id=response.tasks[0],
|
|
871
1940
|
extra_headers=extra_headers,
|
|
872
1941
|
polling_interval_seconds=polling_interval_seconds,
|
|
1942
|
+
polling_timeout_seconds=polling_timeout_seconds,
|
|
873
1943
|
)
|
|
874
1944
|
|
|
1945
|
+
@overload
|
|
875
1946
|
async def replace_and_poll(
|
|
876
1947
|
self,
|
|
877
1948
|
l7policy_id: str,
|
|
878
1949
|
*,
|
|
879
1950
|
project_id: int | None = None,
|
|
880
1951
|
region_id: int | None = None,
|
|
881
|
-
action: Literal["
|
|
1952
|
+
action: Literal["REDIRECT_TO_URL"],
|
|
1953
|
+
redirect_url: str,
|
|
882
1954
|
name: str | Omit = omit,
|
|
883
1955
|
position: int | Omit = omit,
|
|
884
1956
|
redirect_http_code: int | Omit = omit,
|
|
885
|
-
|
|
886
|
-
|
|
1957
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1958
|
+
polling_interval_seconds: int | Omit = omit,
|
|
1959
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
1960
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1961
|
+
extra_headers: Headers | None = None,
|
|
1962
|
+
extra_query: Query | None = None,
|
|
1963
|
+
extra_body: Body | None = None,
|
|
1964
|
+
) -> LoadBalancerL7Policy:
|
|
1965
|
+
"""Replace L7 policy and poll for completion."""
|
|
1966
|
+
...
|
|
1967
|
+
|
|
1968
|
+
@overload
|
|
1969
|
+
async def replace_and_poll(
|
|
1970
|
+
self,
|
|
1971
|
+
l7policy_id: str,
|
|
1972
|
+
*,
|
|
1973
|
+
project_id: int | None = None,
|
|
1974
|
+
region_id: int | None = None,
|
|
1975
|
+
action: Literal["REDIRECT_PREFIX"],
|
|
1976
|
+
redirect_prefix: str,
|
|
1977
|
+
name: str | Omit = omit,
|
|
1978
|
+
position: int | Omit = omit,
|
|
1979
|
+
redirect_http_code: int | Omit = omit,
|
|
1980
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
1981
|
+
polling_interval_seconds: int | Omit = omit,
|
|
1982
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
1983
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1984
|
+
extra_headers: Headers | None = None,
|
|
1985
|
+
extra_query: Query | None = None,
|
|
1986
|
+
extra_body: Body | None = None,
|
|
1987
|
+
) -> LoadBalancerL7Policy:
|
|
1988
|
+
"""Replace L7 policy and poll for completion."""
|
|
1989
|
+
...
|
|
1990
|
+
|
|
1991
|
+
@overload
|
|
1992
|
+
async def replace_and_poll(
|
|
1993
|
+
self,
|
|
1994
|
+
l7policy_id: str,
|
|
1995
|
+
*,
|
|
1996
|
+
project_id: int | None = None,
|
|
1997
|
+
region_id: int | None = None,
|
|
1998
|
+
action: Literal["REDIRECT_TO_POOL"],
|
|
1999
|
+
redirect_pool_id: str,
|
|
2000
|
+
name: str | Omit = omit,
|
|
2001
|
+
position: int | Omit = omit,
|
|
2002
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
2003
|
+
polling_interval_seconds: int | Omit = omit,
|
|
2004
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
2005
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2006
|
+
extra_headers: Headers | None = None,
|
|
2007
|
+
extra_query: Query | None = None,
|
|
2008
|
+
extra_body: Body | None = None,
|
|
2009
|
+
) -> LoadBalancerL7Policy:
|
|
2010
|
+
"""Replace L7 policy and poll for completion."""
|
|
2011
|
+
...
|
|
2012
|
+
|
|
2013
|
+
@overload
|
|
2014
|
+
async def replace_and_poll(
|
|
2015
|
+
self,
|
|
2016
|
+
l7policy_id: str,
|
|
2017
|
+
*,
|
|
2018
|
+
project_id: int | None = None,
|
|
2019
|
+
region_id: int | None = None,
|
|
2020
|
+
action: Literal["REJECT"],
|
|
2021
|
+
name: str | Omit = omit,
|
|
2022
|
+
position: int | Omit = omit,
|
|
2023
|
+
tags: SequenceNotStr[str] | Omit = omit,
|
|
2024
|
+
polling_interval_seconds: int | Omit = omit,
|
|
2025
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
2026
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
2027
|
+
extra_headers: Headers | None = None,
|
|
2028
|
+
extra_query: Query | None = None,
|
|
2029
|
+
extra_body: Body | None = None,
|
|
2030
|
+
) -> LoadBalancerL7Policy:
|
|
2031
|
+
"""Replace L7 policy and poll for completion."""
|
|
2032
|
+
...
|
|
2033
|
+
|
|
2034
|
+
@required_args(
|
|
2035
|
+
["action", "redirect_url"], ["action", "redirect_prefix"], ["action", "redirect_pool_id"], ["action"]
|
|
2036
|
+
)
|
|
2037
|
+
async def replace_and_poll(
|
|
2038
|
+
self,
|
|
2039
|
+
l7policy_id: str,
|
|
2040
|
+
*,
|
|
2041
|
+
project_id: int | None = None,
|
|
2042
|
+
region_id: int | None = None,
|
|
2043
|
+
action: Literal["REDIRECT_TO_URL"]
|
|
2044
|
+
| Literal["REDIRECT_PREFIX"]
|
|
2045
|
+
| Literal["REDIRECT_TO_POOL"]
|
|
2046
|
+
| Literal["REJECT"],
|
|
887
2047
|
redirect_url: str | Omit = omit,
|
|
2048
|
+
name: str | Omit = omit,
|
|
2049
|
+
position: int | Omit = omit,
|
|
2050
|
+
redirect_http_code: int | Omit = omit,
|
|
888
2051
|
tags: SequenceNotStr[str] | Omit = omit,
|
|
2052
|
+
redirect_prefix: str | Omit = omit,
|
|
2053
|
+
redirect_pool_id: str | Omit = omit,
|
|
889
2054
|
polling_interval_seconds: int | Omit = omit,
|
|
2055
|
+
polling_timeout_seconds: int | Omit = omit,
|
|
890
2056
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
891
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
892
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
893
2057
|
extra_headers: Headers | None = None,
|
|
894
2058
|
extra_query: Query | None = None,
|
|
895
2059
|
extra_body: Body | None = None,
|
|
896
2060
|
) -> LoadBalancerL7Policy:
|
|
897
|
-
|
|
2061
|
+
"""Replace L7 policy and poll for completion."""
|
|
2062
|
+
response: TaskIDList = await self.replace( # type: ignore
|
|
898
2063
|
l7policy_id=l7policy_id,
|
|
899
2064
|
project_id=project_id,
|
|
900
2065
|
region_id=region_id,
|
|
@@ -911,12 +2076,13 @@ class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
|
911
2076
|
extra_body=extra_body,
|
|
912
2077
|
timeout=timeout,
|
|
913
2078
|
)
|
|
914
|
-
if not response.tasks or len(response.tasks) != 1:
|
|
2079
|
+
if not response.tasks or len(response.tasks) != 1: # type: ignore[union-attr]
|
|
915
2080
|
raise ValueError(f"Expected exactly one task to be created")
|
|
916
2081
|
await self._client.cloud.tasks.poll(
|
|
917
|
-
task_id=response.tasks[0],
|
|
2082
|
+
task_id=response.tasks[0], # type: ignore[index]
|
|
918
2083
|
extra_headers=extra_headers,
|
|
919
2084
|
polling_interval_seconds=polling_interval_seconds,
|
|
2085
|
+
polling_timeout_seconds=polling_timeout_seconds,
|
|
920
2086
|
)
|
|
921
2087
|
return await self.get(
|
|
922
2088
|
l7policy_id=l7policy_id,
|
|
@@ -946,6 +2112,15 @@ class L7PoliciesResourceWithRawResponse:
|
|
|
946
2112
|
self.replace = to_raw_response_wrapper(
|
|
947
2113
|
l7_policies.replace,
|
|
948
2114
|
)
|
|
2115
|
+
self.create_and_poll = to_raw_response_wrapper(
|
|
2116
|
+
l7_policies.create_and_poll,
|
|
2117
|
+
)
|
|
2118
|
+
self.delete_and_poll = to_raw_response_wrapper(
|
|
2119
|
+
l7_policies.delete_and_poll,
|
|
2120
|
+
)
|
|
2121
|
+
self.replace_and_poll = to_raw_response_wrapper(
|
|
2122
|
+
l7_policies.replace_and_poll,
|
|
2123
|
+
)
|
|
949
2124
|
|
|
950
2125
|
@cached_property
|
|
951
2126
|
def rules(self) -> RulesResourceWithRawResponse:
|
|
@@ -971,6 +2146,15 @@ class AsyncL7PoliciesResourceWithRawResponse:
|
|
|
971
2146
|
self.replace = async_to_raw_response_wrapper(
|
|
972
2147
|
l7_policies.replace,
|
|
973
2148
|
)
|
|
2149
|
+
self.create_and_poll = async_to_raw_response_wrapper(
|
|
2150
|
+
l7_policies.create_and_poll,
|
|
2151
|
+
)
|
|
2152
|
+
self.delete_and_poll = async_to_raw_response_wrapper(
|
|
2153
|
+
l7_policies.delete_and_poll,
|
|
2154
|
+
)
|
|
2155
|
+
self.replace_and_poll = async_to_raw_response_wrapper(
|
|
2156
|
+
l7_policies.replace_and_poll,
|
|
2157
|
+
)
|
|
974
2158
|
|
|
975
2159
|
@cached_property
|
|
976
2160
|
def rules(self) -> AsyncRulesResourceWithRawResponse:
|
|
@@ -996,6 +2180,15 @@ class L7PoliciesResourceWithStreamingResponse:
|
|
|
996
2180
|
self.replace = to_streamed_response_wrapper(
|
|
997
2181
|
l7_policies.replace,
|
|
998
2182
|
)
|
|
2183
|
+
self.create_and_poll = to_streamed_response_wrapper(
|
|
2184
|
+
l7_policies.create_and_poll,
|
|
2185
|
+
)
|
|
2186
|
+
self.delete_and_poll = to_streamed_response_wrapper(
|
|
2187
|
+
l7_policies.delete_and_poll,
|
|
2188
|
+
)
|
|
2189
|
+
self.replace_and_poll = to_streamed_response_wrapper(
|
|
2190
|
+
l7_policies.replace_and_poll,
|
|
2191
|
+
)
|
|
999
2192
|
|
|
1000
2193
|
@cached_property
|
|
1001
2194
|
def rules(self) -> RulesResourceWithStreamingResponse:
|
|
@@ -1021,6 +2214,15 @@ class AsyncL7PoliciesResourceWithStreamingResponse:
|
|
|
1021
2214
|
self.replace = async_to_streamed_response_wrapper(
|
|
1022
2215
|
l7_policies.replace,
|
|
1023
2216
|
)
|
|
2217
|
+
self.create_and_poll = async_to_streamed_response_wrapper(
|
|
2218
|
+
l7_policies.create_and_poll,
|
|
2219
|
+
)
|
|
2220
|
+
self.delete_and_poll = async_to_streamed_response_wrapper(
|
|
2221
|
+
l7_policies.delete_and_poll,
|
|
2222
|
+
)
|
|
2223
|
+
self.replace_and_poll = async_to_streamed_response_wrapper(
|
|
2224
|
+
l7_policies.replace_and_poll,
|
|
2225
|
+
)
|
|
1024
2226
|
|
|
1025
2227
|
@cached_property
|
|
1026
2228
|
def rules(self) -> AsyncRulesResourceWithStreamingResponse:
|