gcore 0.14.0__py3-none-any.whl → 0.16.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 +2 -8
- gcore/_version.py +1 -1
- gcore/resources/cdn/audit_log.py +4 -12
- gcore/resources/cdn/cdn.py +10 -18
- gcore/resources/cdn/certificates.py +16 -40
- gcore/resources/cdn/ip_ranges.py +4 -8
- gcore/resources/cdn/logs/__init__.py +0 -14
- gcore/resources/cdn/logs/logs.py +4 -44
- gcore/resources/cdn/logs_uploader/configs.py +14 -42
- gcore/resources/cdn/logs_uploader/policies.py +14 -42
- gcore/resources/cdn/logs_uploader/targets.py +14 -42
- gcore/resources/cdn/metrics.py +2 -6
- gcore/resources/cdn/network_capacity.py +2 -6
- gcore/resources/cdn/origin_groups.py +12 -32
- gcore/resources/cdn/resources/resources.py +18 -46
- gcore/resources/cdn/resources/rules.py +12 -36
- gcore/resources/cdn/resources/shield.py +4 -12
- gcore/resources/cdn/rule_templates.py +12 -36
- gcore/resources/cdn/shields.py +2 -6
- gcore/resources/cdn/statistics.py +16 -40
- gcore/resources/cdn/trusted_ca_certificates.py +10 -30
- gcore/resources/cloud/audit_logs.py +2 -6
- gcore/resources/cloud/baremetal/flavors.py +2 -6
- gcore/resources/cloud/baremetal/images.py +2 -6
- gcore/resources/cloud/baremetal/servers.py +6 -18
- gcore/resources/cloud/billing_reservations.py +25 -208
- gcore/resources/cloud/cost_reports.py +44 -62
- gcore/resources/cloud/file_shares/access_rules.py +6 -18
- gcore/resources/cloud/file_shares/file_shares.py +37 -44
- gcore/resources/cloud/floating_ips.py +14 -42
- gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +2 -6
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +18 -54
- gcore/resources/cloud/gpu_baremetal_clusters/images.py +8 -24
- gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +2 -6
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +14 -42
- gcore/resources/cloud/inference/api_keys.py +10 -30
- gcore/resources/cloud/inference/applications/deployments.py +135 -155
- gcore/resources/cloud/inference/applications/templates.py +4 -12
- gcore/resources/cloud/inference/deployments/deployments.py +16 -48
- gcore/resources/cloud/inference/deployments/logs.py +2 -6
- gcore/resources/cloud/inference/flavors.py +4 -12
- gcore/resources/cloud/inference/inference.py +2 -6
- gcore/resources/cloud/inference/registry_credentials.py +10 -30
- gcore/resources/cloud/inference/secrets.py +10 -30
- gcore/resources/cloud/instances/flavors.py +2 -6
- gcore/resources/cloud/instances/images.py +12 -36
- gcore/resources/cloud/instances/instances.py +99 -94
- gcore/resources/cloud/instances/interfaces.py +6 -18
- gcore/resources/cloud/instances/metrics.py +2 -6
- gcore/resources/cloud/ip_ranges.py +2 -6
- gcore/resources/cloud/k8s/clusters/clusters.py +18 -54
- gcore/resources/cloud/k8s/clusters/nodes.py +4 -12
- gcore/resources/cloud/k8s/clusters/pools/nodes.py +4 -12
- gcore/resources/cloud/k8s/clusters/pools/pools.py +12 -36
- gcore/resources/cloud/k8s/flavors.py +2 -6
- gcore/resources/cloud/k8s/k8s.py +2 -6
- gcore/resources/cloud/load_balancers/flavors.py +2 -6
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +10 -30
- gcore/resources/cloud/load_balancers/l7_policies/rules.py +10 -30
- gcore/resources/cloud/load_balancers/listeners.py +26 -46
- gcore/resources/cloud/load_balancers/load_balancers.py +493 -521
- gcore/resources/cloud/load_balancers/metrics.py +8 -12
- gcore/resources/cloud/load_balancers/pools/health_monitors.py +4 -12
- gcore/resources/cloud/load_balancers/pools/members.py +4 -12
- gcore/resources/cloud/load_balancers/pools/pools.py +26 -46
- gcore/resources/cloud/load_balancers/statuses.py +10 -18
- gcore/resources/cloud/networks/networks.py +10 -30
- gcore/resources/cloud/networks/routers.py +14 -42
- gcore/resources/cloud/networks/subnets.py +15 -37
- gcore/resources/cloud/placement_groups.py +8 -24
- gcore/resources/cloud/projects.py +10 -22
- gcore/resources/cloud/quotas/quotas.py +6 -18
- gcore/resources/cloud/quotas/requests.py +8 -24
- gcore/resources/cloud/regions.py +4 -8
- gcore/resources/cloud/registries/artifacts.py +4 -12
- gcore/resources/cloud/registries/registries.py +10 -30
- gcore/resources/cloud/registries/repositories.py +4 -12
- gcore/resources/cloud/registries/tags.py +2 -6
- gcore/resources/cloud/registries/users.py +12 -36
- gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +114 -25
- gcore/resources/cloud/reserved_fixed_ips/vip.py +10 -30
- gcore/resources/cloud/secrets.py +8 -24
- gcore/resources/cloud/security_groups/rules.py +6 -18
- gcore/resources/cloud/security_groups/security_groups.py +14 -42
- gcore/resources/cloud/ssh_keys.py +10 -30
- gcore/resources/cloud/tasks.py +14 -26
- gcore/resources/cloud/usage_reports.py +18 -24
- gcore/resources/cloud/users/role_assignments.py +8 -24
- gcore/resources/cloud/volumes.py +20 -60
- gcore/resources/dns/dns.py +4 -8
- gcore/resources/dns/locations.py +8 -20
- gcore/resources/dns/metrics.py +2 -6
- gcore/resources/dns/pickers/pickers.py +2 -2
- gcore/resources/dns/pickers/presets.py +2 -6
- gcore/resources/dns/zones/dnssec.py +4 -12
- gcore/resources/dns/zones/rrsets.py +12 -36
- gcore/resources/dns/zones/zones.py +22 -58
- gcore/resources/fastedge/apps/apps.py +12 -28
- gcore/resources/fastedge/apps/logs.py +2 -6
- gcore/resources/fastedge/binaries.py +8 -24
- gcore/resources/fastedge/fastedge.py +2 -2
- gcore/resources/fastedge/kv_stores.py +10 -22
- gcore/resources/fastedge/secrets.py +12 -36
- gcore/resources/fastedge/statistics.py +4 -12
- gcore/resources/fastedge/templates.py +10 -30
- gcore/resources/iam/api_tokens.py +12 -26
- gcore/resources/iam/iam.py +2 -2
- gcore/resources/iam/users.py +10 -26
- gcore/resources/security/bgp_announces.py +4 -12
- gcore/resources/security/events.py +2 -6
- gcore/resources/security/profile_templates.py +2 -6
- gcore/resources/security/profiles.py +16 -40
- gcore/resources/storage/buckets/buckets.py +6 -18
- gcore/resources/storage/buckets/cors.py +4 -12
- gcore/resources/storage/buckets/lifecycle.py +4 -12
- gcore/resources/storage/buckets/policy.py +6 -18
- gcore/resources/storage/credentials.py +2 -6
- gcore/resources/storage/locations.py +2 -6
- gcore/resources/storage/statistics.py +4 -12
- gcore/resources/storage/storage.py +16 -48
- gcore/resources/streaming/ai_tasks.py +10 -18
- gcore/resources/streaming/broadcasts.py +12 -36
- gcore/resources/streaming/directories.py +10 -30
- gcore/resources/streaming/players.py +12 -28
- gcore/resources/streaming/playlists.py +12 -36
- gcore/resources/streaming/quality_sets.py +4 -12
- gcore/resources/streaming/restreams.py +10 -30
- gcore/resources/streaming/statistics.py +46 -138
- gcore/resources/streaming/streams/overlays.py +12 -36
- gcore/resources/streaming/streams/streams.py +20 -52
- gcore/resources/streaming/videos/subtitles.py +10 -30
- gcore/resources/streaming/videos/videos.py +16 -40
- gcore/resources/waap/advanced_rules.py +2 -6
- gcore/resources/waap/custom_page_sets.py +12 -36
- gcore/resources/waap/domains/advanced_rules.py +12 -36
- gcore/resources/waap/domains/api_discovery.py +12 -36
- gcore/resources/waap/domains/api_path_groups.py +2 -6
- gcore/resources/waap/domains/api_paths.py +10 -30
- gcore/resources/waap/domains/custom_rules.py +14 -42
- gcore/resources/waap/domains/domains.py +12 -32
- gcore/resources/waap/domains/firewall_rules.py +14 -42
- gcore/resources/waap/domains/insight_silences.py +10 -30
- gcore/resources/waap/domains/insights.py +6 -18
- gcore/resources/waap/domains/settings.py +4 -12
- gcore/resources/waap/domains/statistics.py +12 -36
- gcore/resources/waap/insights.py +2 -6
- gcore/resources/waap/ip_info/ip_info.py +16 -48
- gcore/resources/waap/ip_info/metrics.py +2 -6
- gcore/resources/waap/organizations.py +2 -6
- gcore/resources/waap/statistics.py +2 -6
- gcore/resources/waap/tags.py +2 -2
- gcore/resources/waap/waap.py +2 -2
- gcore/types/cdn/cdn_resource.py +20 -0
- gcore/types/cdn/logs/__init__.py +0 -4
- gcore/types/cdn/logs_aggregated_stats.py +1 -1
- gcore/types/cdn/resource_create_params.py +20 -0
- gcore/types/cdn/resource_replace_params.py +20 -0
- gcore/types/cdn/resource_update_params.py +20 -0
- gcore/types/cdn/resources/cdn_resource_rule.py +20 -0
- gcore/types/cdn/resources/rule_create_params.py +20 -0
- gcore/types/cdn/resources/rule_replace_params.py +20 -0
- gcore/types/cdn/resources/rule_update_params.py +20 -0
- gcore/types/cdn/rule_template.py +20 -0
- gcore/types/cdn/rule_template_create_params.py +20 -0
- gcore/types/cdn/rule_template_replace_params.py +20 -0
- gcore/types/cdn/rule_template_update_params.py +20 -0
- gcore/types/cloud/__init__.py +2 -0
- gcore/types/cloud/billing_reservation.py +52 -114
- gcore/types/cloud/billing_reservation_list_params.py +4 -42
- gcore/types/cloud/billing_reservations.py +16 -0
- gcore/types/cloud/cost_report_get_aggregated_params.py +2 -2
- gcore/types/cloud/cost_report_get_detailed_params.py +2 -2
- gcore/types/cloud/gpu_baremetal_clusters/gpu_baremetal_flavor.py +12 -0
- gcore/types/cloud/inference/applications/__init__.py +1 -1
- gcore/types/cloud/inference/applications/{deployment_patch_params.py → deployment_update_params.py} +2 -2
- gcore/types/cloud/instance_list_params.py +1 -1
- gcore/types/cloud/instance_update_params.py +31 -3
- gcore/types/cloud/load_balancer_create_params.py +1 -1
- gcore/types/cloud/load_balancer_listener_detail.py +1 -1
- gcore/types/cloud/load_balancers/listener_create_params.py +1 -1
- gcore/types/cloud/load_balancers/listener_list_params.py +1 -1
- gcore/types/cloud/load_balancers/pool_create_params.py +1 -1
- gcore/types/cloud/load_balancers/pool_list_params.py +1 -1
- gcore/types/cloud/quota_get_all_response.py +8 -8
- gcore/types/cloud/quota_get_by_region_response.py +8 -8
- gcore/types/cloud/quotas/request_create_params.py +4 -4
- gcore/types/cloud/quotas/request_get_response.py +4 -4
- gcore/types/cloud/quotas/request_list_response.py +4 -4
- gcore/types/cloud/reserved_fixed_ip_update_params.py +16 -0
- gcore/types/cloud/task_list_params.py +3 -3
- gcore/types/cloud/usage_report_get_params.py +2 -2
- gcore/types/iam/account_overview.py +24 -26
- gcore/types/iam/api_token.py +24 -24
- gcore/types/iam/api_token_create_params.py +2 -1
- gcore/types/iam/api_token_list.py +24 -24
- gcore/types/iam/user_detailed.py +15 -15
- gcore/types/iam/user_invite.py +2 -4
- gcore/types/iam/user_update.py +15 -15
- gcore/types/security/profile_create_params.py +2 -2
- {gcore-0.14.0.dist-info → gcore-0.16.0.dist-info}/METADATA +1 -1
- {gcore-0.14.0.dist-info → gcore-0.16.0.dist-info}/RECORD +203 -205
- gcore/resources/cdn/logs/settings.py +0 -1081
- gcore/types/cdn/logs/log_settings.py +0 -172
- gcore/types/cdn/logs/setting_create_params.py +0 -200
- gcore/types/cdn/logs/setting_update_params.py +0 -200
- {gcore-0.14.0.dist-info → gcore-0.16.0.dist-info}/WHEEL +0 -0
- {gcore-0.14.0.dist-info → gcore-0.16.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -207,9 +207,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
207
207
|
if region_id is None:
|
|
208
208
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
209
209
|
return self._post(
|
|
210
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}"
|
|
211
|
-
if self._client._base_url_overridden
|
|
212
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}",
|
|
210
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}",
|
|
213
211
|
body=maybe_transform(
|
|
214
212
|
{
|
|
215
213
|
"flavor": flavor,
|
|
@@ -235,7 +233,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
235
233
|
|
|
236
234
|
def update(
|
|
237
235
|
self,
|
|
238
|
-
|
|
236
|
+
load_balancer_id: str,
|
|
239
237
|
*,
|
|
240
238
|
project_id: int | None = None,
|
|
241
239
|
region_id: int | None = None,
|
|
@@ -298,12 +296,10 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
298
296
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
299
297
|
if region_id is None:
|
|
300
298
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
301
|
-
if not
|
|
302
|
-
raise ValueError(f"Expected a non-empty value for `
|
|
299
|
+
if not load_balancer_id:
|
|
300
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
303
301
|
return self._patch(
|
|
304
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{
|
|
305
|
-
if self._client._base_url_overridden
|
|
306
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}",
|
|
302
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}",
|
|
307
303
|
body=maybe_transform(
|
|
308
304
|
{
|
|
309
305
|
"logging": logging,
|
|
@@ -381,9 +377,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
381
377
|
if region_id is None:
|
|
382
378
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
383
379
|
return self._get_api_list(
|
|
384
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}"
|
|
385
|
-
if self._client._base_url_overridden
|
|
386
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}",
|
|
380
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}",
|
|
387
381
|
page=SyncOffsetPage[LoadBalancer],
|
|
388
382
|
options=make_request_options(
|
|
389
383
|
extra_headers=extra_headers,
|
|
@@ -409,194 +403,6 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
409
403
|
model=LoadBalancer,
|
|
410
404
|
)
|
|
411
405
|
|
|
412
|
-
def delete(
|
|
413
|
-
self,
|
|
414
|
-
loadbalancer_id: str,
|
|
415
|
-
*,
|
|
416
|
-
project_id: int | None = None,
|
|
417
|
-
region_id: int | None = None,
|
|
418
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
419
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
420
|
-
extra_headers: Headers | None = None,
|
|
421
|
-
extra_query: Query | None = None,
|
|
422
|
-
extra_body: Body | None = None,
|
|
423
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
424
|
-
) -> TaskIDList:
|
|
425
|
-
"""
|
|
426
|
-
Delete load balancer
|
|
427
|
-
|
|
428
|
-
Args:
|
|
429
|
-
extra_headers: Send extra headers
|
|
430
|
-
|
|
431
|
-
extra_query: Add additional query parameters to the request
|
|
432
|
-
|
|
433
|
-
extra_body: Add additional JSON properties to the request
|
|
434
|
-
|
|
435
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
436
|
-
"""
|
|
437
|
-
if project_id is None:
|
|
438
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
439
|
-
if region_id is None:
|
|
440
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
441
|
-
if not loadbalancer_id:
|
|
442
|
-
raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}")
|
|
443
|
-
return self._delete(
|
|
444
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}"
|
|
445
|
-
if self._client._base_url_overridden
|
|
446
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}",
|
|
447
|
-
options=make_request_options(
|
|
448
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
449
|
-
),
|
|
450
|
-
cast_to=TaskIDList,
|
|
451
|
-
)
|
|
452
|
-
|
|
453
|
-
def failover(
|
|
454
|
-
self,
|
|
455
|
-
loadbalancer_id: str,
|
|
456
|
-
*,
|
|
457
|
-
project_id: int | None = None,
|
|
458
|
-
region_id: int | None = None,
|
|
459
|
-
force: bool | Omit = omit,
|
|
460
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
461
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
462
|
-
extra_headers: Headers | None = None,
|
|
463
|
-
extra_query: Query | None = None,
|
|
464
|
-
extra_body: Body | None = None,
|
|
465
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
466
|
-
) -> TaskIDList:
|
|
467
|
-
"""
|
|
468
|
-
Failover load balancer
|
|
469
|
-
|
|
470
|
-
Args:
|
|
471
|
-
force: Validate current load balancer status before failover or not.
|
|
472
|
-
|
|
473
|
-
extra_headers: Send extra headers
|
|
474
|
-
|
|
475
|
-
extra_query: Add additional query parameters to the request
|
|
476
|
-
|
|
477
|
-
extra_body: Add additional JSON properties to the request
|
|
478
|
-
|
|
479
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
480
|
-
"""
|
|
481
|
-
if project_id is None:
|
|
482
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
483
|
-
if region_id is None:
|
|
484
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
485
|
-
if not loadbalancer_id:
|
|
486
|
-
raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}")
|
|
487
|
-
return self._post(
|
|
488
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover"
|
|
489
|
-
if self._client._base_url_overridden
|
|
490
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover",
|
|
491
|
-
body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams),
|
|
492
|
-
options=make_request_options(
|
|
493
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
494
|
-
),
|
|
495
|
-
cast_to=TaskIDList,
|
|
496
|
-
)
|
|
497
|
-
|
|
498
|
-
def get(
|
|
499
|
-
self,
|
|
500
|
-
loadbalancer_id: str,
|
|
501
|
-
*,
|
|
502
|
-
project_id: int | None = None,
|
|
503
|
-
region_id: int | None = None,
|
|
504
|
-
show_stats: bool | Omit = omit,
|
|
505
|
-
with_ddos: bool | Omit = omit,
|
|
506
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
507
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
508
|
-
extra_headers: Headers | None = None,
|
|
509
|
-
extra_query: Query | None = None,
|
|
510
|
-
extra_body: Body | None = None,
|
|
511
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
512
|
-
) -> LoadBalancer:
|
|
513
|
-
"""
|
|
514
|
-
Get load balancer
|
|
515
|
-
|
|
516
|
-
Args:
|
|
517
|
-
show_stats: Show statistics
|
|
518
|
-
|
|
519
|
-
with_ddos: Show DDoS profile
|
|
520
|
-
|
|
521
|
-
extra_headers: Send extra headers
|
|
522
|
-
|
|
523
|
-
extra_query: Add additional query parameters to the request
|
|
524
|
-
|
|
525
|
-
extra_body: Add additional JSON properties to the request
|
|
526
|
-
|
|
527
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
528
|
-
"""
|
|
529
|
-
if project_id is None:
|
|
530
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
531
|
-
if region_id is None:
|
|
532
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
533
|
-
if not loadbalancer_id:
|
|
534
|
-
raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}")
|
|
535
|
-
return self._get(
|
|
536
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}"
|
|
537
|
-
if self._client._base_url_overridden
|
|
538
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}",
|
|
539
|
-
options=make_request_options(
|
|
540
|
-
extra_headers=extra_headers,
|
|
541
|
-
extra_query=extra_query,
|
|
542
|
-
extra_body=extra_body,
|
|
543
|
-
timeout=timeout,
|
|
544
|
-
query=maybe_transform(
|
|
545
|
-
{
|
|
546
|
-
"show_stats": show_stats,
|
|
547
|
-
"with_ddos": with_ddos,
|
|
548
|
-
},
|
|
549
|
-
load_balancer_get_params.LoadBalancerGetParams,
|
|
550
|
-
),
|
|
551
|
-
),
|
|
552
|
-
cast_to=LoadBalancer,
|
|
553
|
-
)
|
|
554
|
-
|
|
555
|
-
def resize(
|
|
556
|
-
self,
|
|
557
|
-
loadbalancer_id: str,
|
|
558
|
-
*,
|
|
559
|
-
project_id: int | None = None,
|
|
560
|
-
region_id: int | None = None,
|
|
561
|
-
flavor: str,
|
|
562
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
563
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
564
|
-
extra_headers: Headers | None = None,
|
|
565
|
-
extra_query: Query | None = None,
|
|
566
|
-
extra_body: Body | None = None,
|
|
567
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
568
|
-
) -> TaskIDList:
|
|
569
|
-
"""
|
|
570
|
-
Resize load balancer
|
|
571
|
-
|
|
572
|
-
Args:
|
|
573
|
-
flavor: Name of the desired flavor to resize to.
|
|
574
|
-
|
|
575
|
-
extra_headers: Send extra headers
|
|
576
|
-
|
|
577
|
-
extra_query: Add additional query parameters to the request
|
|
578
|
-
|
|
579
|
-
extra_body: Add additional JSON properties to the request
|
|
580
|
-
|
|
581
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
582
|
-
"""
|
|
583
|
-
if project_id is None:
|
|
584
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
585
|
-
if region_id is None:
|
|
586
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
587
|
-
if not loadbalancer_id:
|
|
588
|
-
raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}")
|
|
589
|
-
return self._post(
|
|
590
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize"
|
|
591
|
-
if self._client._base_url_overridden
|
|
592
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize",
|
|
593
|
-
body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams),
|
|
594
|
-
options=make_request_options(
|
|
595
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
596
|
-
),
|
|
597
|
-
cast_to=TaskIDList,
|
|
598
|
-
)
|
|
599
|
-
|
|
600
406
|
def create_and_poll(
|
|
601
407
|
self,
|
|
602
408
|
*,
|
|
@@ -656,7 +462,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
656
462
|
):
|
|
657
463
|
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
658
464
|
return self.get(
|
|
659
|
-
|
|
465
|
+
load_balancer_id=task.created_resources.loadbalancers[0],
|
|
660
466
|
project_id=project_id,
|
|
661
467
|
region_id=region_id,
|
|
662
468
|
extra_headers=extra_headers,
|
|
@@ -665,7 +471,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
665
471
|
|
|
666
472
|
def delete_and_poll(
|
|
667
473
|
self,
|
|
668
|
-
|
|
474
|
+
load_balancer_id: str,
|
|
669
475
|
*,
|
|
670
476
|
project_id: int | None = None,
|
|
671
477
|
region_id: int | None = None,
|
|
@@ -681,7 +487,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
681
487
|
Delete load balancer and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
682
488
|
"""
|
|
683
489
|
response = self.delete(
|
|
684
|
-
|
|
490
|
+
load_balancer_id=load_balancer_id,
|
|
685
491
|
project_id=project_id,
|
|
686
492
|
region_id=region_id,
|
|
687
493
|
extra_headers=extra_headers,
|
|
@@ -699,7 +505,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
699
505
|
|
|
700
506
|
def failover_and_poll(
|
|
701
507
|
self,
|
|
702
|
-
|
|
508
|
+
load_balancer_id: str,
|
|
703
509
|
*,
|
|
704
510
|
project_id: int | None = None,
|
|
705
511
|
region_id: int | None = None,
|
|
@@ -716,7 +522,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
716
522
|
Failover load balancer and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
717
523
|
"""
|
|
718
524
|
response = self.failover(
|
|
719
|
-
|
|
525
|
+
load_balancer_id=load_balancer_id,
|
|
720
526
|
project_id=project_id,
|
|
721
527
|
region_id=region_id,
|
|
722
528
|
force=force,
|
|
@@ -733,7 +539,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
733
539
|
polling_interval_seconds=polling_interval_seconds,
|
|
734
540
|
)
|
|
735
541
|
return self.get(
|
|
736
|
-
|
|
542
|
+
load_balancer_id=load_balancer_id,
|
|
737
543
|
project_id=project_id,
|
|
738
544
|
region_id=region_id,
|
|
739
545
|
extra_headers=extra_headers,
|
|
@@ -742,7 +548,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
742
548
|
|
|
743
549
|
def resize_and_poll(
|
|
744
550
|
self,
|
|
745
|
-
|
|
551
|
+
load_balancer_id: str,
|
|
746
552
|
*,
|
|
747
553
|
project_id: int | None = None,
|
|
748
554
|
region_id: int | None = None,
|
|
@@ -759,7 +565,7 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
759
565
|
Resize load balancer and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
760
566
|
"""
|
|
761
567
|
response = self.resize(
|
|
762
|
-
|
|
568
|
+
load_balancer_id=load_balancer_id,
|
|
763
569
|
project_id=project_id,
|
|
764
570
|
region_id=region_id,
|
|
765
571
|
flavor=flavor,
|
|
@@ -776,75 +582,59 @@ class LoadBalancersResource(SyncAPIResource):
|
|
|
776
582
|
polling_interval_seconds=polling_interval_seconds,
|
|
777
583
|
)
|
|
778
584
|
return self.get(
|
|
779
|
-
|
|
585
|
+
load_balancer_id=load_balancer_id,
|
|
780
586
|
project_id=project_id,
|
|
781
587
|
region_id=region_id,
|
|
782
588
|
extra_headers=extra_headers,
|
|
783
589
|
timeout=timeout,
|
|
784
590
|
)
|
|
785
591
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
@cached_property
|
|
801
|
-
def pools(self) -> AsyncPoolsResource:
|
|
802
|
-
return AsyncPoolsResource(self._client)
|
|
803
|
-
|
|
804
|
-
@cached_property
|
|
805
|
-
def metrics(self) -> AsyncMetricsResource:
|
|
806
|
-
return AsyncMetricsResource(self._client)
|
|
807
|
-
|
|
808
|
-
@cached_property
|
|
809
|
-
def statuses(self) -> AsyncStatusesResource:
|
|
810
|
-
return AsyncStatusesResource(self._client)
|
|
811
|
-
|
|
812
|
-
@cached_property
|
|
813
|
-
def with_raw_response(self) -> AsyncLoadBalancersResourceWithRawResponse:
|
|
592
|
+
def delete(
|
|
593
|
+
self,
|
|
594
|
+
load_balancer_id: str,
|
|
595
|
+
*,
|
|
596
|
+
project_id: int | None = None,
|
|
597
|
+
region_id: int | None = None,
|
|
598
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
599
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
600
|
+
extra_headers: Headers | None = None,
|
|
601
|
+
extra_query: Query | None = None,
|
|
602
|
+
extra_body: Body | None = None,
|
|
603
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
604
|
+
) -> TaskIDList:
|
|
814
605
|
"""
|
|
815
|
-
|
|
816
|
-
the raw response object instead of the parsed content.
|
|
606
|
+
Delete load balancer
|
|
817
607
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
return AsyncLoadBalancersResourceWithRawResponse(self)
|
|
608
|
+
Args:
|
|
609
|
+
extra_headers: Send extra headers
|
|
821
610
|
|
|
822
|
-
|
|
823
|
-
def with_streaming_response(self) -> AsyncLoadBalancersResourceWithStreamingResponse:
|
|
824
|
-
"""
|
|
825
|
-
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
611
|
+
extra_query: Add additional query parameters to the request
|
|
826
612
|
|
|
827
|
-
|
|
613
|
+
extra_body: Add additional JSON properties to the request
|
|
614
|
+
|
|
615
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
828
616
|
"""
|
|
829
|
-
|
|
617
|
+
if project_id is None:
|
|
618
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
619
|
+
if region_id is None:
|
|
620
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
621
|
+
if not load_balancer_id:
|
|
622
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
623
|
+
return self._delete(
|
|
624
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}",
|
|
625
|
+
options=make_request_options(
|
|
626
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
627
|
+
),
|
|
628
|
+
cast_to=TaskIDList,
|
|
629
|
+
)
|
|
830
630
|
|
|
831
|
-
|
|
631
|
+
def failover(
|
|
832
632
|
self,
|
|
633
|
+
load_balancer_id: str,
|
|
833
634
|
*,
|
|
834
635
|
project_id: int | None = None,
|
|
835
636
|
region_id: int | None = None,
|
|
836
|
-
|
|
837
|
-
floating_ip: load_balancer_create_params.FloatingIP | Omit = omit,
|
|
838
|
-
listeners: Iterable[load_balancer_create_params.Listener] | Omit = omit,
|
|
839
|
-
logging: load_balancer_create_params.Logging | Omit = omit,
|
|
840
|
-
name: str | Omit = omit,
|
|
841
|
-
name_template: str | Omit = omit,
|
|
842
|
-
preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit,
|
|
843
|
-
tags: Dict[str, str] | Omit = omit,
|
|
844
|
-
vip_ip_family: InterfaceIPFamily | Omit = omit,
|
|
845
|
-
vip_network_id: str | Omit = omit,
|
|
846
|
-
vip_port_id: str | Omit = omit,
|
|
847
|
-
vip_subnet_id: str | Omit = omit,
|
|
637
|
+
force: bool | Omit = omit,
|
|
848
638
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
849
639
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
850
640
|
extra_headers: Headers | None = None,
|
|
@@ -853,49 +643,14 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
853
643
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
854
644
|
) -> TaskIDList:
|
|
855
645
|
"""
|
|
856
|
-
|
|
646
|
+
Failover load balancer
|
|
857
647
|
|
|
858
648
|
Args:
|
|
859
|
-
|
|
649
|
+
force: Validate current load balancer status before failover or not.
|
|
860
650
|
|
|
861
|
-
|
|
651
|
+
extra_headers: Send extra headers
|
|
862
652
|
|
|
863
|
-
|
|
864
|
-
listener).
|
|
865
|
-
|
|
866
|
-
logging: Logging configuration
|
|
867
|
-
|
|
868
|
-
name: Load balancer name
|
|
869
|
-
|
|
870
|
-
name_template: Load balancer name which will be changed by template.
|
|
871
|
-
|
|
872
|
-
preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools
|
|
873
|
-
members. L2 provides best performance, L3 provides less IPs usage. It is taking
|
|
874
|
-
effect only if `instance_id` + `ip_address` is provided, not `subnet_id` +
|
|
875
|
-
`ip_address`, because we're considering this as intentional `subnet_id`
|
|
876
|
-
specification.
|
|
877
|
-
|
|
878
|
-
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
879
|
-
can be associated with a resource, enabling efficient filtering and grouping for
|
|
880
|
-
better organization and management. Some tags are read-only and cannot be
|
|
881
|
-
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
882
|
-
data to be filtered based on tag keys or values.
|
|
883
|
-
|
|
884
|
-
vip_ip_family: IP family for load balancer subnet auto-selection if `vip_network_id` is
|
|
885
|
-
specified
|
|
886
|
-
|
|
887
|
-
vip_network_id: Network ID for load balancer. If not specified, default external network will be
|
|
888
|
-
used. Mutually exclusive with `vip_port_id`
|
|
889
|
-
|
|
890
|
-
vip_port_id: Existing Reserved Fixed IP port ID for load balancer. Mutually exclusive with
|
|
891
|
-
`vip_network_id`
|
|
892
|
-
|
|
893
|
-
vip_subnet_id: Subnet ID for load balancer. If not specified, any subnet from `vip_network_id`
|
|
894
|
-
will be selected. Ignored when `vip_network_id` is not specified.
|
|
895
|
-
|
|
896
|
-
extra_headers: Send extra headers
|
|
897
|
-
|
|
898
|
-
extra_query: Add additional query parameters to the request
|
|
653
|
+
extra_query: Add additional query parameters to the request
|
|
899
654
|
|
|
900
655
|
extra_body: Add additional JSON properties to the request
|
|
901
656
|
|
|
@@ -905,133 +660,24 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
905
660
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
906
661
|
if region_id is None:
|
|
907
662
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
908
|
-
|
|
909
|
-
f"
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
body=
|
|
913
|
-
{
|
|
914
|
-
"flavor": flavor,
|
|
915
|
-
"floating_ip": floating_ip,
|
|
916
|
-
"listeners": listeners,
|
|
917
|
-
"logging": logging,
|
|
918
|
-
"name": name,
|
|
919
|
-
"name_template": name_template,
|
|
920
|
-
"preferred_connectivity": preferred_connectivity,
|
|
921
|
-
"tags": tags,
|
|
922
|
-
"vip_ip_family": vip_ip_family,
|
|
923
|
-
"vip_network_id": vip_network_id,
|
|
924
|
-
"vip_port_id": vip_port_id,
|
|
925
|
-
"vip_subnet_id": vip_subnet_id,
|
|
926
|
-
},
|
|
927
|
-
load_balancer_create_params.LoadBalancerCreateParams,
|
|
928
|
-
),
|
|
663
|
+
if not load_balancer_id:
|
|
664
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
665
|
+
return self._post(
|
|
666
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/failover",
|
|
667
|
+
body=maybe_transform({"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams),
|
|
929
668
|
options=make_request_options(
|
|
930
669
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
931
670
|
),
|
|
932
671
|
cast_to=TaskIDList,
|
|
933
672
|
)
|
|
934
673
|
|
|
935
|
-
|
|
936
|
-
self,
|
|
937
|
-
loadbalancer_id: str,
|
|
938
|
-
*,
|
|
939
|
-
project_id: int | None = None,
|
|
940
|
-
region_id: int | None = None,
|
|
941
|
-
logging: load_balancer_update_params.Logging | Omit = omit,
|
|
942
|
-
name: str | Omit = omit,
|
|
943
|
-
preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit,
|
|
944
|
-
tags: Optional[TagUpdateMapParam] | Omit = omit,
|
|
945
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
946
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
947
|
-
extra_headers: Headers | None = None,
|
|
948
|
-
extra_query: Query | None = None,
|
|
949
|
-
extra_body: Body | None = None,
|
|
950
|
-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
951
|
-
) -> LoadBalancer:
|
|
952
|
-
"""
|
|
953
|
-
Rename load balancer, activate/deactivate logging, update preferred connectivity
|
|
954
|
-
type and/or modify load balancer tags. The request will only process the fields
|
|
955
|
-
that are provided in the request body. Any fields that are not included will
|
|
956
|
-
remain unchanged.
|
|
957
|
-
|
|
958
|
-
Args:
|
|
959
|
-
logging: Logging configuration
|
|
960
|
-
|
|
961
|
-
name: Name.
|
|
962
|
-
|
|
963
|
-
preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools
|
|
964
|
-
members
|
|
965
|
-
|
|
966
|
-
tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide
|
|
967
|
-
key-value pairs to add or update tags. Set tag values to `null` to remove tags.
|
|
968
|
-
Unspecified tags remain unchanged. Read-only tags are always preserved and
|
|
969
|
-
cannot be modified.
|
|
970
|
-
|
|
971
|
-
**Examples:**
|
|
972
|
-
|
|
973
|
-
- **Add/update tags:**
|
|
974
|
-
`{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or
|
|
975
|
-
updates existing ones.
|
|
976
|
-
- **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags.
|
|
977
|
-
- **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only
|
|
978
|
-
tags are preserved).
|
|
979
|
-
- **Partial update:** `{'tags': {'environment': 'staging'}}` only updates
|
|
980
|
-
specified tags.
|
|
981
|
-
- **Mixed operations:**
|
|
982
|
-
`{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}`
|
|
983
|
-
adds/updates 'environment' and '`cost_center`' while removing
|
|
984
|
-
'`deprecated_tag`', preserving other existing tags.
|
|
985
|
-
- **Replace all:** first delete existing tags with null values, then add new
|
|
986
|
-
ones in the same request.
|
|
987
|
-
|
|
988
|
-
extra_headers: Send extra headers
|
|
989
|
-
|
|
990
|
-
extra_query: Add additional query parameters to the request
|
|
991
|
-
|
|
992
|
-
extra_body: Add additional JSON properties to the request
|
|
993
|
-
|
|
994
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
995
|
-
"""
|
|
996
|
-
if project_id is None:
|
|
997
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
998
|
-
if region_id is None:
|
|
999
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
1000
|
-
if not loadbalancer_id:
|
|
1001
|
-
raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}")
|
|
1002
|
-
return await self._patch(
|
|
1003
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}"
|
|
1004
|
-
if self._client._base_url_overridden
|
|
1005
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}",
|
|
1006
|
-
body=await async_maybe_transform(
|
|
1007
|
-
{
|
|
1008
|
-
"logging": logging,
|
|
1009
|
-
"name": name,
|
|
1010
|
-
"preferred_connectivity": preferred_connectivity,
|
|
1011
|
-
"tags": tags,
|
|
1012
|
-
},
|
|
1013
|
-
load_balancer_update_params.LoadBalancerUpdateParams,
|
|
1014
|
-
),
|
|
1015
|
-
options=make_request_options(
|
|
1016
|
-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1017
|
-
),
|
|
1018
|
-
cast_to=LoadBalancer,
|
|
1019
|
-
)
|
|
1020
|
-
|
|
1021
|
-
def list(
|
|
674
|
+
def get(
|
|
1022
675
|
self,
|
|
676
|
+
load_balancer_id: str,
|
|
1023
677
|
*,
|
|
1024
678
|
project_id: int | None = None,
|
|
1025
679
|
region_id: int | None = None,
|
|
1026
|
-
assigned_floating: bool | Omit = omit,
|
|
1027
|
-
limit: int | Omit = omit,
|
|
1028
|
-
logging_enabled: bool | Omit = omit,
|
|
1029
|
-
name: str | Omit = omit,
|
|
1030
|
-
offset: int | Omit = omit,
|
|
1031
|
-
order_by: str | Omit = omit,
|
|
1032
680
|
show_stats: bool | Omit = omit,
|
|
1033
|
-
tag_key: SequenceNotStr[str] | Omit = omit,
|
|
1034
|
-
tag_key_value: str | Omit = omit,
|
|
1035
681
|
with_ddos: bool | Omit = omit,
|
|
1036
682
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1037
683
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -1039,33 +685,14 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1039
685
|
extra_query: Query | None = None,
|
|
1040
686
|
extra_body: Body | None = None,
|
|
1041
687
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1042
|
-
) ->
|
|
688
|
+
) -> LoadBalancer:
|
|
1043
689
|
"""
|
|
1044
|
-
|
|
690
|
+
Get load balancer
|
|
1045
691
|
|
|
1046
692
|
Args:
|
|
1047
|
-
assigned_floating: With or without assigned floating IP
|
|
1048
|
-
|
|
1049
|
-
limit: Limit the number of returned limit request entities.
|
|
1050
|
-
|
|
1051
|
-
logging_enabled: With or without logging
|
|
1052
|
-
|
|
1053
|
-
name: Filter by name
|
|
1054
|
-
|
|
1055
|
-
offset: Offset value is used to exclude the first set of records from the result.
|
|
1056
|
-
|
|
1057
|
-
order_by: Ordering Load Balancer list result by name, `created_at`, `updated_at`,
|
|
1058
|
-
`operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and
|
|
1059
|
-
flavor fields of the load balancer and directions (name.asc), default is
|
|
1060
|
-
"`created_at`.asc"
|
|
1061
|
-
|
|
1062
693
|
show_stats: Show statistics
|
|
1063
694
|
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string.
|
|
1067
|
-
|
|
1068
|
-
with_ddos: Show Advanced DDoS protection profile, if exists
|
|
695
|
+
with_ddos: Show DDoS profile
|
|
1069
696
|
|
|
1070
697
|
extra_headers: Send extra headers
|
|
1071
698
|
|
|
@@ -1079,11 +706,10 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1079
706
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
1080
707
|
if region_id is None:
|
|
1081
708
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
1082
|
-
|
|
1083
|
-
f"
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
page=AsyncOffsetPage[LoadBalancer],
|
|
709
|
+
if not load_balancer_id:
|
|
710
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
711
|
+
return self._get(
|
|
712
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}",
|
|
1087
713
|
options=make_request_options(
|
|
1088
714
|
extra_headers=extra_headers,
|
|
1089
715
|
extra_query=extra_query,
|
|
@@ -1091,29 +717,22 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1091
717
|
timeout=timeout,
|
|
1092
718
|
query=maybe_transform(
|
|
1093
719
|
{
|
|
1094
|
-
"assigned_floating": assigned_floating,
|
|
1095
|
-
"limit": limit,
|
|
1096
|
-
"logging_enabled": logging_enabled,
|
|
1097
|
-
"name": name,
|
|
1098
|
-
"offset": offset,
|
|
1099
|
-
"order_by": order_by,
|
|
1100
720
|
"show_stats": show_stats,
|
|
1101
|
-
"tag_key": tag_key,
|
|
1102
|
-
"tag_key_value": tag_key_value,
|
|
1103
721
|
"with_ddos": with_ddos,
|
|
1104
722
|
},
|
|
1105
|
-
|
|
723
|
+
load_balancer_get_params.LoadBalancerGetParams,
|
|
1106
724
|
),
|
|
1107
725
|
),
|
|
1108
|
-
|
|
726
|
+
cast_to=LoadBalancer,
|
|
1109
727
|
)
|
|
1110
728
|
|
|
1111
|
-
|
|
729
|
+
def resize(
|
|
1112
730
|
self,
|
|
1113
|
-
|
|
731
|
+
load_balancer_id: str,
|
|
1114
732
|
*,
|
|
1115
733
|
project_id: int | None = None,
|
|
1116
734
|
region_id: int | None = None,
|
|
735
|
+
flavor: str,
|
|
1117
736
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1118
737
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1119
738
|
extra_headers: Headers | None = None,
|
|
@@ -1122,9 +741,11 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1122
741
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1123
742
|
) -> TaskIDList:
|
|
1124
743
|
"""
|
|
1125
|
-
|
|
744
|
+
Resize load balancer
|
|
1126
745
|
|
|
1127
746
|
Args:
|
|
747
|
+
flavor: Name of the desired flavor to resize to.
|
|
748
|
+
|
|
1128
749
|
extra_headers: Send extra headers
|
|
1129
750
|
|
|
1130
751
|
extra_query: Add additional query parameters to the request
|
|
@@ -1137,25 +758,79 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1137
758
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
1138
759
|
if region_id is None:
|
|
1139
760
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
1140
|
-
if not
|
|
1141
|
-
raise ValueError(f"Expected a non-empty value for `
|
|
1142
|
-
return
|
|
1143
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{
|
|
1144
|
-
|
|
1145
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}",
|
|
761
|
+
if not load_balancer_id:
|
|
762
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
763
|
+
return self._post(
|
|
764
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/resize",
|
|
765
|
+
body=maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams),
|
|
1146
766
|
options=make_request_options(
|
|
1147
767
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1148
768
|
),
|
|
1149
769
|
cast_to=TaskIDList,
|
|
1150
770
|
)
|
|
1151
771
|
|
|
1152
|
-
|
|
772
|
+
|
|
773
|
+
class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
774
|
+
@cached_property
|
|
775
|
+
def l7_policies(self) -> AsyncL7PoliciesResource:
|
|
776
|
+
return AsyncL7PoliciesResource(self._client)
|
|
777
|
+
|
|
778
|
+
@cached_property
|
|
779
|
+
def flavors(self) -> AsyncFlavorsResource:
|
|
780
|
+
return AsyncFlavorsResource(self._client)
|
|
781
|
+
|
|
782
|
+
@cached_property
|
|
783
|
+
def listeners(self) -> AsyncListenersResource:
|
|
784
|
+
return AsyncListenersResource(self._client)
|
|
785
|
+
|
|
786
|
+
@cached_property
|
|
787
|
+
def pools(self) -> AsyncPoolsResource:
|
|
788
|
+
return AsyncPoolsResource(self._client)
|
|
789
|
+
|
|
790
|
+
@cached_property
|
|
791
|
+
def metrics(self) -> AsyncMetricsResource:
|
|
792
|
+
return AsyncMetricsResource(self._client)
|
|
793
|
+
|
|
794
|
+
@cached_property
|
|
795
|
+
def statuses(self) -> AsyncStatusesResource:
|
|
796
|
+
return AsyncStatusesResource(self._client)
|
|
797
|
+
|
|
798
|
+
@cached_property
|
|
799
|
+
def with_raw_response(self) -> AsyncLoadBalancersResourceWithRawResponse:
|
|
800
|
+
"""
|
|
801
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
802
|
+
the raw response object instead of the parsed content.
|
|
803
|
+
|
|
804
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
805
|
+
"""
|
|
806
|
+
return AsyncLoadBalancersResourceWithRawResponse(self)
|
|
807
|
+
|
|
808
|
+
@cached_property
|
|
809
|
+
def with_streaming_response(self) -> AsyncLoadBalancersResourceWithStreamingResponse:
|
|
810
|
+
"""
|
|
811
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
812
|
+
|
|
813
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
814
|
+
"""
|
|
815
|
+
return AsyncLoadBalancersResourceWithStreamingResponse(self)
|
|
816
|
+
|
|
817
|
+
async def create(
|
|
1153
818
|
self,
|
|
1154
|
-
loadbalancer_id: str,
|
|
1155
819
|
*,
|
|
1156
820
|
project_id: int | None = None,
|
|
1157
821
|
region_id: int | None = None,
|
|
1158
|
-
|
|
822
|
+
flavor: str | Omit = omit,
|
|
823
|
+
floating_ip: load_balancer_create_params.FloatingIP | Omit = omit,
|
|
824
|
+
listeners: Iterable[load_balancer_create_params.Listener] | Omit = omit,
|
|
825
|
+
logging: load_balancer_create_params.Logging | Omit = omit,
|
|
826
|
+
name: str | Omit = omit,
|
|
827
|
+
name_template: str | Omit = omit,
|
|
828
|
+
preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit,
|
|
829
|
+
tags: Dict[str, str] | Omit = omit,
|
|
830
|
+
vip_ip_family: InterfaceIPFamily | Omit = omit,
|
|
831
|
+
vip_network_id: str | Omit = omit,
|
|
832
|
+
vip_port_id: str | Omit = omit,
|
|
833
|
+
vip_subnet_id: str | Omit = omit,
|
|
1159
834
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1160
835
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1161
836
|
extra_headers: Headers | None = None,
|
|
@@ -1164,10 +839,45 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1164
839
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1165
840
|
) -> TaskIDList:
|
|
1166
841
|
"""
|
|
1167
|
-
|
|
842
|
+
Create load balancer
|
|
1168
843
|
|
|
1169
844
|
Args:
|
|
1170
|
-
|
|
845
|
+
flavor: Load balancer flavor name
|
|
846
|
+
|
|
847
|
+
floating_ip: Floating IP configuration for assignment
|
|
848
|
+
|
|
849
|
+
listeners: Load balancer listeners. Maximum 50 per LB (excluding Prometheus endpoint
|
|
850
|
+
listener).
|
|
851
|
+
|
|
852
|
+
logging: Logging configuration
|
|
853
|
+
|
|
854
|
+
name: Load balancer name
|
|
855
|
+
|
|
856
|
+
name_template: Load balancer name which will be changed by template.
|
|
857
|
+
|
|
858
|
+
preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools
|
|
859
|
+
members. L2 provides best performance, L3 provides less IPs usage. It is taking
|
|
860
|
+
effect only if `instance_id` + `ip_address` is provided, not `subnet_id` +
|
|
861
|
+
`ip_address`, because we're considering this as intentional `subnet_id`
|
|
862
|
+
specification.
|
|
863
|
+
|
|
864
|
+
tags: Key-value tags to associate with the resource. A tag is a key-value pair that
|
|
865
|
+
can be associated with a resource, enabling efficient filtering and grouping for
|
|
866
|
+
better organization and management. Some tags are read-only and cannot be
|
|
867
|
+
modified by the user. Tags are also integrated with cost reports, allowing cost
|
|
868
|
+
data to be filtered based on tag keys or values.
|
|
869
|
+
|
|
870
|
+
vip_ip_family: IP family for load balancer subnet auto-selection if `vip_network_id` is
|
|
871
|
+
specified
|
|
872
|
+
|
|
873
|
+
vip_network_id: Network ID for load balancer. If not specified, default external network will be
|
|
874
|
+
used. Mutually exclusive with `vip_port_id`
|
|
875
|
+
|
|
876
|
+
vip_port_id: Existing Reserved Fixed IP port ID for load balancer. Mutually exclusive with
|
|
877
|
+
`vip_network_id`
|
|
878
|
+
|
|
879
|
+
vip_subnet_id: Subnet ID for load balancer. If not specified, any subnet from `vip_network_id`
|
|
880
|
+
will be selected. Ignored when `vip_network_id` is not specified.
|
|
1171
881
|
|
|
1172
882
|
extra_headers: Send extra headers
|
|
1173
883
|
|
|
@@ -1181,14 +891,24 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1181
891
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
1182
892
|
if region_id is None:
|
|
1183
893
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
1184
|
-
if not loadbalancer_id:
|
|
1185
|
-
raise ValueError(f"Expected a non-empty value for `loadbalancer_id` but received {loadbalancer_id!r}")
|
|
1186
894
|
return await self._post(
|
|
1187
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}
|
|
1188
|
-
if self._client._base_url_overridden
|
|
1189
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/failover",
|
|
895
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}",
|
|
1190
896
|
body=await async_maybe_transform(
|
|
1191
|
-
{
|
|
897
|
+
{
|
|
898
|
+
"flavor": flavor,
|
|
899
|
+
"floating_ip": floating_ip,
|
|
900
|
+
"listeners": listeners,
|
|
901
|
+
"logging": logging,
|
|
902
|
+
"name": name,
|
|
903
|
+
"name_template": name_template,
|
|
904
|
+
"preferred_connectivity": preferred_connectivity,
|
|
905
|
+
"tags": tags,
|
|
906
|
+
"vip_ip_family": vip_ip_family,
|
|
907
|
+
"vip_network_id": vip_network_id,
|
|
908
|
+
"vip_port_id": vip_port_id,
|
|
909
|
+
"vip_subnet_id": vip_subnet_id,
|
|
910
|
+
},
|
|
911
|
+
load_balancer_create_params.LoadBalancerCreateParams,
|
|
1192
912
|
),
|
|
1193
913
|
options=make_request_options(
|
|
1194
914
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
@@ -1196,14 +916,16 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1196
916
|
cast_to=TaskIDList,
|
|
1197
917
|
)
|
|
1198
918
|
|
|
1199
|
-
async def
|
|
919
|
+
async def update(
|
|
1200
920
|
self,
|
|
1201
|
-
|
|
921
|
+
load_balancer_id: str,
|
|
1202
922
|
*,
|
|
1203
923
|
project_id: int | None = None,
|
|
1204
924
|
region_id: int | None = None,
|
|
1205
|
-
|
|
1206
|
-
|
|
925
|
+
logging: load_balancer_update_params.Logging | Omit = omit,
|
|
926
|
+
name: str | Omit = omit,
|
|
927
|
+
preferred_connectivity: LoadBalancerMemberConnectivity | Omit = omit,
|
|
928
|
+
tags: Optional[TagUpdateMapParam] | Omit = omit,
|
|
1207
929
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1208
930
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1209
931
|
extra_headers: Headers | None = None,
|
|
@@ -1212,12 +934,40 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1212
934
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1213
935
|
) -> LoadBalancer:
|
|
1214
936
|
"""
|
|
1215
|
-
|
|
937
|
+
Rename load balancer, activate/deactivate logging, update preferred connectivity
|
|
938
|
+
type and/or modify load balancer tags. The request will only process the fields
|
|
939
|
+
that are provided in the request body. Any fields that are not included will
|
|
940
|
+
remain unchanged.
|
|
1216
941
|
|
|
1217
942
|
Args:
|
|
1218
|
-
|
|
943
|
+
logging: Logging configuration
|
|
1219
944
|
|
|
1220
|
-
|
|
945
|
+
name: Name.
|
|
946
|
+
|
|
947
|
+
preferred_connectivity: Preferred option to establish connectivity between load balancer and its pools
|
|
948
|
+
members
|
|
949
|
+
|
|
950
|
+
tags: Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide
|
|
951
|
+
key-value pairs to add or update tags. Set tag values to `null` to remove tags.
|
|
952
|
+
Unspecified tags remain unchanged. Read-only tags are always preserved and
|
|
953
|
+
cannot be modified.
|
|
954
|
+
|
|
955
|
+
**Examples:**
|
|
956
|
+
|
|
957
|
+
- **Add/update tags:**
|
|
958
|
+
`{'tags': {'environment': 'production', 'team': 'backend'}}` adds new tags or
|
|
959
|
+
updates existing ones.
|
|
960
|
+
- **Delete tags:** `{'tags': {'`old_tag`': null}}` removes specific tags.
|
|
961
|
+
- **Remove all tags:** `{'tags': null}` removes all user-managed tags (read-only
|
|
962
|
+
tags are preserved).
|
|
963
|
+
- **Partial update:** `{'tags': {'environment': 'staging'}}` only updates
|
|
964
|
+
specified tags.
|
|
965
|
+
- **Mixed operations:**
|
|
966
|
+
`{'tags': {'environment': 'production', '`cost_center`': 'engineering', '`deprecated_tag`': null}}`
|
|
967
|
+
adds/updates 'environment' and '`cost_center`' while removing
|
|
968
|
+
'`deprecated_tag`', preserving other existing tags.
|
|
969
|
+
- **Replace all:** first delete existing tags with null values, then add new
|
|
970
|
+
ones in the same request.
|
|
1221
971
|
|
|
1222
972
|
extra_headers: Send extra headers
|
|
1223
973
|
|
|
@@ -1231,47 +981,73 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1231
981
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
1232
982
|
if region_id is None:
|
|
1233
983
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
1234
|
-
if not
|
|
1235
|
-
raise ValueError(f"Expected a non-empty value for `
|
|
1236
|
-
return await self.
|
|
1237
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{
|
|
1238
|
-
|
|
1239
|
-
|
|
984
|
+
if not load_balancer_id:
|
|
985
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
986
|
+
return await self._patch(
|
|
987
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}",
|
|
988
|
+
body=await async_maybe_transform(
|
|
989
|
+
{
|
|
990
|
+
"logging": logging,
|
|
991
|
+
"name": name,
|
|
992
|
+
"preferred_connectivity": preferred_connectivity,
|
|
993
|
+
"tags": tags,
|
|
994
|
+
},
|
|
995
|
+
load_balancer_update_params.LoadBalancerUpdateParams,
|
|
996
|
+
),
|
|
1240
997
|
options=make_request_options(
|
|
1241
|
-
extra_headers=extra_headers,
|
|
1242
|
-
extra_query=extra_query,
|
|
1243
|
-
extra_body=extra_body,
|
|
1244
|
-
timeout=timeout,
|
|
1245
|
-
query=await async_maybe_transform(
|
|
1246
|
-
{
|
|
1247
|
-
"show_stats": show_stats,
|
|
1248
|
-
"with_ddos": with_ddos,
|
|
1249
|
-
},
|
|
1250
|
-
load_balancer_get_params.LoadBalancerGetParams,
|
|
1251
|
-
),
|
|
998
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1252
999
|
),
|
|
1253
1000
|
cast_to=LoadBalancer,
|
|
1254
1001
|
)
|
|
1255
1002
|
|
|
1256
|
-
|
|
1003
|
+
def list(
|
|
1257
1004
|
self,
|
|
1258
|
-
loadbalancer_id: str,
|
|
1259
1005
|
*,
|
|
1260
1006
|
project_id: int | None = None,
|
|
1261
1007
|
region_id: int | None = None,
|
|
1262
|
-
|
|
1008
|
+
assigned_floating: bool | Omit = omit,
|
|
1009
|
+
limit: int | Omit = omit,
|
|
1010
|
+
logging_enabled: bool | Omit = omit,
|
|
1011
|
+
name: str | Omit = omit,
|
|
1012
|
+
offset: int | Omit = omit,
|
|
1013
|
+
order_by: str | Omit = omit,
|
|
1014
|
+
show_stats: bool | Omit = omit,
|
|
1015
|
+
tag_key: SequenceNotStr[str] | Omit = omit,
|
|
1016
|
+
tag_key_value: str | Omit = omit,
|
|
1017
|
+
with_ddos: bool | Omit = omit,
|
|
1263
1018
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1264
1019
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1265
1020
|
extra_headers: Headers | None = None,
|
|
1266
1021
|
extra_query: Query | None = None,
|
|
1267
1022
|
extra_body: Body | None = None,
|
|
1268
1023
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1269
|
-
) ->
|
|
1024
|
+
) -> AsyncPaginator[LoadBalancer, AsyncOffsetPage[LoadBalancer]]:
|
|
1270
1025
|
"""
|
|
1271
|
-
|
|
1026
|
+
List load balancers
|
|
1272
1027
|
|
|
1273
1028
|
Args:
|
|
1274
|
-
|
|
1029
|
+
assigned_floating: With or without assigned floating IP
|
|
1030
|
+
|
|
1031
|
+
limit: Limit the number of returned limit request entities.
|
|
1032
|
+
|
|
1033
|
+
logging_enabled: With or without logging
|
|
1034
|
+
|
|
1035
|
+
name: Filter by name
|
|
1036
|
+
|
|
1037
|
+
offset: Offset value is used to exclude the first set of records from the result.
|
|
1038
|
+
|
|
1039
|
+
order_by: Ordering Load Balancer list result by name, `created_at`, `updated_at`,
|
|
1040
|
+
`operating_status`, `provisioning_status`, `vip_address`, `vip_ip_family` and
|
|
1041
|
+
flavor fields of the load balancer and directions (name.asc), default is
|
|
1042
|
+
"`created_at`.asc"
|
|
1043
|
+
|
|
1044
|
+
show_stats: Show statistics
|
|
1045
|
+
|
|
1046
|
+
tag_key: Filter by tag keys.
|
|
1047
|
+
|
|
1048
|
+
tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string.
|
|
1049
|
+
|
|
1050
|
+
with_ddos: Show Advanced DDoS protection profile, if exists
|
|
1275
1051
|
|
|
1276
1052
|
extra_headers: Send extra headers
|
|
1277
1053
|
|
|
@@ -1285,17 +1061,31 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1285
1061
|
project_id = self._client._get_cloud_project_id_path_param()
|
|
1286
1062
|
if region_id is None:
|
|
1287
1063
|
region_id = self._client._get_cloud_region_id_path_param()
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize"
|
|
1292
|
-
if self._client._base_url_overridden
|
|
1293
|
-
else f"https://api.gcore.com//cloud/v1/loadbalancers/{project_id}/{region_id}/{loadbalancer_id}/resize",
|
|
1294
|
-
body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams),
|
|
1064
|
+
return self._get_api_list(
|
|
1065
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}",
|
|
1066
|
+
page=AsyncOffsetPage[LoadBalancer],
|
|
1295
1067
|
options=make_request_options(
|
|
1296
|
-
extra_headers=extra_headers,
|
|
1068
|
+
extra_headers=extra_headers,
|
|
1069
|
+
extra_query=extra_query,
|
|
1070
|
+
extra_body=extra_body,
|
|
1071
|
+
timeout=timeout,
|
|
1072
|
+
query=maybe_transform(
|
|
1073
|
+
{
|
|
1074
|
+
"assigned_floating": assigned_floating,
|
|
1075
|
+
"limit": limit,
|
|
1076
|
+
"logging_enabled": logging_enabled,
|
|
1077
|
+
"name": name,
|
|
1078
|
+
"offset": offset,
|
|
1079
|
+
"order_by": order_by,
|
|
1080
|
+
"show_stats": show_stats,
|
|
1081
|
+
"tag_key": tag_key,
|
|
1082
|
+
"tag_key_value": tag_key_value,
|
|
1083
|
+
"with_ddos": with_ddos,
|
|
1084
|
+
},
|
|
1085
|
+
load_balancer_list_params.LoadBalancerListParams,
|
|
1086
|
+
),
|
|
1297
1087
|
),
|
|
1298
|
-
|
|
1088
|
+
model=LoadBalancer,
|
|
1299
1089
|
)
|
|
1300
1090
|
|
|
1301
1091
|
async def create_and_poll(
|
|
@@ -1357,7 +1147,7 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1357
1147
|
):
|
|
1358
1148
|
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
1359
1149
|
return await self.get(
|
|
1360
|
-
|
|
1150
|
+
load_balancer_id=task.created_resources.loadbalancers[0],
|
|
1361
1151
|
project_id=project_id,
|
|
1362
1152
|
region_id=region_id,
|
|
1363
1153
|
extra_headers=extra_headers,
|
|
@@ -1366,7 +1156,7 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1366
1156
|
|
|
1367
1157
|
async def delete_and_poll(
|
|
1368
1158
|
self,
|
|
1369
|
-
|
|
1159
|
+
load_balancer_id: str,
|
|
1370
1160
|
*,
|
|
1371
1161
|
project_id: int | None = None,
|
|
1372
1162
|
region_id: int | None = None,
|
|
@@ -1382,7 +1172,7 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1382
1172
|
Delete load balancer and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1383
1173
|
"""
|
|
1384
1174
|
response = await self.delete(
|
|
1385
|
-
|
|
1175
|
+
load_balancer_id=load_balancer_id,
|
|
1386
1176
|
project_id=project_id,
|
|
1387
1177
|
region_id=region_id,
|
|
1388
1178
|
extra_headers=extra_headers,
|
|
@@ -1400,7 +1190,7 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1400
1190
|
|
|
1401
1191
|
async def failover_and_poll(
|
|
1402
1192
|
self,
|
|
1403
|
-
|
|
1193
|
+
load_balancer_id: str,
|
|
1404
1194
|
*,
|
|
1405
1195
|
project_id: int | None = None,
|
|
1406
1196
|
region_id: int | None = None,
|
|
@@ -1417,7 +1207,7 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1417
1207
|
Failover load balancer and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1418
1208
|
"""
|
|
1419
1209
|
response = await self.failover(
|
|
1420
|
-
|
|
1210
|
+
load_balancer_id=load_balancer_id,
|
|
1421
1211
|
project_id=project_id,
|
|
1422
1212
|
region_id=region_id,
|
|
1423
1213
|
force=force,
|
|
@@ -1434,7 +1224,7 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1434
1224
|
polling_interval_seconds=polling_interval_seconds,
|
|
1435
1225
|
)
|
|
1436
1226
|
return await self.get(
|
|
1437
|
-
|
|
1227
|
+
load_balancer_id=load_balancer_id,
|
|
1438
1228
|
project_id=project_id,
|
|
1439
1229
|
region_id=region_id,
|
|
1440
1230
|
extra_headers=extra_headers,
|
|
@@ -1443,7 +1233,7 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1443
1233
|
|
|
1444
1234
|
async def resize_and_poll(
|
|
1445
1235
|
self,
|
|
1446
|
-
|
|
1236
|
+
load_balancer_id: str,
|
|
1447
1237
|
*,
|
|
1448
1238
|
project_id: int | None = None,
|
|
1449
1239
|
region_id: int | None = None,
|
|
@@ -1460,7 +1250,7 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1460
1250
|
Resize load balancer and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1461
1251
|
"""
|
|
1462
1252
|
response = await self.resize(
|
|
1463
|
-
|
|
1253
|
+
load_balancer_id=load_balancer_id,
|
|
1464
1254
|
project_id=project_id,
|
|
1465
1255
|
region_id=region_id,
|
|
1466
1256
|
flavor=flavor,
|
|
@@ -1477,13 +1267,195 @@ class AsyncLoadBalancersResource(AsyncAPIResource):
|
|
|
1477
1267
|
polling_interval_seconds=polling_interval_seconds,
|
|
1478
1268
|
)
|
|
1479
1269
|
return await self.get(
|
|
1480
|
-
|
|
1270
|
+
load_balancer_id=load_balancer_id,
|
|
1481
1271
|
project_id=project_id,
|
|
1482
1272
|
region_id=region_id,
|
|
1483
1273
|
extra_headers=extra_headers,
|
|
1484
1274
|
timeout=timeout,
|
|
1485
1275
|
)
|
|
1486
1276
|
|
|
1277
|
+
async def delete(
|
|
1278
|
+
self,
|
|
1279
|
+
load_balancer_id: str,
|
|
1280
|
+
*,
|
|
1281
|
+
project_id: int | None = None,
|
|
1282
|
+
region_id: int | None = None,
|
|
1283
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1284
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1285
|
+
extra_headers: Headers | None = None,
|
|
1286
|
+
extra_query: Query | None = None,
|
|
1287
|
+
extra_body: Body | None = None,
|
|
1288
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1289
|
+
) -> TaskIDList:
|
|
1290
|
+
"""
|
|
1291
|
+
Delete load balancer
|
|
1292
|
+
|
|
1293
|
+
Args:
|
|
1294
|
+
extra_headers: Send extra headers
|
|
1295
|
+
|
|
1296
|
+
extra_query: Add additional query parameters to the request
|
|
1297
|
+
|
|
1298
|
+
extra_body: Add additional JSON properties to the request
|
|
1299
|
+
|
|
1300
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1301
|
+
"""
|
|
1302
|
+
if project_id is None:
|
|
1303
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
1304
|
+
if region_id is None:
|
|
1305
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
1306
|
+
if not load_balancer_id:
|
|
1307
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
1308
|
+
return await self._delete(
|
|
1309
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}",
|
|
1310
|
+
options=make_request_options(
|
|
1311
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1312
|
+
),
|
|
1313
|
+
cast_to=TaskIDList,
|
|
1314
|
+
)
|
|
1315
|
+
|
|
1316
|
+
async def failover(
|
|
1317
|
+
self,
|
|
1318
|
+
load_balancer_id: str,
|
|
1319
|
+
*,
|
|
1320
|
+
project_id: int | None = None,
|
|
1321
|
+
region_id: int | None = None,
|
|
1322
|
+
force: bool | Omit = omit,
|
|
1323
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1324
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1325
|
+
extra_headers: Headers | None = None,
|
|
1326
|
+
extra_query: Query | None = None,
|
|
1327
|
+
extra_body: Body | None = None,
|
|
1328
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1329
|
+
) -> TaskIDList:
|
|
1330
|
+
"""
|
|
1331
|
+
Failover load balancer
|
|
1332
|
+
|
|
1333
|
+
Args:
|
|
1334
|
+
force: Validate current load balancer status before failover or not.
|
|
1335
|
+
|
|
1336
|
+
extra_headers: Send extra headers
|
|
1337
|
+
|
|
1338
|
+
extra_query: Add additional query parameters to the request
|
|
1339
|
+
|
|
1340
|
+
extra_body: Add additional JSON properties to the request
|
|
1341
|
+
|
|
1342
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1343
|
+
"""
|
|
1344
|
+
if project_id is None:
|
|
1345
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
1346
|
+
if region_id is None:
|
|
1347
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
1348
|
+
if not load_balancer_id:
|
|
1349
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
1350
|
+
return await self._post(
|
|
1351
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/failover",
|
|
1352
|
+
body=await async_maybe_transform(
|
|
1353
|
+
{"force": force}, load_balancer_failover_params.LoadBalancerFailoverParams
|
|
1354
|
+
),
|
|
1355
|
+
options=make_request_options(
|
|
1356
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1357
|
+
),
|
|
1358
|
+
cast_to=TaskIDList,
|
|
1359
|
+
)
|
|
1360
|
+
|
|
1361
|
+
async def get(
|
|
1362
|
+
self,
|
|
1363
|
+
load_balancer_id: str,
|
|
1364
|
+
*,
|
|
1365
|
+
project_id: int | None = None,
|
|
1366
|
+
region_id: int | None = None,
|
|
1367
|
+
show_stats: bool | Omit = omit,
|
|
1368
|
+
with_ddos: bool | Omit = omit,
|
|
1369
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1370
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1371
|
+
extra_headers: Headers | None = None,
|
|
1372
|
+
extra_query: Query | None = None,
|
|
1373
|
+
extra_body: Body | None = None,
|
|
1374
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1375
|
+
) -> LoadBalancer:
|
|
1376
|
+
"""
|
|
1377
|
+
Get load balancer
|
|
1378
|
+
|
|
1379
|
+
Args:
|
|
1380
|
+
show_stats: Show statistics
|
|
1381
|
+
|
|
1382
|
+
with_ddos: Show DDoS profile
|
|
1383
|
+
|
|
1384
|
+
extra_headers: Send extra headers
|
|
1385
|
+
|
|
1386
|
+
extra_query: Add additional query parameters to the request
|
|
1387
|
+
|
|
1388
|
+
extra_body: Add additional JSON properties to the request
|
|
1389
|
+
|
|
1390
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1391
|
+
"""
|
|
1392
|
+
if project_id is None:
|
|
1393
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
1394
|
+
if region_id is None:
|
|
1395
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
1396
|
+
if not load_balancer_id:
|
|
1397
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
1398
|
+
return await self._get(
|
|
1399
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}",
|
|
1400
|
+
options=make_request_options(
|
|
1401
|
+
extra_headers=extra_headers,
|
|
1402
|
+
extra_query=extra_query,
|
|
1403
|
+
extra_body=extra_body,
|
|
1404
|
+
timeout=timeout,
|
|
1405
|
+
query=await async_maybe_transform(
|
|
1406
|
+
{
|
|
1407
|
+
"show_stats": show_stats,
|
|
1408
|
+
"with_ddos": with_ddos,
|
|
1409
|
+
},
|
|
1410
|
+
load_balancer_get_params.LoadBalancerGetParams,
|
|
1411
|
+
),
|
|
1412
|
+
),
|
|
1413
|
+
cast_to=LoadBalancer,
|
|
1414
|
+
)
|
|
1415
|
+
|
|
1416
|
+
async def resize(
|
|
1417
|
+
self,
|
|
1418
|
+
load_balancer_id: str,
|
|
1419
|
+
*,
|
|
1420
|
+
project_id: int | None = None,
|
|
1421
|
+
region_id: int | None = None,
|
|
1422
|
+
flavor: str,
|
|
1423
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1424
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1425
|
+
extra_headers: Headers | None = None,
|
|
1426
|
+
extra_query: Query | None = None,
|
|
1427
|
+
extra_body: Body | None = None,
|
|
1428
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
1429
|
+
) -> TaskIDList:
|
|
1430
|
+
"""
|
|
1431
|
+
Resize load balancer
|
|
1432
|
+
|
|
1433
|
+
Args:
|
|
1434
|
+
flavor: Name of the desired flavor to resize to.
|
|
1435
|
+
|
|
1436
|
+
extra_headers: Send extra headers
|
|
1437
|
+
|
|
1438
|
+
extra_query: Add additional query parameters to the request
|
|
1439
|
+
|
|
1440
|
+
extra_body: Add additional JSON properties to the request
|
|
1441
|
+
|
|
1442
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
1443
|
+
"""
|
|
1444
|
+
if project_id is None:
|
|
1445
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
1446
|
+
if region_id is None:
|
|
1447
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
1448
|
+
if not load_balancer_id:
|
|
1449
|
+
raise ValueError(f"Expected a non-empty value for `load_balancer_id` but received {load_balancer_id!r}")
|
|
1450
|
+
return await self._post(
|
|
1451
|
+
f"/cloud/v1/loadbalancers/{project_id}/{region_id}/{load_balancer_id}/resize",
|
|
1452
|
+
body=await async_maybe_transform({"flavor": flavor}, load_balancer_resize_params.LoadBalancerResizeParams),
|
|
1453
|
+
options=make_request_options(
|
|
1454
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
1455
|
+
),
|
|
1456
|
+
cast_to=TaskIDList,
|
|
1457
|
+
)
|
|
1458
|
+
|
|
1487
1459
|
|
|
1488
1460
|
class LoadBalancersResourceWithRawResponse:
|
|
1489
1461
|
def __init__(self, load_balancers: LoadBalancersResource) -> None:
|