gcore 0.1.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/__init__.py +89 -0
- gcore/_base_client.py +1943 -0
- gcore/_client.py +493 -0
- gcore/_compat.py +219 -0
- gcore/_constants.py +16 -0
- gcore/_exceptions.py +108 -0
- gcore/_files.py +123 -0
- gcore/_models.py +803 -0
- gcore/_qs.py +150 -0
- gcore/_resource.py +43 -0
- gcore/_response.py +830 -0
- gcore/_streaming.py +333 -0
- gcore/_types.py +217 -0
- gcore/_utils/__init__.py +57 -0
- gcore/_utils/_logs.py +25 -0
- gcore/_utils/_proxy.py +65 -0
- gcore/_utils/_reflection.py +42 -0
- gcore/_utils/_resources_proxy.py +24 -0
- gcore/_utils/_streams.py +12 -0
- gcore/_utils/_sync.py +86 -0
- gcore/_utils/_transform.py +447 -0
- gcore/_utils/_typing.py +151 -0
- gcore/_utils/_utils.py +422 -0
- gcore/_version.py +4 -0
- gcore/lib/.keep +4 -0
- gcore/lib/polling.py +19 -0
- gcore/pagination.py +70 -0
- gcore/py.typed +0 -0
- gcore/resources/__init__.py +33 -0
- gcore/resources/cloud/__init__.py +327 -0
- gcore/resources/cloud/baremetal/__init__.py +61 -0
- gcore/resources/cloud/baremetal/baremetal.py +166 -0
- gcore/resources/cloud/baremetal/flavors.py +371 -0
- gcore/resources/cloud/baremetal/images.py +238 -0
- gcore/resources/cloud/baremetal/servers.py +1042 -0
- gcore/resources/cloud/billing_reservations.py +386 -0
- gcore/resources/cloud/cloud.py +774 -0
- gcore/resources/cloud/file_shares/__init__.py +33 -0
- gcore/resources/cloud/file_shares/access_rules.py +434 -0
- gcore/resources/cloud/file_shares/file_shares.py +994 -0
- gcore/resources/cloud/floating_ips.py +765 -0
- gcore/resources/cloud/gpu_baremetal_clusters/__init__.py +75 -0
- gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +211 -0
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +1493 -0
- gcore/resources/cloud/gpu_baremetal_clusters/images.py +785 -0
- gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +175 -0
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +1178 -0
- gcore/resources/cloud/inference/__init__.py +89 -0
- gcore/resources/cloud/inference/deployments/__init__.py +33 -0
- gcore/resources/cloud/inference/deployments/deployments.py +1493 -0
- gcore/resources/cloud/inference/deployments/logs.py +235 -0
- gcore/resources/cloud/inference/flavors.py +280 -0
- gcore/resources/cloud/inference/inference.py +295 -0
- gcore/resources/cloud/inference/models.py +289 -0
- gcore/resources/cloud/inference/registry_credentials.py +649 -0
- gcore/resources/cloud/inference/secrets.py +629 -0
- gcore/resources/cloud/instances/__init__.py +75 -0
- gcore/resources/cloud/instances/flavors.py +449 -0
- gcore/resources/cloud/instances/images.py +1297 -0
- gcore/resources/cloud/instances/instances.py +2821 -0
- gcore/resources/cloud/instances/interfaces.py +797 -0
- gcore/resources/cloud/instances/metrics.py +217 -0
- gcore/resources/cloud/ip_ranges.py +135 -0
- gcore/resources/cloud/load_balancers/__init__.py +103 -0
- gcore/resources/cloud/load_balancers/flavors.py +193 -0
- gcore/resources/cloud/load_balancers/l7_policies/__init__.py +33 -0
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +1020 -0
- gcore/resources/cloud/load_balancers/l7_policies/rules.py +1036 -0
- gcore/resources/cloud/load_balancers/listeners.py +1089 -0
- gcore/resources/cloud/load_balancers/load_balancers.py +1583 -0
- gcore/resources/cloud/load_balancers/metrics.py +205 -0
- gcore/resources/cloud/load_balancers/pools/__init__.py +47 -0
- gcore/resources/cloud/load_balancers/pools/health_monitors.py +352 -0
- gcore/resources/cloud/load_balancers/pools/members.py +353 -0
- gcore/resources/cloud/load_balancers/pools/pools.py +1190 -0
- gcore/resources/cloud/load_balancers/statuses.py +260 -0
- gcore/resources/cloud/networks/__init__.py +47 -0
- gcore/resources/cloud/networks/networks.py +771 -0
- gcore/resources/cloud/networks/routers.py +875 -0
- gcore/resources/cloud/networks/subnets.py +865 -0
- gcore/resources/cloud/placement_groups.py +465 -0
- gcore/resources/cloud/projects.py +608 -0
- gcore/resources/cloud/quotas/__init__.py +33 -0
- gcore/resources/cloud/quotas/quotas.py +335 -0
- gcore/resources/cloud/quotas/requests.py +482 -0
- gcore/resources/cloud/regions.py +328 -0
- gcore/resources/cloud/registries/__init__.py +75 -0
- gcore/resources/cloud/registries/artifacts.py +277 -0
- gcore/resources/cloud/registries/registries.py +688 -0
- gcore/resources/cloud/registries/repositories.py +265 -0
- gcore/resources/cloud/registries/tags.py +190 -0
- gcore/resources/cloud/registries/users.py +701 -0
- gcore/resources/cloud/reserved_fixed_ips/__init__.py +33 -0
- gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +965 -0
- gcore/resources/cloud/reserved_fixed_ips/vip.py +577 -0
- gcore/resources/cloud/secrets.py +797 -0
- gcore/resources/cloud/security_groups/__init__.py +33 -0
- gcore/resources/cloud/security_groups/rules.py +626 -0
- gcore/resources/cloud/security_groups/security_groups.py +863 -0
- gcore/resources/cloud/ssh_keys.py +635 -0
- gcore/resources/cloud/tasks.py +700 -0
- gcore/resources/cloud/users/__init__.py +33 -0
- gcore/resources/cloud/users/role_assignments.py +533 -0
- gcore/resources/cloud/users/users.py +102 -0
- gcore/resources/cloud/volumes.py +1710 -0
- gcore/resources/waap/__init__.py +33 -0
- gcore/resources/waap/domains/__init__.py +33 -0
- gcore/resources/waap/domains/domains.py +515 -0
- gcore/resources/waap/domains/settings.py +271 -0
- gcore/resources/waap/waap.py +102 -0
- gcore/types/__init__.py +3 -0
- gcore/types/cloud/__init__.py +199 -0
- gcore/types/cloud/allowed_address_pairs.py +15 -0
- gcore/types/cloud/aws_iam_data.py +13 -0
- gcore/types/cloud/aws_iam_data_param.py +15 -0
- gcore/types/cloud/baremetal/__init__.py +13 -0
- gcore/types/cloud/baremetal/baremetal_fixed_address.py +30 -0
- gcore/types/cloud/baremetal/baremetal_floating_address.py +15 -0
- gcore/types/cloud/baremetal/baremetal_server.py +178 -0
- gcore/types/cloud/baremetal/flavor_list_params.py +35 -0
- gcore/types/cloud/baremetal/flavor_list_suitable_params.py +22 -0
- gcore/types/cloud/baremetal/image_list_params.py +33 -0
- gcore/types/cloud/baremetal/server_create_params.py +370 -0
- gcore/types/cloud/baremetal/server_list_params.py +114 -0
- gcore/types/cloud/baremetal/server_rebuild_params.py +23 -0
- gcore/types/cloud/baremetal_flavor.py +58 -0
- gcore/types/cloud/baremetal_flavor_list.py +16 -0
- gcore/types/cloud/billing_reservation.py +153 -0
- gcore/types/cloud/billing_reservation_list_params.py +59 -0
- gcore/types/cloud/blackhole_port.py +66 -0
- gcore/types/cloud/capacity.py +13 -0
- gcore/types/cloud/console.py +18 -0
- gcore/types/cloud/container_probe.py +36 -0
- gcore/types/cloud/container_probe_config.py +16 -0
- gcore/types/cloud/container_probe_config_create_param.py +18 -0
- gcore/types/cloud/container_probe_create_param.py +38 -0
- gcore/types/cloud/container_probe_exec.py +12 -0
- gcore/types/cloud/container_probe_exec_create_param.py +13 -0
- gcore/types/cloud/container_probe_http_get.py +26 -0
- gcore/types/cloud/container_probe_http_get_create_param.py +25 -0
- gcore/types/cloud/container_probe_tcp_socket.py +10 -0
- gcore/types/cloud/container_probe_tcp_socket_create_param.py +12 -0
- gcore/types/cloud/container_scale.py +25 -0
- gcore/types/cloud/container_scale_trigger_rate.py +13 -0
- gcore/types/cloud/container_scale_trigger_sqs.py +33 -0
- gcore/types/cloud/container_scale_trigger_threshold.py +10 -0
- gcore/types/cloud/container_scale_triggers.py +36 -0
- gcore/types/cloud/ddos_profile.py +33 -0
- gcore/types/cloud/ddos_profile_field.py +31 -0
- gcore/types/cloud/ddos_profile_option_list.py +15 -0
- gcore/types/cloud/ddos_profile_status.py +13 -0
- gcore/types/cloud/ddos_profile_template.py +18 -0
- gcore/types/cloud/ddos_profile_template_field.py +23 -0
- gcore/types/cloud/deploy_status.py +13 -0
- gcore/types/cloud/file_share.py +111 -0
- gcore/types/cloud/file_share_create_params.py +104 -0
- gcore/types/cloud/file_share_list_params.py +24 -0
- gcore/types/cloud/file_share_resize_params.py +18 -0
- gcore/types/cloud/file_share_update_params.py +18 -0
- gcore/types/cloud/file_shares/__init__.py +7 -0
- gcore/types/cloud/file_shares/access_rule.py +21 -0
- gcore/types/cloud/file_shares/access_rule_create_params.py +21 -0
- gcore/types/cloud/file_shares/access_rule_list.py +16 -0
- gcore/types/cloud/fixed_address.py +38 -0
- gcore/types/cloud/fixed_address_short.py +24 -0
- gcore/types/cloud/flavor_hardware_description.py +27 -0
- gcore/types/cloud/floating_address.py +15 -0
- gcore/types/cloud/floating_ip.py +77 -0
- gcore/types/cloud/floating_ip_assign_params.py +20 -0
- gcore/types/cloud/floating_ip_create_params.py +40 -0
- gcore/types/cloud/floating_ip_detailed.py +222 -0
- gcore/types/cloud/floating_ip_list_params.py +35 -0
- gcore/types/cloud/floating_ip_status.py +7 -0
- gcore/types/cloud/gpu_baremetal_cluster.py +116 -0
- gcore/types/cloud/gpu_baremetal_cluster_create_params.py +155 -0
- gcore/types/cloud/gpu_baremetal_cluster_delete_params.py +28 -0
- gcore/types/cloud/gpu_baremetal_cluster_list_params.py +19 -0
- gcore/types/cloud/gpu_baremetal_cluster_rebuild_params.py +26 -0
- gcore/types/cloud/gpu_baremetal_cluster_resize_params.py +16 -0
- gcore/types/cloud/gpu_baremetal_cluster_server.py +200 -0
- gcore/types/cloud/gpu_baremetal_cluster_server_list.py +16 -0
- gcore/types/cloud/gpu_baremetal_clusters/__init__.py +9 -0
- gcore/types/cloud/gpu_baremetal_clusters/flavor_list_params.py +21 -0
- gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +58 -0
- gcore/types/cloud/gpu_baremetal_clusters/server_attach_interface_params.py +253 -0
- gcore/types/cloud/gpu_baremetal_clusters/server_delete_params.py +21 -0
- gcore/types/cloud/gpu_baremetal_clusters/server_detach_interface_params.py +19 -0
- gcore/types/cloud/gpu_baremetal_flavor.py +133 -0
- gcore/types/cloud/gpu_baremetal_flavor_list.py +16 -0
- gcore/types/cloud/gpu_image.py +70 -0
- gcore/types/cloud/gpu_image_list.py +16 -0
- gcore/types/cloud/health_monitor.py +48 -0
- gcore/types/cloud/health_monitor_status.py +22 -0
- gcore/types/cloud/http_method.py +7 -0
- gcore/types/cloud/image.py +100 -0
- gcore/types/cloud/image_list.py +16 -0
- gcore/types/cloud/inference/__init__.py +25 -0
- gcore/types/cloud/inference/container.py +26 -0
- gcore/types/cloud/inference/deployment_create_params.py +222 -0
- gcore/types/cloud/inference/deployment_list_params.py +21 -0
- gcore/types/cloud/inference/deployment_update_params.py +215 -0
- gcore/types/cloud/inference/deployments/__init__.py +5 -0
- gcore/types/cloud/inference/deployments/log_list_params.py +28 -0
- gcore/types/cloud/inference/flavor_list_params.py +18 -0
- gcore/types/cloud/inference/inference.py +95 -0
- gcore/types/cloud/inference/inference_apikey_secret.py +15 -0
- gcore/types/cloud/inference/inference_flavor.py +34 -0
- gcore/types/cloud/inference/inference_log.py +21 -0
- gcore/types/cloud/inference/inference_registry_credential.py +19 -0
- gcore/types/cloud/inference/inference_registry_credential_full.py +22 -0
- gcore/types/cloud/inference/inference_secret.py +17 -0
- gcore/types/cloud/inference/mlcatalog_model_card.py +65 -0
- gcore/types/cloud/inference/mlcatalog_order_by_choices.py +7 -0
- gcore/types/cloud/inference/model_list_params.py +23 -0
- gcore/types/cloud/inference/registry_credential_create_params.py +24 -0
- gcore/types/cloud/inference/registry_credential_list_params.py +21 -0
- gcore/types/cloud/inference/registry_credential_replace_params.py +21 -0
- gcore/types/cloud/inference/secret_create_params.py +23 -0
- gcore/types/cloud/inference/secret_list_params.py +21 -0
- gcore/types/cloud/inference/secret_replace_params.py +20 -0
- gcore/types/cloud/inference_probes.py +19 -0
- gcore/types/cloud/ingress_opts_out.py +16 -0
- gcore/types/cloud/ingress_opts_param.py +18 -0
- gcore/types/cloud/instance.py +296 -0
- gcore/types/cloud/instance_action_params.py +32 -0
- gcore/types/cloud/instance_add_to_placement_group_params.py +16 -0
- gcore/types/cloud/instance_assign_security_group_params.py +28 -0
- gcore/types/cloud/instance_create_params.py +622 -0
- gcore/types/cloud/instance_delete_params.py +33 -0
- gcore/types/cloud/instance_get_console_params.py +16 -0
- gcore/types/cloud/instance_interface.py +40 -0
- gcore/types/cloud/instance_isolation.py +12 -0
- gcore/types/cloud/instance_list.py +16 -0
- gcore/types/cloud/instance_list_params.py +146 -0
- gcore/types/cloud/instance_metrics_time_unit.py +7 -0
- gcore/types/cloud/instance_resize_params.py +16 -0
- gcore/types/cloud/instance_unassign_security_group_params.py +28 -0
- gcore/types/cloud/instance_update_params.py +18 -0
- gcore/types/cloud/instances/__init__.py +19 -0
- gcore/types/cloud/instances/flavor_list_for_resize_params.py +16 -0
- gcore/types/cloud/instances/flavor_list_params.py +25 -0
- gcore/types/cloud/instances/flavor_list_suitable_params.py +56 -0
- gcore/types/cloud/instances/image_create_from_volume_params.py +53 -0
- gcore/types/cloud/instances/image_get_params.py +16 -0
- gcore/types/cloud/instances/image_list_params.py +33 -0
- gcore/types/cloud/instances/image_update_params.py +43 -0
- gcore/types/cloud/instances/image_upload_params.py +62 -0
- gcore/types/cloud/instances/instance_flavor.py +49 -0
- gcore/types/cloud/instances/instance_flavor_list.py +16 -0
- gcore/types/cloud/instances/interface_attach_params.py +253 -0
- gcore/types/cloud/instances/interface_detach_params.py +19 -0
- gcore/types/cloud/instances/metric_list_params.py +23 -0
- gcore/types/cloud/instances/metrics.py +52 -0
- gcore/types/cloud/instances/metrics_list.py +16 -0
- gcore/types/cloud/interface_ip_family.py +7 -0
- gcore/types/cloud/ip_assignment.py +13 -0
- gcore/types/cloud/ip_ranges.py +12 -0
- gcore/types/cloud/ip_version.py +7 -0
- gcore/types/cloud/laas_index_retention_policy.py +12 -0
- gcore/types/cloud/laas_index_retention_policy_param.py +13 -0
- gcore/types/cloud/lb_algorithm.py +7 -0
- gcore/types/cloud/lb_health_monitor_type.py +7 -0
- gcore/types/cloud/lb_listener_protocol.py +7 -0
- gcore/types/cloud/lb_pool_protocol.py +7 -0
- gcore/types/cloud/lb_session_persistence_type.py +7 -0
- gcore/types/cloud/listener_status.py +27 -0
- gcore/types/cloud/load_balancer.py +144 -0
- gcore/types/cloud/load_balancer_create_params.py +327 -0
- gcore/types/cloud/load_balancer_failover_params.py +16 -0
- gcore/types/cloud/load_balancer_flavor_detail.py +40 -0
- gcore/types/cloud/load_balancer_flavor_list.py +16 -0
- gcore/types/cloud/load_balancer_get_params.py +19 -0
- gcore/types/cloud/load_balancer_instance_role.py +7 -0
- gcore/types/cloud/load_balancer_l7_policy.py +86 -0
- gcore/types/cloud/load_balancer_l7_policy_list.py +16 -0
- gcore/types/cloud/load_balancer_l7_rule.py +72 -0
- gcore/types/cloud/load_balancer_l7_rule_list.py +16 -0
- gcore/types/cloud/load_balancer_list_params.py +53 -0
- gcore/types/cloud/load_balancer_listener_detail.py +97 -0
- gcore/types/cloud/load_balancer_listener_list.py +16 -0
- gcore/types/cloud/load_balancer_member_connectivity.py +7 -0
- gcore/types/cloud/load_balancer_metrics.py +32 -0
- gcore/types/cloud/load_balancer_metrics_list.py +16 -0
- gcore/types/cloud/load_balancer_operating_status.py +7 -0
- gcore/types/cloud/load_balancer_pool.py +87 -0
- gcore/types/cloud/load_balancer_pool_list.py +16 -0
- gcore/types/cloud/load_balancer_resize_params.py +16 -0
- gcore/types/cloud/load_balancer_statistics.py +22 -0
- gcore/types/cloud/load_balancer_status.py +38 -0
- gcore/types/cloud/load_balancer_status_list.py +16 -0
- gcore/types/cloud/load_balancer_update_params.py +43 -0
- gcore/types/cloud/load_balancers/__init__.py +15 -0
- gcore/types/cloud/load_balancers/flavor_list_params.py +16 -0
- gcore/types/cloud/load_balancers/l7_policies/__init__.py +6 -0
- gcore/types/cloud/load_balancers/l7_policies/rule_create_params.py +50 -0
- gcore/types/cloud/load_balancers/l7_policies/rule_replace_params.py +43 -0
- gcore/types/cloud/load_balancers/l7_policy_create_params.py +54 -0
- gcore/types/cloud/load_balancers/l7_policy_replace_params.py +51 -0
- gcore/types/cloud/load_balancers/listener_create_params.py +72 -0
- gcore/types/cloud/load_balancers/listener_get_params.py +16 -0
- gcore/types/cloud/load_balancers/listener_list_params.py +19 -0
- gcore/types/cloud/load_balancers/listener_update_params.py +55 -0
- gcore/types/cloud/load_balancers/metric_list_params.py +21 -0
- gcore/types/cloud/load_balancers/pool_create_params.py +141 -0
- gcore/types/cloud/load_balancers/pool_list_params.py +25 -0
- gcore/types/cloud/load_balancers/pool_update_params.py +139 -0
- gcore/types/cloud/load_balancers/pools/__init__.py +6 -0
- gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +49 -0
- gcore/types/cloud/load_balancers/pools/member_add_params.py +44 -0
- gcore/types/cloud/logging.py +22 -0
- gcore/types/cloud/member.py +47 -0
- gcore/types/cloud/member_status.py +24 -0
- gcore/types/cloud/network.py +79 -0
- gcore/types/cloud/network_create_params.py +36 -0
- gcore/types/cloud/network_details.py +80 -0
- gcore/types/cloud/network_interface.py +78 -0
- gcore/types/cloud/network_interface_list.py +16 -0
- gcore/types/cloud/network_list_params.py +41 -0
- gcore/types/cloud/network_update_params.py +18 -0
- gcore/types/cloud/networks/__init__.py +14 -0
- gcore/types/cloud/networks/router.py +83 -0
- gcore/types/cloud/networks/router_attach_subnet_params.py +24 -0
- gcore/types/cloud/networks/router_create_params.py +75 -0
- gcore/types/cloud/networks/router_detach_subnet_params.py +16 -0
- gcore/types/cloud/networks/router_list.py +16 -0
- gcore/types/cloud/networks/router_list_params.py +19 -0
- gcore/types/cloud/networks/router_update_params.py +45 -0
- gcore/types/cloud/networks/subnet_create_params.py +82 -0
- gcore/types/cloud/networks/subnet_list_params.py +58 -0
- gcore/types/cloud/networks/subnet_update_params.py +47 -0
- gcore/types/cloud/placement_group.py +41 -0
- gcore/types/cloud/placement_group_create_params.py +19 -0
- gcore/types/cloud/placement_group_list.py +16 -0
- gcore/types/cloud/pool_status.py +31 -0
- gcore/types/cloud/project.py +47 -0
- gcore/types/cloud/project_create_params.py +22 -0
- gcore/types/cloud/project_list_params.py +27 -0
- gcore/types/cloud/project_replace_params.py +18 -0
- gcore/types/cloud/provisioning_status.py +9 -0
- gcore/types/cloud/quota_get_all_response.py +340 -0
- gcore/types/cloud/quota_get_by_region_response.py +288 -0
- gcore/types/cloud/quota_get_global_response.py +51 -0
- gcore/types/cloud/quotas/__init__.py +8 -0
- gcore/types/cloud/quotas/request_create_params.py +193 -0
- gcore/types/cloud/quotas/request_get_response.py +205 -0
- gcore/types/cloud/quotas/request_list_params.py +22 -0
- gcore/types/cloud/quotas/request_list_response.py +205 -0
- gcore/types/cloud/region.py +101 -0
- gcore/types/cloud/region_capacity.py +16 -0
- gcore/types/cloud/region_capacity_list.py +16 -0
- gcore/types/cloud/region_get_params.py +18 -0
- gcore/types/cloud/region_list_params.py +31 -0
- gcore/types/cloud/registries/__init__.py +14 -0
- gcore/types/cloud/registries/registry_artifact.py +35 -0
- gcore/types/cloud/registries/registry_artifact_list.py +16 -0
- gcore/types/cloud/registries/registry_repository.py +30 -0
- gcore/types/cloud/registries/registry_repository_list.py +16 -0
- gcore/types/cloud/registries/registry_user.py +28 -0
- gcore/types/cloud/registries/registry_user_created.py +31 -0
- gcore/types/cloud/registries/registry_user_list.py +16 -0
- gcore/types/cloud/registries/user_create_multiple_params.py +36 -0
- gcore/types/cloud/registries/user_create_params.py +30 -0
- gcore/types/cloud/registries/user_update_params.py +21 -0
- gcore/types/cloud/registry.py +33 -0
- gcore/types/cloud/registry_create_params.py +24 -0
- gcore/types/cloud/registry_list.py +16 -0
- gcore/types/cloud/registry_resize_params.py +16 -0
- gcore/types/cloud/registry_tag.py +27 -0
- gcore/types/cloud/reserved_fixed_ip.py +98 -0
- gcore/types/cloud/reserved_fixed_ip_create_params.py +107 -0
- gcore/types/cloud/reserved_fixed_ip_list_params.py +47 -0
- gcore/types/cloud/reserved_fixed_ips/__init__.py +12 -0
- gcore/types/cloud/reserved_fixed_ips/candidate_port.py +26 -0
- gcore/types/cloud/reserved_fixed_ips/candidate_port_list.py +16 -0
- gcore/types/cloud/reserved_fixed_ips/connected_port.py +26 -0
- gcore/types/cloud/reserved_fixed_ips/connected_port_list.py +16 -0
- gcore/types/cloud/reserved_fixed_ips/ip_with_subnet.py +17 -0
- gcore/types/cloud/reserved_fixed_ips/vip_replace_connected_ports_params.py +17 -0
- gcore/types/cloud/reserved_fixed_ips/vip_toggle_params.py +16 -0
- gcore/types/cloud/reserved_fixed_ips/vip_update_connected_ports_params.py +17 -0
- gcore/types/cloud/route.py +16 -0
- gcore/types/cloud/secret.py +64 -0
- gcore/types/cloud/secret_create_params.py +66 -0
- gcore/types/cloud/secret_list_response.py +16 -0
- gcore/types/cloud/secret_upload_tls_certificate_params.py +39 -0
- gcore/types/cloud/security_group.py +45 -0
- gcore/types/cloud/security_group_copy_params.py +16 -0
- gcore/types/cloud/security_group_create_params.py +94 -0
- gcore/types/cloud/security_group_list_params.py +30 -0
- gcore/types/cloud/security_group_rule.py +83 -0
- gcore/types/cloud/security_group_update_params.py +83 -0
- gcore/types/cloud/security_groups/__init__.py +6 -0
- gcore/types/cloud/security_groups/rule_create_params.py +65 -0
- gcore/types/cloud/security_groups/rule_replace_params.py +72 -0
- gcore/types/cloud/session_persistence.py +22 -0
- gcore/types/cloud/ssh_key.py +39 -0
- gcore/types/cloud/ssh_key_create_params.py +31 -0
- gcore/types/cloud/ssh_key_created.py +53 -0
- gcore/types/cloud/ssh_key_list_params.py +21 -0
- gcore/types/cloud/ssh_key_update_params.py +15 -0
- gcore/types/cloud/subnet.py +87 -0
- gcore/types/cloud/tag.py +16 -0
- gcore/types/cloud/tag_update_map_param.py +10 -0
- gcore/types/cloud/task.py +191 -0
- gcore/types/cloud/task_acknowledge_all_params.py +16 -0
- gcore/types/cloud/task_id_list.py +12 -0
- gcore/types/cloud/task_list_params.py +104 -0
- gcore/types/cloud/users/__init__.py +9 -0
- gcore/types/cloud/users/role_assignment.py +33 -0
- gcore/types/cloud/users/role_assignment_create_params.py +22 -0
- gcore/types/cloud/users/role_assignment_list_params.py +25 -0
- gcore/types/cloud/users/role_assignment_update_delete.py +10 -0
- gcore/types/cloud/users/role_assignment_update_params.py +22 -0
- gcore/types/cloud/volume.py +141 -0
- gcore/types/cloud/volume_attach_to_instance_params.py +21 -0
- gcore/types/cloud/volume_change_type_params.py +18 -0
- gcore/types/cloud/volume_create_params.py +176 -0
- gcore/types/cloud/volume_delete_params.py +18 -0
- gcore/types/cloud/volume_detach_from_instance_params.py +18 -0
- gcore/types/cloud/volume_list_params.py +56 -0
- gcore/types/cloud/volume_resize_params.py +18 -0
- gcore/types/cloud/volume_update_params.py +18 -0
- gcore/types/waap/__init__.py +12 -0
- gcore/types/waap/domain_list_params.py +30 -0
- gcore/types/waap/domain_update_params.py +12 -0
- gcore/types/waap/domains/__init__.py +5 -0
- gcore/types/waap/domains/setting_update_params.py +41 -0
- gcore/types/waap/waap_api_urls.py +15 -0
- gcore/types/waap/waap_detailed_domain.py +37 -0
- gcore/types/waap/waap_domain_ddos_settings.py +31 -0
- gcore/types/waap/waap_domain_settings.py +15 -0
- gcore/types/waap/waap_domain_status.py +7 -0
- gcore/types/waap/waap_summary_domain.py +26 -0
- gcore-0.1.0.dist-info/METADATA +482 -0
- gcore-0.1.0.dist-info/RECORD +437 -0
- gcore-0.1.0.dist-info/WHEEL +4 -0
- gcore-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,1020 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import List
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from .rules import (
|
|
11
|
+
RulesResource,
|
|
12
|
+
AsyncRulesResource,
|
|
13
|
+
RulesResourceWithRawResponse,
|
|
14
|
+
AsyncRulesResourceWithRawResponse,
|
|
15
|
+
RulesResourceWithStreamingResponse,
|
|
16
|
+
AsyncRulesResourceWithStreamingResponse,
|
|
17
|
+
)
|
|
18
|
+
from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
19
|
+
from ....._utils import maybe_transform, async_maybe_transform
|
|
20
|
+
from ....._compat import cached_property
|
|
21
|
+
from ....._resource import SyncAPIResource, AsyncAPIResource
|
|
22
|
+
from ....._response import (
|
|
23
|
+
to_raw_response_wrapper,
|
|
24
|
+
to_streamed_response_wrapper,
|
|
25
|
+
async_to_raw_response_wrapper,
|
|
26
|
+
async_to_streamed_response_wrapper,
|
|
27
|
+
)
|
|
28
|
+
from ....._base_client import make_request_options
|
|
29
|
+
from .....types.cloud.task_id_list import TaskIDList
|
|
30
|
+
from .....types.cloud.load_balancers import l7_policy_create_params, l7_policy_replace_params
|
|
31
|
+
from .....types.cloud.load_balancer_l7_policy import LoadBalancerL7Policy
|
|
32
|
+
from .....types.cloud.load_balancer_l7_policy_list import LoadBalancerL7PolicyList
|
|
33
|
+
|
|
34
|
+
__all__ = ["L7PoliciesResource", "AsyncL7PoliciesResource"]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class L7PoliciesResource(SyncAPIResource):
|
|
38
|
+
@cached_property
|
|
39
|
+
def rules(self) -> RulesResource:
|
|
40
|
+
return RulesResource(self._client)
|
|
41
|
+
|
|
42
|
+
@cached_property
|
|
43
|
+
def with_raw_response(self) -> L7PoliciesResourceWithRawResponse:
|
|
44
|
+
"""
|
|
45
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
46
|
+
the raw response object instead of the parsed content.
|
|
47
|
+
|
|
48
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
49
|
+
"""
|
|
50
|
+
return L7PoliciesResourceWithRawResponse(self)
|
|
51
|
+
|
|
52
|
+
@cached_property
|
|
53
|
+
def with_streaming_response(self) -> L7PoliciesResourceWithStreamingResponse:
|
|
54
|
+
"""
|
|
55
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
56
|
+
|
|
57
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
58
|
+
"""
|
|
59
|
+
return L7PoliciesResourceWithStreamingResponse(self)
|
|
60
|
+
|
|
61
|
+
def create(
|
|
62
|
+
self,
|
|
63
|
+
*,
|
|
64
|
+
project_id: int | None = None,
|
|
65
|
+
region_id: int | None = None,
|
|
66
|
+
action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"],
|
|
67
|
+
listener_id: str,
|
|
68
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
69
|
+
position: int | NotGiven = NOT_GIVEN,
|
|
70
|
+
redirect_http_code: int | NotGiven = NOT_GIVEN,
|
|
71
|
+
redirect_pool_id: str | NotGiven = NOT_GIVEN,
|
|
72
|
+
redirect_prefix: str | NotGiven = NOT_GIVEN,
|
|
73
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
74
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
75
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
76
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
77
|
+
extra_headers: Headers | None = None,
|
|
78
|
+
extra_query: Query | None = None,
|
|
79
|
+
extra_body: Body | None = None,
|
|
80
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
81
|
+
) -> TaskIDList:
|
|
82
|
+
"""
|
|
83
|
+
Create load balancer L7 policy
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
action: Action
|
|
87
|
+
|
|
88
|
+
listener_id: Listener ID
|
|
89
|
+
|
|
90
|
+
name: Human-readable name of the policy
|
|
91
|
+
|
|
92
|
+
position: The position of this policy on the listener. Positions start at 1.
|
|
93
|
+
|
|
94
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
95
|
+
URL with the HTTP response code. Valid if action is REDIRECT_TO_URL or
|
|
96
|
+
REDIRECT_PREFIX. Valid options are 301, 302, 303, 307, or 308. Default is 302.
|
|
97
|
+
|
|
98
|
+
redirect_pool_id: Requests matching this policy will be redirected to the pool withthis ID. Only
|
|
99
|
+
valid if action is REDIRECT_TO_POOL.
|
|
100
|
+
|
|
101
|
+
redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid
|
|
102
|
+
if action is REDIRECT_PREFIX.
|
|
103
|
+
|
|
104
|
+
redirect_url: Requests matching this policy will be redirected to this URL. Only valid if
|
|
105
|
+
action is REDIRECT_TO_URL.
|
|
106
|
+
|
|
107
|
+
tags: A list of simple strings assigned to the resource.
|
|
108
|
+
|
|
109
|
+
extra_headers: Send extra headers
|
|
110
|
+
|
|
111
|
+
extra_query: Add additional query parameters to the request
|
|
112
|
+
|
|
113
|
+
extra_body: Add additional JSON properties to the request
|
|
114
|
+
|
|
115
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
116
|
+
"""
|
|
117
|
+
if project_id is None:
|
|
118
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
119
|
+
if region_id is None:
|
|
120
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
121
|
+
return self._post(
|
|
122
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}",
|
|
123
|
+
body=maybe_transform(
|
|
124
|
+
{
|
|
125
|
+
"action": action,
|
|
126
|
+
"listener_id": listener_id,
|
|
127
|
+
"name": name,
|
|
128
|
+
"position": position,
|
|
129
|
+
"redirect_http_code": redirect_http_code,
|
|
130
|
+
"redirect_pool_id": redirect_pool_id,
|
|
131
|
+
"redirect_prefix": redirect_prefix,
|
|
132
|
+
"redirect_url": redirect_url,
|
|
133
|
+
"tags": tags,
|
|
134
|
+
},
|
|
135
|
+
l7_policy_create_params.L7PolicyCreateParams,
|
|
136
|
+
),
|
|
137
|
+
options=make_request_options(
|
|
138
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
139
|
+
),
|
|
140
|
+
cast_to=TaskIDList,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
def list(
|
|
144
|
+
self,
|
|
145
|
+
*,
|
|
146
|
+
project_id: int | None = None,
|
|
147
|
+
region_id: int | None = None,
|
|
148
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
149
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
150
|
+
extra_headers: Headers | None = None,
|
|
151
|
+
extra_query: Query | None = None,
|
|
152
|
+
extra_body: Body | None = None,
|
|
153
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
154
|
+
) -> LoadBalancerL7PolicyList:
|
|
155
|
+
"""
|
|
156
|
+
List load balancer L7 policies
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
extra_headers: Send extra headers
|
|
160
|
+
|
|
161
|
+
extra_query: Add additional query parameters to the request
|
|
162
|
+
|
|
163
|
+
extra_body: Add additional JSON properties to the request
|
|
164
|
+
|
|
165
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
166
|
+
"""
|
|
167
|
+
if project_id is None:
|
|
168
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
169
|
+
if region_id is None:
|
|
170
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
171
|
+
return self._get(
|
|
172
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}",
|
|
173
|
+
options=make_request_options(
|
|
174
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
175
|
+
),
|
|
176
|
+
cast_to=LoadBalancerL7PolicyList,
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
def delete(
|
|
180
|
+
self,
|
|
181
|
+
l7policy_id: str,
|
|
182
|
+
*,
|
|
183
|
+
project_id: int | None = None,
|
|
184
|
+
region_id: int | None = None,
|
|
185
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
186
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
187
|
+
extra_headers: Headers | None = None,
|
|
188
|
+
extra_query: Query | None = None,
|
|
189
|
+
extra_body: Body | None = None,
|
|
190
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
191
|
+
) -> TaskIDList:
|
|
192
|
+
"""
|
|
193
|
+
Delete load balancer L7 policy
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
extra_headers: Send extra headers
|
|
197
|
+
|
|
198
|
+
extra_query: Add additional query parameters to the request
|
|
199
|
+
|
|
200
|
+
extra_body: Add additional JSON properties to the request
|
|
201
|
+
|
|
202
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
203
|
+
"""
|
|
204
|
+
if project_id is None:
|
|
205
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
206
|
+
if region_id is None:
|
|
207
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
208
|
+
if not l7policy_id:
|
|
209
|
+
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
210
|
+
return self._delete(
|
|
211
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
212
|
+
options=make_request_options(
|
|
213
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
214
|
+
),
|
|
215
|
+
cast_to=TaskIDList,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
def get(
|
|
219
|
+
self,
|
|
220
|
+
l7policy_id: str,
|
|
221
|
+
*,
|
|
222
|
+
project_id: int | None = None,
|
|
223
|
+
region_id: int | None = None,
|
|
224
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
225
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
226
|
+
extra_headers: Headers | None = None,
|
|
227
|
+
extra_query: Query | None = None,
|
|
228
|
+
extra_body: Body | None = None,
|
|
229
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
230
|
+
) -> LoadBalancerL7Policy:
|
|
231
|
+
"""
|
|
232
|
+
Get load balancer L7 policy
|
|
233
|
+
|
|
234
|
+
Args:
|
|
235
|
+
extra_headers: Send extra headers
|
|
236
|
+
|
|
237
|
+
extra_query: Add additional query parameters to the request
|
|
238
|
+
|
|
239
|
+
extra_body: Add additional JSON properties to the request
|
|
240
|
+
|
|
241
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
242
|
+
"""
|
|
243
|
+
if project_id is None:
|
|
244
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
245
|
+
if region_id is None:
|
|
246
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
247
|
+
if not l7policy_id:
|
|
248
|
+
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
249
|
+
return self._get(
|
|
250
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
251
|
+
options=make_request_options(
|
|
252
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
253
|
+
),
|
|
254
|
+
cast_to=LoadBalancerL7Policy,
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
def replace(
|
|
258
|
+
self,
|
|
259
|
+
l7policy_id: str,
|
|
260
|
+
*,
|
|
261
|
+
project_id: int | None = None,
|
|
262
|
+
region_id: int | None = None,
|
|
263
|
+
action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"],
|
|
264
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
265
|
+
position: int | NotGiven = NOT_GIVEN,
|
|
266
|
+
redirect_http_code: int | NotGiven = NOT_GIVEN,
|
|
267
|
+
redirect_pool_id: str | NotGiven = NOT_GIVEN,
|
|
268
|
+
redirect_prefix: str | NotGiven = NOT_GIVEN,
|
|
269
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
270
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
271
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
272
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
273
|
+
extra_headers: Headers | None = None,
|
|
274
|
+
extra_query: Query | None = None,
|
|
275
|
+
extra_body: Body | None = None,
|
|
276
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
277
|
+
) -> TaskIDList:
|
|
278
|
+
"""
|
|
279
|
+
Replace load balancer L7 policy properties
|
|
280
|
+
|
|
281
|
+
Args:
|
|
282
|
+
action: Action
|
|
283
|
+
|
|
284
|
+
name: Human-readable name of the policy
|
|
285
|
+
|
|
286
|
+
position: The position of this policy on the listener. Positions start at 1.
|
|
287
|
+
|
|
288
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
289
|
+
URL with the HTTP response code. Valid if action is REDIRECT_TO_URL or
|
|
290
|
+
REDIRECT_PREFIX. Valid options are 301, 302, 303, 307, or 308. Default is 302.
|
|
291
|
+
|
|
292
|
+
redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. Only
|
|
293
|
+
valid if action is REDIRECT_TO_POOL.
|
|
294
|
+
|
|
295
|
+
redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid
|
|
296
|
+
if action is REDIRECT_PREFIX.
|
|
297
|
+
|
|
298
|
+
redirect_url: Requests matching this policy will be redirected to this URL. Only valid if
|
|
299
|
+
action is REDIRECT_TO_URL.
|
|
300
|
+
|
|
301
|
+
tags: A list of simple strings assigned to the resource.
|
|
302
|
+
|
|
303
|
+
extra_headers: Send extra headers
|
|
304
|
+
|
|
305
|
+
extra_query: Add additional query parameters to the request
|
|
306
|
+
|
|
307
|
+
extra_body: Add additional JSON properties to the request
|
|
308
|
+
|
|
309
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
310
|
+
"""
|
|
311
|
+
if project_id is None:
|
|
312
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
313
|
+
if region_id is None:
|
|
314
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
315
|
+
if not l7policy_id:
|
|
316
|
+
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
317
|
+
return self._put(
|
|
318
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
319
|
+
body=maybe_transform(
|
|
320
|
+
{
|
|
321
|
+
"action": action,
|
|
322
|
+
"name": name,
|
|
323
|
+
"position": position,
|
|
324
|
+
"redirect_http_code": redirect_http_code,
|
|
325
|
+
"redirect_pool_id": redirect_pool_id,
|
|
326
|
+
"redirect_prefix": redirect_prefix,
|
|
327
|
+
"redirect_url": redirect_url,
|
|
328
|
+
"tags": tags,
|
|
329
|
+
},
|
|
330
|
+
l7_policy_replace_params.L7PolicyReplaceParams,
|
|
331
|
+
),
|
|
332
|
+
options=make_request_options(
|
|
333
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
334
|
+
),
|
|
335
|
+
cast_to=TaskIDList,
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
def create_and_poll(
|
|
339
|
+
self,
|
|
340
|
+
*,
|
|
341
|
+
project_id: int | None = None,
|
|
342
|
+
region_id: int | None = None,
|
|
343
|
+
action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"],
|
|
344
|
+
listener_id: str,
|
|
345
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
346
|
+
position: int | NotGiven = NOT_GIVEN,
|
|
347
|
+
redirect_http_code: int | NotGiven = NOT_GIVEN,
|
|
348
|
+
redirect_pool_id: str | NotGiven = NOT_GIVEN,
|
|
349
|
+
redirect_prefix: str | NotGiven = NOT_GIVEN,
|
|
350
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
351
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
352
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
353
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
354
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
355
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
356
|
+
extra_headers: Headers | None = None,
|
|
357
|
+
extra_query: Query | None = None,
|
|
358
|
+
extra_body: Body | None = None,
|
|
359
|
+
) -> LoadBalancerL7Policy:
|
|
360
|
+
response = self.create(
|
|
361
|
+
project_id=project_id,
|
|
362
|
+
region_id=region_id,
|
|
363
|
+
action=action,
|
|
364
|
+
listener_id=listener_id,
|
|
365
|
+
name=name,
|
|
366
|
+
position=position,
|
|
367
|
+
redirect_http_code=redirect_http_code,
|
|
368
|
+
redirect_pool_id=redirect_pool_id,
|
|
369
|
+
redirect_prefix=redirect_prefix,
|
|
370
|
+
redirect_url=redirect_url,
|
|
371
|
+
tags=tags,
|
|
372
|
+
extra_headers=extra_headers,
|
|
373
|
+
extra_query=extra_query,
|
|
374
|
+
extra_body=extra_body,
|
|
375
|
+
timeout=timeout,
|
|
376
|
+
)
|
|
377
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
378
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
379
|
+
task = self._client.cloud.tasks.poll(
|
|
380
|
+
task_id=response.tasks[0],
|
|
381
|
+
extra_headers=extra_headers,
|
|
382
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
383
|
+
)
|
|
384
|
+
if not task.created_resources or not task.created_resources.l7polices or len(task.created_resources.l7polices) != 1:
|
|
385
|
+
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
386
|
+
return self.get(
|
|
387
|
+
l7policy_id=task.created_resources.l7polices[0],
|
|
388
|
+
project_id=project_id,
|
|
389
|
+
region_id=region_id,
|
|
390
|
+
extra_headers=extra_headers,
|
|
391
|
+
timeout=timeout,
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
def delete_and_poll(
|
|
395
|
+
self,
|
|
396
|
+
l7policy_id: str,
|
|
397
|
+
*,
|
|
398
|
+
project_id: int | None = None,
|
|
399
|
+
region_id: int | None = None,
|
|
400
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
401
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
402
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
403
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
404
|
+
extra_headers: Headers | None = None,
|
|
405
|
+
extra_query: Query | None = None,
|
|
406
|
+
extra_body: Body | None = None,
|
|
407
|
+
) -> None:
|
|
408
|
+
response = self.delete(
|
|
409
|
+
l7policy_id=l7policy_id,
|
|
410
|
+
project_id=project_id,
|
|
411
|
+
region_id=region_id,
|
|
412
|
+
extra_headers=extra_headers,
|
|
413
|
+
extra_query=extra_query,
|
|
414
|
+
extra_body=extra_body,
|
|
415
|
+
timeout=timeout,
|
|
416
|
+
)
|
|
417
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
418
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
419
|
+
self._client.cloud.tasks.poll(
|
|
420
|
+
task_id=response.tasks[0],
|
|
421
|
+
extra_headers=extra_headers,
|
|
422
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
def replace_and_poll(
|
|
426
|
+
self,
|
|
427
|
+
l7policy_id: str,
|
|
428
|
+
*,
|
|
429
|
+
project_id: int | None = None,
|
|
430
|
+
region_id: int | None = None,
|
|
431
|
+
action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"],
|
|
432
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
433
|
+
position: int | NotGiven = NOT_GIVEN,
|
|
434
|
+
redirect_http_code: int | NotGiven = NOT_GIVEN,
|
|
435
|
+
redirect_pool_id: str | NotGiven = NOT_GIVEN,
|
|
436
|
+
redirect_prefix: str | NotGiven = NOT_GIVEN,
|
|
437
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
438
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
439
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
440
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
441
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
442
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
443
|
+
extra_headers: Headers | None = None,
|
|
444
|
+
extra_query: Query | None = None,
|
|
445
|
+
extra_body: Body | None = None,
|
|
446
|
+
) -> LoadBalancerL7Policy:
|
|
447
|
+
response = self.replace(
|
|
448
|
+
l7policy_id=l7policy_id,
|
|
449
|
+
project_id=project_id,
|
|
450
|
+
region_id=region_id,
|
|
451
|
+
action=action,
|
|
452
|
+
name=name,
|
|
453
|
+
position=position,
|
|
454
|
+
redirect_http_code=redirect_http_code,
|
|
455
|
+
redirect_pool_id=redirect_pool_id,
|
|
456
|
+
redirect_prefix=redirect_prefix,
|
|
457
|
+
redirect_url=redirect_url,
|
|
458
|
+
tags=tags,
|
|
459
|
+
extra_headers=extra_headers,
|
|
460
|
+
extra_query=extra_query,
|
|
461
|
+
extra_body=extra_body,
|
|
462
|
+
timeout=timeout,
|
|
463
|
+
)
|
|
464
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
465
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
466
|
+
self._client.cloud.tasks.poll(
|
|
467
|
+
task_id=response.tasks[0],
|
|
468
|
+
extra_headers=extra_headers,
|
|
469
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
470
|
+
)
|
|
471
|
+
return self.get(
|
|
472
|
+
l7policy_id=l7policy_id,
|
|
473
|
+
project_id=project_id,
|
|
474
|
+
region_id=region_id,
|
|
475
|
+
extra_headers=extra_headers,
|
|
476
|
+
timeout=timeout,
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
class AsyncL7PoliciesResource(AsyncAPIResource):
|
|
481
|
+
@cached_property
|
|
482
|
+
def rules(self) -> AsyncRulesResource:
|
|
483
|
+
return AsyncRulesResource(self._client)
|
|
484
|
+
|
|
485
|
+
@cached_property
|
|
486
|
+
def with_raw_response(self) -> AsyncL7PoliciesResourceWithRawResponse:
|
|
487
|
+
"""
|
|
488
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
489
|
+
the raw response object instead of the parsed content.
|
|
490
|
+
|
|
491
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
492
|
+
"""
|
|
493
|
+
return AsyncL7PoliciesResourceWithRawResponse(self)
|
|
494
|
+
|
|
495
|
+
@cached_property
|
|
496
|
+
def with_streaming_response(self) -> AsyncL7PoliciesResourceWithStreamingResponse:
|
|
497
|
+
"""
|
|
498
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
499
|
+
|
|
500
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
501
|
+
"""
|
|
502
|
+
return AsyncL7PoliciesResourceWithStreamingResponse(self)
|
|
503
|
+
|
|
504
|
+
async def create(
|
|
505
|
+
self,
|
|
506
|
+
*,
|
|
507
|
+
project_id: int | None = None,
|
|
508
|
+
region_id: int | None = None,
|
|
509
|
+
action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"],
|
|
510
|
+
listener_id: str,
|
|
511
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
512
|
+
position: int | NotGiven = NOT_GIVEN,
|
|
513
|
+
redirect_http_code: int | NotGiven = NOT_GIVEN,
|
|
514
|
+
redirect_pool_id: str | NotGiven = NOT_GIVEN,
|
|
515
|
+
redirect_prefix: str | NotGiven = NOT_GIVEN,
|
|
516
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
517
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
518
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
519
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
520
|
+
extra_headers: Headers | None = None,
|
|
521
|
+
extra_query: Query | None = None,
|
|
522
|
+
extra_body: Body | None = None,
|
|
523
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
524
|
+
) -> TaskIDList:
|
|
525
|
+
"""
|
|
526
|
+
Create load balancer L7 policy
|
|
527
|
+
|
|
528
|
+
Args:
|
|
529
|
+
action: Action
|
|
530
|
+
|
|
531
|
+
listener_id: Listener ID
|
|
532
|
+
|
|
533
|
+
name: Human-readable name of the policy
|
|
534
|
+
|
|
535
|
+
position: The position of this policy on the listener. Positions start at 1.
|
|
536
|
+
|
|
537
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
538
|
+
URL with the HTTP response code. Valid if action is REDIRECT_TO_URL or
|
|
539
|
+
REDIRECT_PREFIX. Valid options are 301, 302, 303, 307, or 308. Default is 302.
|
|
540
|
+
|
|
541
|
+
redirect_pool_id: Requests matching this policy will be redirected to the pool withthis ID. Only
|
|
542
|
+
valid if action is REDIRECT_TO_POOL.
|
|
543
|
+
|
|
544
|
+
redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid
|
|
545
|
+
if action is REDIRECT_PREFIX.
|
|
546
|
+
|
|
547
|
+
redirect_url: Requests matching this policy will be redirected to this URL. Only valid if
|
|
548
|
+
action is REDIRECT_TO_URL.
|
|
549
|
+
|
|
550
|
+
tags: A list of simple strings assigned to the resource.
|
|
551
|
+
|
|
552
|
+
extra_headers: Send extra headers
|
|
553
|
+
|
|
554
|
+
extra_query: Add additional query parameters to the request
|
|
555
|
+
|
|
556
|
+
extra_body: Add additional JSON properties to the request
|
|
557
|
+
|
|
558
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
559
|
+
"""
|
|
560
|
+
if project_id is None:
|
|
561
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
562
|
+
if region_id is None:
|
|
563
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
564
|
+
return await self._post(
|
|
565
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}",
|
|
566
|
+
body=await async_maybe_transform(
|
|
567
|
+
{
|
|
568
|
+
"action": action,
|
|
569
|
+
"listener_id": listener_id,
|
|
570
|
+
"name": name,
|
|
571
|
+
"position": position,
|
|
572
|
+
"redirect_http_code": redirect_http_code,
|
|
573
|
+
"redirect_pool_id": redirect_pool_id,
|
|
574
|
+
"redirect_prefix": redirect_prefix,
|
|
575
|
+
"redirect_url": redirect_url,
|
|
576
|
+
"tags": tags,
|
|
577
|
+
},
|
|
578
|
+
l7_policy_create_params.L7PolicyCreateParams,
|
|
579
|
+
),
|
|
580
|
+
options=make_request_options(
|
|
581
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
582
|
+
),
|
|
583
|
+
cast_to=TaskIDList,
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
async def list(
|
|
587
|
+
self,
|
|
588
|
+
*,
|
|
589
|
+
project_id: int | None = None,
|
|
590
|
+
region_id: int | None = None,
|
|
591
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
592
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
593
|
+
extra_headers: Headers | None = None,
|
|
594
|
+
extra_query: Query | None = None,
|
|
595
|
+
extra_body: Body | None = None,
|
|
596
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
597
|
+
) -> LoadBalancerL7PolicyList:
|
|
598
|
+
"""
|
|
599
|
+
List load balancer L7 policies
|
|
600
|
+
|
|
601
|
+
Args:
|
|
602
|
+
extra_headers: Send extra headers
|
|
603
|
+
|
|
604
|
+
extra_query: Add additional query parameters to the request
|
|
605
|
+
|
|
606
|
+
extra_body: Add additional JSON properties to the request
|
|
607
|
+
|
|
608
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
609
|
+
"""
|
|
610
|
+
if project_id is None:
|
|
611
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
612
|
+
if region_id is None:
|
|
613
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
614
|
+
return await self._get(
|
|
615
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}",
|
|
616
|
+
options=make_request_options(
|
|
617
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
618
|
+
),
|
|
619
|
+
cast_to=LoadBalancerL7PolicyList,
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
async def delete(
|
|
623
|
+
self,
|
|
624
|
+
l7policy_id: str,
|
|
625
|
+
*,
|
|
626
|
+
project_id: int | None = None,
|
|
627
|
+
region_id: int | None = None,
|
|
628
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
629
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
630
|
+
extra_headers: Headers | None = None,
|
|
631
|
+
extra_query: Query | None = None,
|
|
632
|
+
extra_body: Body | None = None,
|
|
633
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
634
|
+
) -> TaskIDList:
|
|
635
|
+
"""
|
|
636
|
+
Delete load balancer L7 policy
|
|
637
|
+
|
|
638
|
+
Args:
|
|
639
|
+
extra_headers: Send extra headers
|
|
640
|
+
|
|
641
|
+
extra_query: Add additional query parameters to the request
|
|
642
|
+
|
|
643
|
+
extra_body: Add additional JSON properties to the request
|
|
644
|
+
|
|
645
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
646
|
+
"""
|
|
647
|
+
if project_id is None:
|
|
648
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
649
|
+
if region_id is None:
|
|
650
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
651
|
+
if not l7policy_id:
|
|
652
|
+
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
653
|
+
return await self._delete(
|
|
654
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
655
|
+
options=make_request_options(
|
|
656
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
657
|
+
),
|
|
658
|
+
cast_to=TaskIDList,
|
|
659
|
+
)
|
|
660
|
+
|
|
661
|
+
async def get(
|
|
662
|
+
self,
|
|
663
|
+
l7policy_id: str,
|
|
664
|
+
*,
|
|
665
|
+
project_id: int | None = None,
|
|
666
|
+
region_id: int | None = None,
|
|
667
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
668
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
669
|
+
extra_headers: Headers | None = None,
|
|
670
|
+
extra_query: Query | None = None,
|
|
671
|
+
extra_body: Body | None = None,
|
|
672
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
673
|
+
) -> LoadBalancerL7Policy:
|
|
674
|
+
"""
|
|
675
|
+
Get load balancer L7 policy
|
|
676
|
+
|
|
677
|
+
Args:
|
|
678
|
+
extra_headers: Send extra headers
|
|
679
|
+
|
|
680
|
+
extra_query: Add additional query parameters to the request
|
|
681
|
+
|
|
682
|
+
extra_body: Add additional JSON properties to the request
|
|
683
|
+
|
|
684
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
685
|
+
"""
|
|
686
|
+
if project_id is None:
|
|
687
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
688
|
+
if region_id is None:
|
|
689
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
690
|
+
if not l7policy_id:
|
|
691
|
+
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
692
|
+
return await self._get(
|
|
693
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
694
|
+
options=make_request_options(
|
|
695
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
696
|
+
),
|
|
697
|
+
cast_to=LoadBalancerL7Policy,
|
|
698
|
+
)
|
|
699
|
+
|
|
700
|
+
async def replace(
|
|
701
|
+
self,
|
|
702
|
+
l7policy_id: str,
|
|
703
|
+
*,
|
|
704
|
+
project_id: int | None = None,
|
|
705
|
+
region_id: int | None = None,
|
|
706
|
+
action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"],
|
|
707
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
708
|
+
position: int | NotGiven = NOT_GIVEN,
|
|
709
|
+
redirect_http_code: int | NotGiven = NOT_GIVEN,
|
|
710
|
+
redirect_pool_id: str | NotGiven = NOT_GIVEN,
|
|
711
|
+
redirect_prefix: str | NotGiven = NOT_GIVEN,
|
|
712
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
713
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
714
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
715
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
716
|
+
extra_headers: Headers | None = None,
|
|
717
|
+
extra_query: Query | None = None,
|
|
718
|
+
extra_body: Body | None = None,
|
|
719
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
720
|
+
) -> TaskIDList:
|
|
721
|
+
"""
|
|
722
|
+
Replace load balancer L7 policy properties
|
|
723
|
+
|
|
724
|
+
Args:
|
|
725
|
+
action: Action
|
|
726
|
+
|
|
727
|
+
name: Human-readable name of the policy
|
|
728
|
+
|
|
729
|
+
position: The position of this policy on the listener. Positions start at 1.
|
|
730
|
+
|
|
731
|
+
redirect_http_code: Requests matching this policy will be redirected to the specified URL or Prefix
|
|
732
|
+
URL with the HTTP response code. Valid if action is REDIRECT_TO_URL or
|
|
733
|
+
REDIRECT_PREFIX. Valid options are 301, 302, 303, 307, or 308. Default is 302.
|
|
734
|
+
|
|
735
|
+
redirect_pool_id: Requests matching this policy will be redirected to the pool with this ID. Only
|
|
736
|
+
valid if action is REDIRECT_TO_POOL.
|
|
737
|
+
|
|
738
|
+
redirect_prefix: Requests matching this policy will be redirected to this Prefix URL. Only valid
|
|
739
|
+
if action is REDIRECT_PREFIX.
|
|
740
|
+
|
|
741
|
+
redirect_url: Requests matching this policy will be redirected to this URL. Only valid if
|
|
742
|
+
action is REDIRECT_TO_URL.
|
|
743
|
+
|
|
744
|
+
tags: A list of simple strings assigned to the resource.
|
|
745
|
+
|
|
746
|
+
extra_headers: Send extra headers
|
|
747
|
+
|
|
748
|
+
extra_query: Add additional query parameters to the request
|
|
749
|
+
|
|
750
|
+
extra_body: Add additional JSON properties to the request
|
|
751
|
+
|
|
752
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
753
|
+
"""
|
|
754
|
+
if project_id is None:
|
|
755
|
+
project_id = self._client._get_cloud_project_id_path_param()
|
|
756
|
+
if region_id is None:
|
|
757
|
+
region_id = self._client._get_cloud_region_id_path_param()
|
|
758
|
+
if not l7policy_id:
|
|
759
|
+
raise ValueError(f"Expected a non-empty value for `l7policy_id` but received {l7policy_id!r}")
|
|
760
|
+
return await self._put(
|
|
761
|
+
f"/cloud/v1/l7policies/{project_id}/{region_id}/{l7policy_id}",
|
|
762
|
+
body=await async_maybe_transform(
|
|
763
|
+
{
|
|
764
|
+
"action": action,
|
|
765
|
+
"name": name,
|
|
766
|
+
"position": position,
|
|
767
|
+
"redirect_http_code": redirect_http_code,
|
|
768
|
+
"redirect_pool_id": redirect_pool_id,
|
|
769
|
+
"redirect_prefix": redirect_prefix,
|
|
770
|
+
"redirect_url": redirect_url,
|
|
771
|
+
"tags": tags,
|
|
772
|
+
},
|
|
773
|
+
l7_policy_replace_params.L7PolicyReplaceParams,
|
|
774
|
+
),
|
|
775
|
+
options=make_request_options(
|
|
776
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
777
|
+
),
|
|
778
|
+
cast_to=TaskIDList,
|
|
779
|
+
)
|
|
780
|
+
|
|
781
|
+
async def create_and_poll(
|
|
782
|
+
self,
|
|
783
|
+
*,
|
|
784
|
+
project_id: int | None = None,
|
|
785
|
+
region_id: int | None = None,
|
|
786
|
+
action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"],
|
|
787
|
+
listener_id: str,
|
|
788
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
789
|
+
position: int | NotGiven = NOT_GIVEN,
|
|
790
|
+
redirect_http_code: int | NotGiven = NOT_GIVEN,
|
|
791
|
+
redirect_pool_id: str | NotGiven = NOT_GIVEN,
|
|
792
|
+
redirect_prefix: str | NotGiven = NOT_GIVEN,
|
|
793
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
794
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
795
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
796
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
797
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
798
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
799
|
+
extra_headers: Headers | None = None,
|
|
800
|
+
extra_query: Query | None = None,
|
|
801
|
+
extra_body: Body | None = None,
|
|
802
|
+
) -> LoadBalancerL7Policy:
|
|
803
|
+
response = await self.create(
|
|
804
|
+
project_id=project_id,
|
|
805
|
+
region_id=region_id,
|
|
806
|
+
action=action,
|
|
807
|
+
listener_id=listener_id,
|
|
808
|
+
name=name,
|
|
809
|
+
position=position,
|
|
810
|
+
redirect_http_code=redirect_http_code,
|
|
811
|
+
redirect_pool_id=redirect_pool_id,
|
|
812
|
+
redirect_prefix=redirect_prefix,
|
|
813
|
+
redirect_url=redirect_url,
|
|
814
|
+
tags=tags,
|
|
815
|
+
extra_headers=extra_headers,
|
|
816
|
+
extra_query=extra_query,
|
|
817
|
+
extra_body=extra_body,
|
|
818
|
+
timeout=timeout,
|
|
819
|
+
)
|
|
820
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
821
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
822
|
+
task = await self._client.cloud.tasks.poll(
|
|
823
|
+
task_id=response.tasks[0],
|
|
824
|
+
extra_headers=extra_headers,
|
|
825
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
826
|
+
)
|
|
827
|
+
if not task.created_resources or not task.created_resources.l7polices or len(task.created_resources.l7polices) != 1:
|
|
828
|
+
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
829
|
+
return await self.get(
|
|
830
|
+
l7policy_id=task.created_resources.l7polices[0],
|
|
831
|
+
project_id=project_id,
|
|
832
|
+
region_id=region_id,
|
|
833
|
+
extra_headers=extra_headers,
|
|
834
|
+
timeout=timeout,
|
|
835
|
+
)
|
|
836
|
+
|
|
837
|
+
async def delete_and_poll(
|
|
838
|
+
self,
|
|
839
|
+
l7policy_id: str,
|
|
840
|
+
*,
|
|
841
|
+
project_id: int | None = None,
|
|
842
|
+
region_id: int | None = None,
|
|
843
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
844
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
845
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
846
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
847
|
+
extra_headers: Headers | None = None,
|
|
848
|
+
extra_query: Query | None = None,
|
|
849
|
+
extra_body: Body | None = None,
|
|
850
|
+
) -> None:
|
|
851
|
+
response = await self.delete(
|
|
852
|
+
l7policy_id=l7policy_id,
|
|
853
|
+
project_id=project_id,
|
|
854
|
+
region_id=region_id,
|
|
855
|
+
extra_headers=extra_headers,
|
|
856
|
+
extra_query=extra_query,
|
|
857
|
+
extra_body=extra_body,
|
|
858
|
+
timeout=timeout,
|
|
859
|
+
)
|
|
860
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
861
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
862
|
+
await self._client.cloud.tasks.poll(
|
|
863
|
+
task_id=response.tasks[0],
|
|
864
|
+
extra_headers=extra_headers,
|
|
865
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
866
|
+
)
|
|
867
|
+
|
|
868
|
+
async def replace_and_poll(
|
|
869
|
+
self,
|
|
870
|
+
l7policy_id: str,
|
|
871
|
+
*,
|
|
872
|
+
project_id: int | None = None,
|
|
873
|
+
region_id: int | None = None,
|
|
874
|
+
action: Literal["REDIRECT_PREFIX", "REDIRECT_TO_POOL", "REDIRECT_TO_URL", "REJECT"],
|
|
875
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
876
|
+
position: int | NotGiven = NOT_GIVEN,
|
|
877
|
+
redirect_http_code: int | NotGiven = NOT_GIVEN,
|
|
878
|
+
redirect_pool_id: str | NotGiven = NOT_GIVEN,
|
|
879
|
+
redirect_prefix: str | NotGiven = NOT_GIVEN,
|
|
880
|
+
redirect_url: str | NotGiven = NOT_GIVEN,
|
|
881
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
|
882
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
883
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
884
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
885
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
886
|
+
extra_headers: Headers | None = None,
|
|
887
|
+
extra_query: Query | None = None,
|
|
888
|
+
extra_body: Body | None = None,
|
|
889
|
+
) -> LoadBalancerL7Policy:
|
|
890
|
+
response = await self.replace(
|
|
891
|
+
l7policy_id=l7policy_id,
|
|
892
|
+
project_id=project_id,
|
|
893
|
+
region_id=region_id,
|
|
894
|
+
action=action,
|
|
895
|
+
name=name,
|
|
896
|
+
position=position,
|
|
897
|
+
redirect_http_code=redirect_http_code,
|
|
898
|
+
redirect_pool_id=redirect_pool_id,
|
|
899
|
+
redirect_prefix=redirect_prefix,
|
|
900
|
+
redirect_url=redirect_url,
|
|
901
|
+
tags=tags,
|
|
902
|
+
extra_headers=extra_headers,
|
|
903
|
+
extra_query=extra_query,
|
|
904
|
+
extra_body=extra_body,
|
|
905
|
+
timeout=timeout,
|
|
906
|
+
)
|
|
907
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
908
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
909
|
+
await self._client.cloud.tasks.poll(
|
|
910
|
+
task_id=response.tasks[0],
|
|
911
|
+
extra_headers=extra_headers,
|
|
912
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
913
|
+
)
|
|
914
|
+
return await self.get(
|
|
915
|
+
l7policy_id=l7policy_id,
|
|
916
|
+
project_id=project_id,
|
|
917
|
+
region_id=region_id,
|
|
918
|
+
extra_headers=extra_headers,
|
|
919
|
+
timeout=timeout,
|
|
920
|
+
)
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
class L7PoliciesResourceWithRawResponse:
|
|
924
|
+
def __init__(self, l7_policies: L7PoliciesResource) -> None:
|
|
925
|
+
self._l7_policies = l7_policies
|
|
926
|
+
|
|
927
|
+
self.create = to_raw_response_wrapper(
|
|
928
|
+
l7_policies.create,
|
|
929
|
+
)
|
|
930
|
+
self.list = to_raw_response_wrapper(
|
|
931
|
+
l7_policies.list,
|
|
932
|
+
)
|
|
933
|
+
self.delete = to_raw_response_wrapper(
|
|
934
|
+
l7_policies.delete,
|
|
935
|
+
)
|
|
936
|
+
self.get = to_raw_response_wrapper(
|
|
937
|
+
l7_policies.get,
|
|
938
|
+
)
|
|
939
|
+
self.replace = to_raw_response_wrapper(
|
|
940
|
+
l7_policies.replace,
|
|
941
|
+
)
|
|
942
|
+
|
|
943
|
+
@cached_property
|
|
944
|
+
def rules(self) -> RulesResourceWithRawResponse:
|
|
945
|
+
return RulesResourceWithRawResponse(self._l7_policies.rules)
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
class AsyncL7PoliciesResourceWithRawResponse:
|
|
949
|
+
def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None:
|
|
950
|
+
self._l7_policies = l7_policies
|
|
951
|
+
|
|
952
|
+
self.create = async_to_raw_response_wrapper(
|
|
953
|
+
l7_policies.create,
|
|
954
|
+
)
|
|
955
|
+
self.list = async_to_raw_response_wrapper(
|
|
956
|
+
l7_policies.list,
|
|
957
|
+
)
|
|
958
|
+
self.delete = async_to_raw_response_wrapper(
|
|
959
|
+
l7_policies.delete,
|
|
960
|
+
)
|
|
961
|
+
self.get = async_to_raw_response_wrapper(
|
|
962
|
+
l7_policies.get,
|
|
963
|
+
)
|
|
964
|
+
self.replace = async_to_raw_response_wrapper(
|
|
965
|
+
l7_policies.replace,
|
|
966
|
+
)
|
|
967
|
+
|
|
968
|
+
@cached_property
|
|
969
|
+
def rules(self) -> AsyncRulesResourceWithRawResponse:
|
|
970
|
+
return AsyncRulesResourceWithRawResponse(self._l7_policies.rules)
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
class L7PoliciesResourceWithStreamingResponse:
|
|
974
|
+
def __init__(self, l7_policies: L7PoliciesResource) -> None:
|
|
975
|
+
self._l7_policies = l7_policies
|
|
976
|
+
|
|
977
|
+
self.create = to_streamed_response_wrapper(
|
|
978
|
+
l7_policies.create,
|
|
979
|
+
)
|
|
980
|
+
self.list = to_streamed_response_wrapper(
|
|
981
|
+
l7_policies.list,
|
|
982
|
+
)
|
|
983
|
+
self.delete = to_streamed_response_wrapper(
|
|
984
|
+
l7_policies.delete,
|
|
985
|
+
)
|
|
986
|
+
self.get = to_streamed_response_wrapper(
|
|
987
|
+
l7_policies.get,
|
|
988
|
+
)
|
|
989
|
+
self.replace = to_streamed_response_wrapper(
|
|
990
|
+
l7_policies.replace,
|
|
991
|
+
)
|
|
992
|
+
|
|
993
|
+
@cached_property
|
|
994
|
+
def rules(self) -> RulesResourceWithStreamingResponse:
|
|
995
|
+
return RulesResourceWithStreamingResponse(self._l7_policies.rules)
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
class AsyncL7PoliciesResourceWithStreamingResponse:
|
|
999
|
+
def __init__(self, l7_policies: AsyncL7PoliciesResource) -> None:
|
|
1000
|
+
self._l7_policies = l7_policies
|
|
1001
|
+
|
|
1002
|
+
self.create = async_to_streamed_response_wrapper(
|
|
1003
|
+
l7_policies.create,
|
|
1004
|
+
)
|
|
1005
|
+
self.list = async_to_streamed_response_wrapper(
|
|
1006
|
+
l7_policies.list,
|
|
1007
|
+
)
|
|
1008
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
1009
|
+
l7_policies.delete,
|
|
1010
|
+
)
|
|
1011
|
+
self.get = async_to_streamed_response_wrapper(
|
|
1012
|
+
l7_policies.get,
|
|
1013
|
+
)
|
|
1014
|
+
self.replace = async_to_streamed_response_wrapper(
|
|
1015
|
+
l7_policies.replace,
|
|
1016
|
+
)
|
|
1017
|
+
|
|
1018
|
+
@cached_property
|
|
1019
|
+
def rules(self) -> AsyncRulesResourceWithStreamingResponse:
|
|
1020
|
+
return AsyncRulesResourceWithStreamingResponse(self._l7_policies.rules)
|