From 5a79fd0e0631be19230d5ff2abae7d5ed847ab55 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 13:47:28 -0800 Subject: [PATCH] feat: [compute] Trusted Private Cloud support, use the universeDomain parameter (#5016) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: [compute] Trusted Private Cloud support, use the universeDomain paramete Source-Link: https://github.com/googleapis/googleapis/commit/ccaed1e30e9d5241c4f688d88029a9ad724309a0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/5cc3f75726b66c3c10216bdf0fb49a510b919136 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbXB1dGUvLk93bEJvdC55YW1sIiwiaCI6IjVjYzNmNzU3MjZiNjZjM2MxMDIxNmJkZjBmYjQ5YTUxMGI5MTkxMzYifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * build: update gapic-generator-typescript to v4.4.1 PiperOrigin-RevId: 604765466 Source-Link: https://github.com/googleapis/googleapis/commit/40203ca1880849480bbff7b8715491060bbccdf1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/07b7f3dad8aa1912d4acdcfd6365bb4236e4b54b Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbXB1dGUvLk93bEJvdC55YW1sIiwiaCI6IjA3YjdmM2RhZDhhYTE5MTJkNGFjZGNmZDYzNjViYjQyMzZlNGI1NGIifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../google/cloud/extended_operations.proto | 150 ++++++++++++++++ .../google-cloud-compute/protos/protos.d.ts | 24 +++ .../google-cloud-compute/protos/protos.js | 169 ++++++++++++++++++ .../google-cloud-compute/protos/protos.json | 41 +++++ .../v1/accelerator_types.aggregated_list.js | 2 +- .../generated/v1/accelerator_types.list.js | 2 +- .../generated/v1/addresses.aggregated_list.js | 2 +- .../samples/generated/v1/addresses.list.js | 2 +- .../v1/autoscalers.aggregated_list.js | 2 +- .../samples/generated/v1/autoscalers.list.js | 2 +- .../generated/v1/backend_buckets.list.js | 2 +- .../v1/backend_services.aggregated_list.js | 2 +- .../generated/v1/backend_services.list.js | 2 +- .../v1/backend_services.list_usable.js | 2 +- .../v1/disk_types.aggregated_list.js | 2 +- .../samples/generated/v1/disk_types.list.js | 2 +- .../generated/v1/disks.aggregated_list.js | 2 +- .../samples/generated/v1/disks.list.js | 2 +- .../v1/external_vpn_gateways.list.js | 2 +- .../generated/v1/firewall_policies.list.js | 2 +- .../samples/generated/v1/firewalls.list.js | 2 +- .../v1/forwarding_rules.aggregated_list.js | 2 +- .../generated/v1/forwarding_rules.list.js | 2 +- .../generated/v1/global_addresses.list.js | 2 +- .../v1/global_forwarding_rules.list.js | 2 +- .../v1/global_network_endpoint_groups.list.js | 2 +- ..._endpoint_groups.list_network_endpoints.js | 2 +- .../v1/global_operations.aggregated_list.js | 2 +- .../generated/v1/global_operations.list.js | 2 +- .../v1/global_organization_operations.list.js | 2 +- .../global_public_delegated_prefixes.list.js | 2 +- .../v1/health_checks.aggregated_list.js | 2 +- .../generated/v1/health_checks.list.js | 2 +- .../samples/generated/v1/images.list.js | 2 +- ...instance_group_managers.aggregated_list.js | 2 +- .../v1/instance_group_managers.list.js | 2 +- .../v1/instance_group_managers.list_errors.js | 2 +- ...e_group_managers.list_managed_instances.js | 2 +- ...roup_managers.list_per_instance_configs.js | 2 +- .../v1/instance_groups.aggregated_list.js | 2 +- .../generated/v1/instance_groups.list.js | 2 +- .../v1/instance_groups.list_instances.js | 2 +- .../v1/instance_templates.aggregated_list.js | 2 +- .../generated/v1/instance_templates.list.js | 2 +- .../generated/v1/instances.aggregated_list.js | 2 +- .../samples/generated/v1/instances.list.js | 2 +- .../generated/v1/instances.list_referrers.js | 2 +- ...nterconnect_attachments.aggregated_list.js | 2 +- .../v1/interconnect_attachments.list.js | 2 +- .../v1/interconnect_locations.list.js | 2 +- .../v1/interconnect_remote_locations.list.js | 2 +- .../generated/v1/interconnects.list.js | 2 +- .../samples/generated/v1/licenses.list.js | 2 +- .../generated/v1/machine_images.list.js | 2 +- .../v1/machine_types.aggregated_list.js | 2 +- .../generated/v1/machine_types.list.js | 2 +- .../v1/network_attachments.aggregated_list.js | 2 +- .../generated/v1/network_attachments.list.js | 2 +- ..._edge_security_services.aggregated_list.js | 2 +- ...network_endpoint_groups.aggregated_list.js | 2 +- .../v1/network_endpoint_groups.list.js | 2 +- ..._endpoint_groups.list_network_endpoints.js | 2 +- .../v1/network_firewall_policies.list.js | 2 +- .../samples/generated/v1/networks.list.js | 2 +- .../v1/networks.list_peering_routes.js | 2 +- .../v1/node_groups.aggregated_list.js | 2 +- .../samples/generated/v1/node_groups.list.js | 2 +- .../generated/v1/node_groups.list_nodes.js | 2 +- .../v1/node_templates.aggregated_list.js | 2 +- .../generated/v1/node_templates.list.js | 2 +- .../v1/node_types.aggregated_list.js | 2 +- .../samples/generated/v1/node_types.list.js | 2 +- .../v1/packet_mirrorings.aggregated_list.js | 2 +- .../generated/v1/packet_mirrorings.list.js | 2 +- .../v1/projects.get_xpn_resources.js | 2 +- .../generated/v1/projects.list_xpn_hosts.js | 2 +- .../v1/public_advertised_prefixes.list.js | 2 +- ...blic_delegated_prefixes.aggregated_list.js | 2 +- .../v1/public_delegated_prefixes.list.js | 2 +- .../generated/v1/region_autoscalers.list.js | 2 +- .../v1/region_backend_services.list.js | 2 +- .../v1/region_backend_services.list_usable.js | 2 +- .../v1/region_commitments.aggregated_list.js | 2 +- .../generated/v1/region_commitments.list.js | 2 +- .../generated/v1/region_disk_types.list.js | 2 +- .../samples/generated/v1/region_disks.list.js | 2 +- .../v1/region_health_check_services.list.js | 2 +- .../generated/v1/region_health_checks.list.js | 2 +- .../v1/region_instance_group_managers.list.js | 2 +- ...ion_instance_group_managers.list_errors.js | 2 +- ...e_group_managers.list_managed_instances.js | 2 +- ...roup_managers.list_per_instance_configs.js | 2 +- .../v1/region_instance_groups.list.js | 2 +- .../region_instance_groups.list_instances.js | 2 +- .../v1/region_instance_templates.list.js | 2 +- .../v1/region_network_endpoint_groups.list.js | 2 +- ..._endpoint_groups.list_network_endpoints.js | 2 +- .../region_network_firewall_policies.list.js | 2 +- .../v1/region_notification_endpoints.list.js | 2 +- .../generated/v1/region_operations.list.js | 2 +- .../v1/region_security_policies.list.js | 2 +- .../v1/region_ssl_certificates.list.js | 2 +- .../generated/v1/region_ssl_policies.list.js | 2 +- .../v1/region_target_http_proxies.list.js | 2 +- .../v1/region_target_https_proxies.list.js | 2 +- .../v1/region_target_tcp_proxies.list.js | 2 +- .../generated/v1/region_url_maps.list.js | 2 +- .../samples/generated/v1/regions.list.js | 2 +- .../v1/reservations.aggregated_list.js | 2 +- .../samples/generated/v1/reservations.list.js | 2 +- .../v1/resource_policies.aggregated_list.js | 2 +- .../generated/v1/resource_policies.list.js | 2 +- .../generated/v1/routers.aggregated_list.js | 2 +- .../v1/routers.get_nat_mapping_info.js | 2 +- .../samples/generated/v1/routers.list.js | 2 +- .../samples/generated/v1/routes.list.js | 2 +- .../v1/security_policies.aggregated_list.js | 2 +- .../generated/v1/security_policies.list.js | 2 +- .../v1/service_attachments.aggregated_list.js | 2 +- .../generated/v1/service_attachments.list.js | 2 +- .../samples/generated/v1/snapshots.list.js | 2 +- .../v1/ssl_certificates.aggregated_list.js | 2 +- .../generated/v1/ssl_certificates.list.js | 2 +- .../v1/ssl_policies.aggregated_list.js | 2 +- .../samples/generated/v1/ssl_policies.list.js | 2 +- .../v1/subnetworks.aggregated_list.js | 2 +- .../samples/generated/v1/subnetworks.list.js | 2 +- .../generated/v1/subnetworks.list_usable.js | 2 +- .../generated/v1/target_grpc_proxies.list.js | 2 +- .../v1/target_http_proxies.aggregated_list.js | 2 +- .../generated/v1/target_http_proxies.list.js | 2 +- .../target_https_proxies.aggregated_list.js | 2 +- .../generated/v1/target_https_proxies.list.js | 2 +- .../v1/target_instances.aggregated_list.js | 2 +- .../generated/v1/target_instances.list.js | 2 +- .../v1/target_pools.aggregated_list.js | 2 +- .../samples/generated/v1/target_pools.list.js | 2 +- .../generated/v1/target_ssl_proxies.list.js | 2 +- .../v1/target_tcp_proxies.aggregated_list.js | 2 +- .../generated/v1/target_tcp_proxies.list.js | 2 +- .../v1/target_vpn_gateways.aggregated_list.js | 2 +- .../generated/v1/target_vpn_gateways.list.js | 2 +- .../generated/v1/url_maps.aggregated_list.js | 2 +- .../samples/generated/v1/url_maps.list.js | 2 +- .../v1/vpn_gateways.aggregated_list.js | 2 +- .../samples/generated/v1/vpn_gateways.list.js | 2 +- .../v1/vpn_tunnels.aggregated_list.js | 2 +- .../samples/generated/v1/vpn_tunnels.list.js | 2 +- .../generated/v1/zone_operations.list.js | 2 +- .../samples/generated/v1/zones.list.js | 2 +- .../v1small/addresses.aggregated_list.js | 2 +- .../generated/v1small/addresses.list.js | 2 +- .../src/v1/accelerator_types_client.ts | 58 +++++- .../src/v1/addresses_client.ts | 58 +++++- .../src/v1/autoscalers_client.ts | 58 +++++- .../src/v1/backend_buckets_client.ts | 58 +++++- .../src/v1/backend_services_client.ts | 58 +++++- .../src/v1/disk_types_client.ts | 58 +++++- .../src/v1/disks_client.ts | 58 +++++- .../src/v1/external_vpn_gateways_client.ts | 58 +++++- .../src/v1/firewall_policies_client.ts | 58 +++++- .../src/v1/firewalls_client.ts | 58 +++++- .../src/v1/forwarding_rules_client.ts | 58 +++++- .../src/v1/global_addresses_client.ts | 58 +++++- .../src/v1/global_forwarding_rules_client.ts | 58 +++++- .../global_network_endpoint_groups_client.ts | 58 +++++- .../src/v1/global_operations_client.ts | 58 +++++- .../global_organization_operations_client.ts | 58 +++++- ...global_public_delegated_prefixes_client.ts | 58 +++++- .../src/v1/health_checks_client.ts | 58 +++++- .../src/v1/image_family_views_client.ts | 58 +++++- .../src/v1/images_client.ts | 58 +++++- .../src/v1/instance_group_managers_client.ts | 58 +++++- .../src/v1/instance_groups_client.ts | 58 +++++- .../src/v1/instance_templates_client.ts | 58 +++++- .../src/v1/instances_client.ts | 58 +++++- .../src/v1/interconnect_attachments_client.ts | 58 +++++- .../src/v1/interconnect_locations_client.ts | 58 +++++- .../interconnect_remote_locations_client.ts | 58 +++++- .../src/v1/interconnects_client.ts | 58 +++++- .../src/v1/license_codes_client.ts | 58 +++++- .../src/v1/licenses_client.ts | 58 +++++- .../src/v1/machine_images_client.ts | 58 +++++- .../src/v1/machine_types_client.ts | 58 +++++- .../src/v1/network_attachments_client.ts | 58 +++++- .../network_edge_security_services_client.ts | 58 +++++- .../src/v1/network_endpoint_groups_client.ts | 58 +++++- .../v1/network_firewall_policies_client.ts | 58 +++++- .../src/v1/networks_client.ts | 58 +++++- .../src/v1/node_groups_client.ts | 58 +++++- .../src/v1/node_templates_client.ts | 58 +++++- .../src/v1/node_types_client.ts | 58 +++++- .../src/v1/packet_mirrorings_client.ts | 58 +++++- .../src/v1/projects_client.ts | 58 +++++- .../v1/public_advertised_prefixes_client.ts | 58 +++++- .../v1/public_delegated_prefixes_client.ts | 58 +++++- .../src/v1/region_autoscalers_client.ts | 58 +++++- .../src/v1/region_backend_services_client.ts | 58 +++++- .../src/v1/region_commitments_client.ts | 58 +++++- .../src/v1/region_disk_types_client.ts | 58 +++++- .../src/v1/region_disks_client.ts | 58 +++++- .../v1/region_health_check_services_client.ts | 58 +++++- .../src/v1/region_health_checks_client.ts | 58 +++++- .../region_instance_group_managers_client.ts | 58 +++++- .../src/v1/region_instance_groups_client.ts | 58 +++++- .../v1/region_instance_templates_client.ts | 58 +++++- .../src/v1/region_instances_client.ts | 58 +++++- .../region_network_endpoint_groups_client.ts | 58 +++++- ...region_network_firewall_policies_client.ts | 58 +++++- .../region_notification_endpoints_client.ts | 58 +++++- .../src/v1/region_operations_client.ts | 58 +++++- .../src/v1/region_security_policies_client.ts | 58 +++++- .../src/v1/region_ssl_certificates_client.ts | 58 +++++- .../src/v1/region_ssl_policies_client.ts | 58 +++++- .../v1/region_target_http_proxies_client.ts | 58 +++++- .../v1/region_target_https_proxies_client.ts | 58 +++++- .../v1/region_target_tcp_proxies_client.ts | 58 +++++- .../src/v1/region_url_maps_client.ts | 58 +++++- .../src/v1/regions_client.ts | 58 +++++- .../src/v1/reservations_client.ts | 58 +++++- .../src/v1/resource_policies_client.ts | 58 +++++- .../src/v1/routers_client.ts | 58 +++++- .../src/v1/routes_client.ts | 58 +++++- .../src/v1/security_policies_client.ts | 58 +++++- .../src/v1/service_attachments_client.ts | 58 +++++- .../v1/snapshot_settings_service_client.ts | 58 +++++- .../src/v1/snapshots_client.ts | 58 +++++- .../src/v1/ssl_certificates_client.ts | 58 +++++- .../src/v1/ssl_policies_client.ts | 58 +++++- .../src/v1/subnetworks_client.ts | 58 +++++- .../src/v1/target_grpc_proxies_client.ts | 58 +++++- .../src/v1/target_http_proxies_client.ts | 58 +++++- .../src/v1/target_https_proxies_client.ts | 58 +++++- .../src/v1/target_instances_client.ts | 58 +++++- .../src/v1/target_pools_client.ts | 58 +++++- .../src/v1/target_ssl_proxies_client.ts | 58 +++++- .../src/v1/target_tcp_proxies_client.ts | 58 +++++- .../src/v1/target_vpn_gateways_client.ts | 58 +++++- .../src/v1/url_maps_client.ts | 58 +++++- .../src/v1/vpn_gateways_client.ts | 58 +++++- .../src/v1/vpn_tunnels_client.ts | 58 +++++- .../src/v1/zone_operations_client.ts | 58 +++++- .../src/v1/zones_client.ts | 58 +++++- .../src/v1small/addresses_client.ts | 58 +++++- .../src/v1small/region_operations_client.ts | 58 +++++- .../test/gapic_accelerator_types_v1.ts | 62 ++++++- .../test/gapic_addresses_v1.ts | 58 +++++- .../test/gapic_addresses_v1small.ts | 58 +++++- .../test/gapic_autoscalers_v1.ts | 58 +++++- .../test/gapic_backend_buckets_v1.ts | 62 ++++++- .../test/gapic_backend_services_v1.ts | 62 ++++++- .../test/gapic_disk_types_v1.ts | 58 +++++- .../test/gapic_disks_v1.ts | 58 +++++- .../test/gapic_external_vpn_gateways_v1.ts | 64 ++++++- .../test/gapic_firewall_policies_v1.ts | 62 ++++++- .../test/gapic_firewalls_v1.ts | 58 +++++- .../test/gapic_forwarding_rules_v1.ts | 62 ++++++- .../test/gapic_global_addresses_v1.ts | 62 ++++++- .../test/gapic_global_forwarding_rules_v1.ts | 68 ++++++- ...gapic_global_network_endpoint_groups_v1.ts | 69 +++++-- .../test/gapic_global_operations_v1.ts | 62 ++++++- ...gapic_global_organization_operations_v1.ts | 69 +++++-- ...pic_global_public_delegated_prefixes_v1.ts | 69 +++++-- .../test/gapic_health_checks_v1.ts | 60 ++++++- .../test/gapic_image_family_views_v1.ts | 62 ++++++- .../test/gapic_images_v1.ts | 58 +++++- .../test/gapic_instance_group_managers_v1.ts | 68 ++++++- .../test/gapic_instance_groups_v1.ts | 62 ++++++- .../test/gapic_instance_templates_v1.ts | 62 ++++++- .../test/gapic_instances_v1.ts | 58 +++++- .../test/gapic_interconnect_attachments_v1.ts | 70 ++++++-- .../test/gapic_interconnect_locations_v1.ts | 68 ++++++- .../gapic_interconnect_remote_locations_v1.ts | 69 +++++-- .../test/gapic_interconnects_v1.ts | 62 ++++++- .../test/gapic_license_codes_v1.ts | 60 ++++++- .../test/gapic_licenses_v1.ts | 58 +++++- .../test/gapic_machine_images_v1.ts | 62 ++++++- .../test/gapic_machine_types_v1.ts | 60 ++++++- .../test/gapic_network_attachments_v1.ts | 62 ++++++- ...gapic_network_edge_security_services_v1.ts | 69 +++++-- .../test/gapic_network_endpoint_groups_v1.ts | 68 ++++++- .../gapic_network_firewall_policies_v1.ts | 70 ++++++-- .../test/gapic_networks_v1.ts | 58 +++++- .../test/gapic_node_groups_v1.ts | 58 +++++- .../test/gapic_node_templates_v1.ts | 62 ++++++- .../test/gapic_node_types_v1.ts | 58 +++++- .../test/gapic_packet_mirrorings_v1.ts | 62 ++++++- .../test/gapic_projects_v1.ts | 58 +++++- .../gapic_public_advertised_prefixes_v1.ts | 70 ++++++-- .../gapic_public_delegated_prefixes_v1.ts | 70 ++++++-- .../test/gapic_region_autoscalers_v1.ts | 62 ++++++- .../test/gapic_region_backend_services_v1.ts | 68 ++++++- .../test/gapic_region_commitments_v1.ts | 62 ++++++- .../test/gapic_region_disk_types_v1.ts | 62 ++++++- .../test/gapic_region_disks_v1.ts | 58 +++++- .../gapic_region_health_check_services_v1.ts | 70 ++++++-- .../test/gapic_region_health_checks_v1.ts | 62 ++++++- ...gapic_region_instance_group_managers_v1.ts | 69 +++++-- .../test/gapic_region_instance_groups_v1.ts | 66 ++++++- .../gapic_region_instance_templates_v1.ts | 70 ++++++-- .../test/gapic_region_instances_v1.ts | 62 ++++++- ...gapic_region_network_endpoint_groups_v1.ts | 69 +++++-- ...pic_region_network_firewall_policies_v1.ts | 69 +++++-- .../gapic_region_notification_endpoints_v1.ts | 69 +++++-- .../test/gapic_region_operations_v1.ts | 62 ++++++- .../test/gapic_region_operations_v1small.ts | 64 ++++++- .../test/gapic_region_security_policies_v1.ts | 70 ++++++-- .../test/gapic_region_ssl_certificates_v1.ts | 68 ++++++- .../test/gapic_region_ssl_policies_v1.ts | 62 ++++++- .../gapic_region_target_http_proxies_v1.ts | 70 ++++++-- .../gapic_region_target_https_proxies_v1.ts | 70 ++++++-- .../gapic_region_target_tcp_proxies_v1.ts | 70 ++++++-- .../test/gapic_region_url_maps_v1.ts | 62 ++++++- .../test/gapic_regions_v1.ts | 58 +++++- .../test/gapic_reservations_v1.ts | 60 ++++++- .../test/gapic_resource_policies_v1.ts | 62 ++++++- .../test/gapic_routers_v1.ts | 58 +++++- .../test/gapic_routes_v1.ts | 58 +++++- .../test/gapic_security_policies_v1.ts | 62 ++++++- .../test/gapic_service_attachments_v1.ts | 62 ++++++- .../gapic_snapshot_settings_service_v1.ts | 70 ++++++-- .../test/gapic_snapshots_v1.ts | 58 +++++- .../test/gapic_ssl_certificates_v1.ts | 62 ++++++- .../test/gapic_ssl_policies_v1.ts | 58 +++++- .../test/gapic_subnetworks_v1.ts | 58 +++++- .../test/gapic_target_grpc_proxies_v1.ts | 62 ++++++- .../test/gapic_target_http_proxies_v1.ts | 62 ++++++- .../test/gapic_target_https_proxies_v1.ts | 62 ++++++- .../test/gapic_target_instances_v1.ts | 62 ++++++- .../test/gapic_target_pools_v1.ts | 58 +++++- .../test/gapic_target_ssl_proxies_v1.ts | 62 ++++++- .../test/gapic_target_tcp_proxies_v1.ts | 62 ++++++- .../test/gapic_target_vpn_gateways_v1.ts | 62 ++++++- .../test/gapic_url_maps_v1.ts | 58 +++++- .../test/gapic_vpn_gateways_v1.ts | 58 +++++- .../test/gapic_vpn_tunnels_v1.ts | 58 +++++- .../test/gapic_zone_operations_v1.ts | 62 ++++++- .../test/gapic_zones_v1.ts | 58 +++++- 338 files changed, 10495 insertions(+), 1432 deletions(-) create mode 100644 packages/google-cloud-compute/protos/google/cloud/extended_operations.proto diff --git a/packages/google-cloud-compute/protos/google/cloud/extended_operations.proto b/packages/google-cloud-compute/protos/google/cloud/extended_operations.proto new file mode 100644 index 00000000000..1477d2d69a6 --- /dev/null +++ b/packages/google-cloud-compute/protos/google/cloud/extended_operations.proto @@ -0,0 +1,150 @@ +// Copyright 2021 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file contains custom annotations that are used by GAPIC generators to +// handle Long Running Operation methods (LRO) that are NOT compliant with +// https://google.aip.dev/151. These annotations are public for technical +// reasons only. Please DO NOT USE them in your protos. +syntax = "proto3"; + +package google.cloud; + +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/extendedops;extendedops"; +option java_multiple_files = true; +option java_outer_classname = "ExtendedOperationsProto"; +option java_package = "com.google.cloud"; +option objc_class_prefix = "GAPI"; + +// FieldOptions to match corresponding fields in the initial request, +// polling request and operation response messages. +// +// Example: +// +// In an API-specific operation message: +// +// message MyOperation { +// string http_error_message = 1 [(operation_field) = ERROR_MESSAGE]; +// int32 http_error_status_code = 2 [(operation_field) = ERROR_CODE]; +// string id = 3 [(operation_field) = NAME]; +// Status status = 4 [(operation_field) = STATUS]; +// } +// +// In a polling request message (the one which is used to poll for an LRO +// status): +// +// message MyPollingRequest { +// string operation = 1 [(operation_response_field) = "id"]; +// string project = 2; +// string region = 3; +// } +// +// In an initial request message (the one which starts an LRO): +// +// message MyInitialRequest { +// string my_project = 2 [(operation_request_field) = "project"]; +// string my_region = 3 [(operation_request_field) = "region"]; +// } +// +extend google.protobuf.FieldOptions { + // A field annotation that maps fields in an API-specific Operation object to + // their standard counterparts in google.longrunning.Operation. See + // OperationResponseMapping enum definition. + OperationResponseMapping operation_field = 1149; + + // A field annotation that maps fields in the initial request message + // (the one which started the LRO) to their counterparts in the polling + // request message. For non-standard LRO, the polling response may be missing + // some of the information needed to make a subsequent polling request. The + // missing information (for example, project or region ID) is contained in the + // fields of the initial request message that this annotation must be applied + // to. The string value of the annotation corresponds to the name of the + // counterpart field in the polling request message that the annotated field's + // value will be copied to. + string operation_request_field = 1150; + + // A field annotation that maps fields in the polling request message to their + // counterparts in the initial and/or polling response message. The initial + // and the polling methods return an API-specific Operation object. Some of + // the fields from that response object must be reused in the subsequent + // request (like operation name/ID) to fully identify the polled operation. + // This annotation must be applied to the fields in the polling request + // message, the string value of the annotation must correspond to the name of + // the counterpart field in the Operation response object whose value will be + // copied to the annotated field. + string operation_response_field = 1151; +} + +// MethodOptions to identify the actual service and method used for operation +// status polling. +// +// Example: +// +// In a method, which starts an LRO: +// +// service MyService { +// rpc Foo(MyInitialRequest) returns (MyOperation) { +// option (operation_service) = "MyPollingService"; +// } +// } +// +// In a polling method: +// +// service MyPollingService { +// rpc Get(MyPollingRequest) returns (MyOperation) { +// option (operation_polling_method) = true; +// } +// } +extend google.protobuf.MethodOptions { + // A method annotation that maps an LRO method (the one which starts an LRO) + // to the service, which will be used to poll for the operation status. The + // annotation must be applied to the method which starts an LRO, the string + // value of the annotation must correspond to the name of the service used to + // poll for the operation status. + string operation_service = 1249; + + // A method annotation that marks methods that can be used for polling + // operation status (e.g. the MyPollingService.Get(MyPollingRequest) method). + bool operation_polling_method = 1250; +} + +// An enum to be used to mark the essential (for polling) fields in an +// API-specific Operation object. A custom Operation object may contain many +// different fields, but only few of them are essential to conduct a successful +// polling process. +enum OperationResponseMapping { + // Do not use. + UNDEFINED = 0; + + // A field in an API-specific (custom) Operation object which carries the same + // meaning as google.longrunning.Operation.name. + NAME = 1; + + // A field in an API-specific (custom) Operation object which carries the same + // meaning as google.longrunning.Operation.done. If the annotated field is of + // an enum type, `annotated_field_name == EnumType.DONE` semantics should be + // equivalent to `Operation.done == true`. If the annotated field is of type + // boolean, then it should follow the same semantics as Operation.done. + // Otherwise, a non-empty value should be treated as `Operation.done == true`. + STATUS = 2; + + // A field in an API-specific (custom) Operation object which carries the same + // meaning as google.longrunning.Operation.error.code. + ERROR_CODE = 3; + + // A field in an API-specific (custom) Operation object which carries the same + // meaning as google.longrunning.Operation.error.message. + ERROR_MESSAGE = 4; +} \ No newline at end of file diff --git a/packages/google-cloud-compute/protos/protos.d.ts b/packages/google-cloud-compute/protos/protos.d.ts index 4ad19c89f12..9a2226e5849 100644 --- a/packages/google-cloud-compute/protos/protos.d.ts +++ b/packages/google-cloud-compute/protos/protos.d.ts @@ -2117,6 +2117,15 @@ export namespace google { /** FieldOptions .google.api.resourceReference */ ".google.api.resourceReference"?: (google.api.IResourceReference|null); + + /** FieldOptions .google.cloud.operationField */ + ".google.cloud.operationField"?: (google.cloud.OperationResponseMapping|keyof typeof google.cloud.OperationResponseMapping|null); + + /** FieldOptions .google.cloud.operationRequestField */ + ".google.cloud.operationRequestField"?: (string|null); + + /** FieldOptions .google.cloud.operationResponseField */ + ".google.cloud.operationResponseField"?: (string|null); } /** Represents a FieldOptions. */ @@ -2718,6 +2727,12 @@ export namespace google { /** MethodOptions .google.api.methodSignature */ ".google.api.methodSignature"?: (string[]|null); + + /** MethodOptions .google.cloud.operationService */ + ".google.cloud.operationService"?: (string|null); + + /** MethodOptions .google.cloud.operationPollingMethod */ + ".google.cloud.operationPollingMethod"?: (boolean|null); } /** Represents a MethodOptions. */ @@ -208688,6 +208703,15 @@ export namespace google { } } } + + /** OperationResponseMapping enum. */ + enum OperationResponseMapping { + UNDEFINED = 0, + NAME = 1, + STATUS = 2, + ERROR_CODE = 3, + ERROR_MESSAGE = 4 + } } /** Namespace api. */ diff --git a/packages/google-cloud-compute/protos/protos.js b/packages/google-cloud-compute/protos/protos.js index 74d5fe46600..9b2b4dc5fbf 100644 --- a/packages/google-cloud-compute/protos/protos.js +++ b/packages/google-cloud-compute/protos/protos.js @@ -5888,6 +5888,9 @@ * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + * @property {google.cloud.OperationResponseMapping|null} [".google.cloud.operationField"] FieldOptions .google.cloud.operationField + * @property {string|null} [".google.cloud.operationRequestField"] FieldOptions .google.cloud.operationRequestField + * @property {string|null} [".google.cloud.operationResponseField"] FieldOptions .google.cloud.operationResponseField */ /** @@ -6011,6 +6014,30 @@ */ FieldOptions.prototype[".google.api.resourceReference"] = null; + /** + * FieldOptions .google.cloud.operationField. + * @member {google.cloud.OperationResponseMapping} .google.cloud.operationField + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.cloud.operationField"] = 0; + + /** + * FieldOptions .google.cloud.operationRequestField. + * @member {string} .google.cloud.operationRequestField + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.cloud.operationRequestField"] = ""; + + /** + * FieldOptions .google.cloud.operationResponseField. + * @member {string} .google.cloud.operationResponseField + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.cloud.operationResponseField"] = ""; + /** * Creates a new FieldOptions instance using the specified properties. * @function create @@ -6066,6 +6093,12 @@ } if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + if (message[".google.cloud.operationField"] != null && Object.hasOwnProperty.call(message, ".google.cloud.operationField")) + writer.uint32(/* id 1149, wireType 0 =*/9192).int32(message[".google.cloud.operationField"]); + if (message[".google.cloud.operationRequestField"] != null && Object.hasOwnProperty.call(message, ".google.cloud.operationRequestField")) + writer.uint32(/* id 1150, wireType 2 =*/9202).string(message[".google.cloud.operationRequestField"]); + if (message[".google.cloud.operationResponseField"] != null && Object.hasOwnProperty.call(message, ".google.cloud.operationResponseField")) + writer.uint32(/* id 1151, wireType 2 =*/9210).string(message[".google.cloud.operationResponseField"]); return writer; }; @@ -6161,6 +6194,18 @@ message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); break; } + case 1149: { + message[".google.cloud.operationField"] = reader.int32(); + break; + } + case 1150: { + message[".google.cloud.operationRequestField"] = reader.string(); + break; + } + case 1151: { + message[".google.cloud.operationResponseField"] = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -6289,6 +6334,23 @@ if (error) return ".google.api.resourceReference." + error; } + if (message[".google.cloud.operationField"] != null && message.hasOwnProperty(".google.cloud.operationField")) + switch (message[".google.cloud.operationField"]) { + default: + return ".google.cloud.operationField: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message[".google.cloud.operationRequestField"] != null && message.hasOwnProperty(".google.cloud.operationRequestField")) + if (!$util.isString(message[".google.cloud.operationRequestField"])) + return ".google.cloud.operationRequestField: string expected"; + if (message[".google.cloud.operationResponseField"] != null && message.hasOwnProperty(".google.cloud.operationResponseField")) + if (!$util.isString(message[".google.cloud.operationResponseField"])) + return ".google.cloud.operationResponseField: string expected"; return null; }; @@ -6484,6 +6546,38 @@ throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); } + switch (object[".google.cloud.operationField"]) { + default: + if (typeof object[".google.cloud.operationField"] === "number") { + message[".google.cloud.operationField"] = object[".google.cloud.operationField"]; + break; + } + break; + case "UNDEFINED": + case 0: + message[".google.cloud.operationField"] = 0; + break; + case "NAME": + case 1: + message[".google.cloud.operationField"] = 1; + break; + case "STATUS": + case 2: + message[".google.cloud.operationField"] = 2; + break; + case "ERROR_CODE": + case 3: + message[".google.cloud.operationField"] = 3; + break; + case "ERROR_MESSAGE": + case 4: + message[".google.cloud.operationField"] = 4; + break; + } + if (object[".google.cloud.operationRequestField"] != null) + message[".google.cloud.operationRequestField"] = String(object[".google.cloud.operationRequestField"]); + if (object[".google.cloud.operationResponseField"] != null) + message[".google.cloud.operationResponseField"] = String(object[".google.cloud.operationResponseField"]); return message; }; @@ -6516,6 +6610,9 @@ object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.target = options.enums === String ? "TARGET_TYPE_UNKNOWN" : 0; object[".google.api.resourceReference"] = null; + object[".google.cloud.operationField"] = options.enums === String ? "UNDEFINED" : 0; + object[".google.cloud.operationRequestField"] = ""; + object[".google.cloud.operationResponseField"] = ""; } if (message.ctype != null && message.hasOwnProperty("ctype")) object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; @@ -6549,6 +6646,12 @@ } if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + if (message[".google.cloud.operationField"] != null && message.hasOwnProperty(".google.cloud.operationField")) + object[".google.cloud.operationField"] = options.enums === String ? $root.google.cloud.OperationResponseMapping[message[".google.cloud.operationField"]] === undefined ? message[".google.cloud.operationField"] : $root.google.cloud.OperationResponseMapping[message[".google.cloud.operationField"]] : message[".google.cloud.operationField"]; + if (message[".google.cloud.operationRequestField"] != null && message.hasOwnProperty(".google.cloud.operationRequestField")) + object[".google.cloud.operationRequestField"] = message[".google.cloud.operationRequestField"]; + if (message[".google.cloud.operationResponseField"] != null && message.hasOwnProperty(".google.cloud.operationResponseField")) + object[".google.cloud.operationResponseField"] = message[".google.cloud.operationResponseField"]; return object; }; @@ -7732,6 +7835,8 @@ * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + * @property {string|null} [".google.cloud.operationService"] MethodOptions .google.cloud.operationService + * @property {boolean|null} [".google.cloud.operationPollingMethod"] MethodOptions .google.cloud.operationPollingMethod */ /** @@ -7791,6 +7896,22 @@ */ MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + /** + * MethodOptions .google.cloud.operationService. + * @member {string} .google.cloud.operationService + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.cloud.operationService"] = ""; + + /** + * MethodOptions .google.cloud.operationPollingMethod. + * @member {boolean} .google.cloud.operationPollingMethod + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.cloud.operationPollingMethod"] = false; + /** * Creates a new MethodOptions instance using the specified properties. * @function create @@ -7825,6 +7946,10 @@ if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); + if (message[".google.cloud.operationService"] != null && Object.hasOwnProperty.call(message, ".google.cloud.operationService")) + writer.uint32(/* id 1249, wireType 2 =*/9994).string(message[".google.cloud.operationService"]); + if (message[".google.cloud.operationPollingMethod"] != null && Object.hasOwnProperty.call(message, ".google.cloud.operationPollingMethod")) + writer.uint32(/* id 1250, wireType 0 =*/10000).bool(message[".google.cloud.operationPollingMethod"]); if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); return writer; @@ -7885,6 +8010,14 @@ message[".google.api.methodSignature"].push(reader.string()); break; } + case 1249: { + message[".google.cloud.operationService"] = reader.string(); + break; + } + case 1250: { + message[".google.cloud.operationPollingMethod"] = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -7953,6 +8086,12 @@ if (!$util.isString(message[".google.api.methodSignature"][i])) return ".google.api.methodSignature: string[] expected"; } + if (message[".google.cloud.operationService"] != null && message.hasOwnProperty(".google.cloud.operationService")) + if (!$util.isString(message[".google.cloud.operationService"])) + return ".google.cloud.operationService: string expected"; + if (message[".google.cloud.operationPollingMethod"] != null && message.hasOwnProperty(".google.cloud.operationPollingMethod")) + if (typeof message[".google.cloud.operationPollingMethod"] !== "boolean") + return ".google.cloud.operationPollingMethod: boolean expected"; return null; }; @@ -8012,6 +8151,10 @@ for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); } + if (object[".google.cloud.operationService"] != null) + message[".google.cloud.operationService"] = String(object[".google.cloud.operationService"]); + if (object[".google.cloud.operationPollingMethod"] != null) + message[".google.cloud.operationPollingMethod"] = Boolean(object[".google.cloud.operationPollingMethod"]); return message; }; @@ -8035,6 +8178,8 @@ if (options.defaults) { object.deprecated = false; object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; + object[".google.cloud.operationService"] = ""; + object[".google.cloud.operationPollingMethod"] = false; object[".google.api.http"] = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) @@ -8051,6 +8196,10 @@ for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; } + if (message[".google.cloud.operationService"] != null && message.hasOwnProperty(".google.cloud.operationService")) + object[".google.cloud.operationService"] = message[".google.cloud.operationService"]; + if (message[".google.cloud.operationPollingMethod"] != null && message.hasOwnProperty(".google.cloud.operationPollingMethod")) + object[".google.cloud.operationPollingMethod"] = message[".google.cloud.operationPollingMethod"]; if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); return object; @@ -546539,6 +546688,26 @@ return compute; })(); + /** + * OperationResponseMapping enum. + * @name google.cloud.OperationResponseMapping + * @enum {number} + * @property {number} UNDEFINED=0 UNDEFINED value + * @property {number} NAME=1 NAME value + * @property {number} STATUS=2 STATUS value + * @property {number} ERROR_CODE=3 ERROR_CODE value + * @property {number} ERROR_MESSAGE=4 ERROR_MESSAGE value + */ + cloud.OperationResponseMapping = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNDEFINED"] = 0; + values[valuesById[1] = "NAME"] = 1; + values[valuesById[2] = "STATUS"] = 2; + values[valuesById[3] = "ERROR_CODE"] = 3; + values[valuesById[4] = "ERROR_MESSAGE"] = 4; + return values; + })(); + return cloud; })(); diff --git a/packages/google-cloud-compute/protos/protos.json b/packages/google-cloud-compute/protos/protos.json index 9f0c45dc7ca..21a05bd700a 100644 --- a/packages/google-cloud-compute/protos/protos.json +++ b/packages/google-cloud-compute/protos/protos.json @@ -1010,6 +1010,13 @@ } }, "cloud": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/cloud/extendedops;extendedops", + "java_multiple_files": true, + "java_outer_classname": "ExtendedOperationsProto", + "java_package": "com.google.cloud", + "objc_class_prefix": "GAPI" + }, "nested": { "compute": { "nested": { @@ -96126,6 +96133,40 @@ } } } + }, + "operationField": { + "type": "OperationResponseMapping", + "id": 1149, + "extend": "google.protobuf.FieldOptions" + }, + "operationRequestField": { + "type": "string", + "id": 1150, + "extend": "google.protobuf.FieldOptions" + }, + "operationResponseField": { + "type": "string", + "id": 1151, + "extend": "google.protobuf.FieldOptions" + }, + "operationService": { + "type": "string", + "id": 1249, + "extend": "google.protobuf.MethodOptions" + }, + "operationPollingMethod": { + "type": "bool", + "id": 1250, + "extend": "google.protobuf.MethodOptions" + }, + "OperationResponseMapping": { + "values": { + "UNDEFINED": 0, + "NAME": 1, + "STATUS": 2, + "ERROR_CODE": 3, + "ERROR_MESSAGE": 4 + } } } }, diff --git a/packages/google-cloud-compute/samples/generated/v1/accelerator_types.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/accelerator_types.aggregated_list.js index 0edc51dd81f..55d4bcdd0a0 100644 --- a/packages/google-cloud-compute/samples/generated/v1/accelerator_types.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/accelerator_types.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/accelerator_types.list.js b/packages/google-cloud-compute/samples/generated/v1/accelerator_types.list.js index 3e05859116e..8458cf1ebec 100644 --- a/packages/google-cloud-compute/samples/generated/v1/accelerator_types.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/accelerator_types.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/addresses.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/addresses.aggregated_list.js index 9ff8eaa3e96..35b065bfe4e 100644 --- a/packages/google-cloud-compute/samples/generated/v1/addresses.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/addresses.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/addresses.list.js b/packages/google-cloud-compute/samples/generated/v1/addresses.list.js index 1824fcb6517..4d47e5c553d 100644 --- a/packages/google-cloud-compute/samples/generated/v1/addresses.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/addresses.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/autoscalers.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/autoscalers.aggregated_list.js index b1569363b8f..86ece22f43a 100644 --- a/packages/google-cloud-compute/samples/generated/v1/autoscalers.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/autoscalers.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/autoscalers.list.js b/packages/google-cloud-compute/samples/generated/v1/autoscalers.list.js index 02c9a110dae..7dee9d343f9 100644 --- a/packages/google-cloud-compute/samples/generated/v1/autoscalers.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/autoscalers.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/backend_buckets.list.js b/packages/google-cloud-compute/samples/generated/v1/backend_buckets.list.js index 228b8133d66..0a43c8b2e3d 100644 --- a/packages/google-cloud-compute/samples/generated/v1/backend_buckets.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/backend_buckets.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/backend_services.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/backend_services.aggregated_list.js index 35fe8b8cfa8..b800c22bcb6 100644 --- a/packages/google-cloud-compute/samples/generated/v1/backend_services.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/backend_services.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/backend_services.list.js b/packages/google-cloud-compute/samples/generated/v1/backend_services.list.js index 4ae9d8b5663..d4a45f3e4bd 100644 --- a/packages/google-cloud-compute/samples/generated/v1/backend_services.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/backend_services.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/backend_services.list_usable.js b/packages/google-cloud-compute/samples/generated/v1/backend_services.list_usable.js index c90c9b57b8e..734cdd589ed 100644 --- a/packages/google-cloud-compute/samples/generated/v1/backend_services.list_usable.js +++ b/packages/google-cloud-compute/samples/generated/v1/backend_services.list_usable.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listUsableAsync(request); + const iterable = computeClient.listUsableAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/disk_types.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/disk_types.aggregated_list.js index ad423a7111d..0b516769945 100644 --- a/packages/google-cloud-compute/samples/generated/v1/disk_types.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/disk_types.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/disk_types.list.js b/packages/google-cloud-compute/samples/generated/v1/disk_types.list.js index 3a78fb4118c..52afaec7985 100644 --- a/packages/google-cloud-compute/samples/generated/v1/disk_types.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/disk_types.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/disks.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/disks.aggregated_list.js index bc669a8c975..4a243155839 100644 --- a/packages/google-cloud-compute/samples/generated/v1/disks.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/disks.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/disks.list.js b/packages/google-cloud-compute/samples/generated/v1/disks.list.js index 236255312ec..08be869f32c 100644 --- a/packages/google-cloud-compute/samples/generated/v1/disks.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/disks.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/external_vpn_gateways.list.js b/packages/google-cloud-compute/samples/generated/v1/external_vpn_gateways.list.js index 2adaabdbb79..a515cb84c9c 100644 --- a/packages/google-cloud-compute/samples/generated/v1/external_vpn_gateways.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/external_vpn_gateways.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/firewall_policies.list.js b/packages/google-cloud-compute/samples/generated/v1/firewall_policies.list.js index f5ce3525a92..fefb339e521 100644 --- a/packages/google-cloud-compute/samples/generated/v1/firewall_policies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/firewall_policies.list.js @@ -65,7 +65,7 @@ function main() { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/firewalls.list.js b/packages/google-cloud-compute/samples/generated/v1/firewalls.list.js index 308b7a24961..d27faf86c79 100644 --- a/packages/google-cloud-compute/samples/generated/v1/firewalls.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/firewalls.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/forwarding_rules.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/forwarding_rules.aggregated_list.js index c4346f971fa..9c36cb2e80f 100644 --- a/packages/google-cloud-compute/samples/generated/v1/forwarding_rules.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/forwarding_rules.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/forwarding_rules.list.js b/packages/google-cloud-compute/samples/generated/v1/forwarding_rules.list.js index 4271212e2c0..19ac3885eda 100644 --- a/packages/google-cloud-compute/samples/generated/v1/forwarding_rules.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/forwarding_rules.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/global_addresses.list.js b/packages/google-cloud-compute/samples/generated/v1/global_addresses.list.js index 9a10938023d..aa94c273567 100644 --- a/packages/google-cloud-compute/samples/generated/v1/global_addresses.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/global_addresses.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/global_forwarding_rules.list.js b/packages/google-cloud-compute/samples/generated/v1/global_forwarding_rules.list.js index b8f0c0cc224..0f4b2b0f0b2 100644 --- a/packages/google-cloud-compute/samples/generated/v1/global_forwarding_rules.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/global_forwarding_rules.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/global_network_endpoint_groups.list.js b/packages/google-cloud-compute/samples/generated/v1/global_network_endpoint_groups.list.js index 0ffdcf8c2df..ca8c1676210 100644 --- a/packages/google-cloud-compute/samples/generated/v1/global_network_endpoint_groups.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/global_network_endpoint_groups.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/global_network_endpoint_groups.list_network_endpoints.js b/packages/google-cloud-compute/samples/generated/v1/global_network_endpoint_groups.list_network_endpoints.js index 7c694e03192..27171142809 100644 --- a/packages/google-cloud-compute/samples/generated/v1/global_network_endpoint_groups.list_network_endpoints.js +++ b/packages/google-cloud-compute/samples/generated/v1/global_network_endpoint_groups.list_network_endpoints.js @@ -71,7 +71,7 @@ function main(networkEndpointGroup, project) { }; // Run request - const iterable = await computeClient.listNetworkEndpointsAsync(request); + const iterable = computeClient.listNetworkEndpointsAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/global_operations.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/global_operations.aggregated_list.js index 36b8da6fa1a..a3fd7981f5e 100644 --- a/packages/google-cloud-compute/samples/generated/v1/global_operations.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/global_operations.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/global_operations.list.js b/packages/google-cloud-compute/samples/generated/v1/global_operations.list.js index f5f9d695221..b987f1cff2e 100644 --- a/packages/google-cloud-compute/samples/generated/v1/global_operations.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/global_operations.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/global_organization_operations.list.js b/packages/google-cloud-compute/samples/generated/v1/global_organization_operations.list.js index 3d68d0d58bd..3f1074d9da9 100644 --- a/packages/google-cloud-compute/samples/generated/v1/global_organization_operations.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/global_organization_operations.list.js @@ -65,7 +65,7 @@ function main() { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/global_public_delegated_prefixes.list.js b/packages/google-cloud-compute/samples/generated/v1/global_public_delegated_prefixes.list.js index e208fbf2b62..742f03499e5 100644 --- a/packages/google-cloud-compute/samples/generated/v1/global_public_delegated_prefixes.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/global_public_delegated_prefixes.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/health_checks.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/health_checks.aggregated_list.js index ea4cd76753c..d80c4e984f3 100644 --- a/packages/google-cloud-compute/samples/generated/v1/health_checks.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/health_checks.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/health_checks.list.js b/packages/google-cloud-compute/samples/generated/v1/health_checks.list.js index b3bc58534c7..3590b999695 100644 --- a/packages/google-cloud-compute/samples/generated/v1/health_checks.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/health_checks.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/images.list.js b/packages/google-cloud-compute/samples/generated/v1/images.list.js index 2e0a17b6f0b..02775052931 100644 --- a/packages/google-cloud-compute/samples/generated/v1/images.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/images.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.aggregated_list.js index 407df545d9c..184b7551965 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list.js b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list.js index 3f75ac7e452..0225e4195ad 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_errors.js b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_errors.js index fdb4281bc6e..c12c86cf64f 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_errors.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_errors.js @@ -76,7 +76,7 @@ function main(instanceGroupManager, project, zone) { }; // Run request - const iterable = await computeClient.listErrorsAsync(request); + const iterable = computeClient.listErrorsAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_managed_instances.js b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_managed_instances.js index 0117c986392..bf5eced5400 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_managed_instances.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_managed_instances.js @@ -76,7 +76,7 @@ function main(instanceGroupManager, project, zone) { }; // Run request - const iterable = await computeClient.listManagedInstancesAsync(request); + const iterable = computeClient.listManagedInstancesAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_per_instance_configs.js b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_per_instance_configs.js index 9a01e48c393..c1fa37772d5 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_per_instance_configs.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_group_managers.list_per_instance_configs.js @@ -76,7 +76,7 @@ function main(instanceGroupManager, project, zone) { }; // Run request - const iterable = await computeClient.listPerInstanceConfigsAsync(request); + const iterable = computeClient.listPerInstanceConfigsAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_groups.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/instance_groups.aggregated_list.js index b9f66cc885f..fa212c613d2 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_groups.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_groups.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_groups.list.js b/packages/google-cloud-compute/samples/generated/v1/instance_groups.list.js index 59a16132b23..729592a281d 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_groups.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_groups.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_groups.list_instances.js b/packages/google-cloud-compute/samples/generated/v1/instance_groups.list_instances.js index 7423bb9a8ab..88463a702cc 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_groups.list_instances.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_groups.list_instances.js @@ -81,7 +81,7 @@ function main(instanceGroup, instanceGroupsListInstancesRequestResource, project }; // Run request - const iterable = await computeClient.listInstancesAsync(request); + const iterable = computeClient.listInstancesAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_templates.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/instance_templates.aggregated_list.js index f7f75f3b7fa..ef0ff06d231 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_templates.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_templates.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instance_templates.list.js b/packages/google-cloud-compute/samples/generated/v1/instance_templates.list.js index ef329f5edda..7b973304b08 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instance_templates.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/instance_templates.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instances.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/instances.aggregated_list.js index 69a201ed0fa..f0ef3fbe76d 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instances.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/instances.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instances.list.js b/packages/google-cloud-compute/samples/generated/v1/instances.list.js index afa43bfbcba..76841fb41ae 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instances.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/instances.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/instances.list_referrers.js b/packages/google-cloud-compute/samples/generated/v1/instances.list_referrers.js index 3286b1c945a..49af048a3d3 100644 --- a/packages/google-cloud-compute/samples/generated/v1/instances.list_referrers.js +++ b/packages/google-cloud-compute/samples/generated/v1/instances.list_referrers.js @@ -76,7 +76,7 @@ function main(instance, project, zone) { }; // Run request - const iterable = await computeClient.listReferrersAsync(request); + const iterable = computeClient.listReferrersAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/interconnect_attachments.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/interconnect_attachments.aggregated_list.js index 7ab50b6c4b8..29c29181d25 100644 --- a/packages/google-cloud-compute/samples/generated/v1/interconnect_attachments.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/interconnect_attachments.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/interconnect_attachments.list.js b/packages/google-cloud-compute/samples/generated/v1/interconnect_attachments.list.js index 10f123d908a..35f0b91800b 100644 --- a/packages/google-cloud-compute/samples/generated/v1/interconnect_attachments.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/interconnect_attachments.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/interconnect_locations.list.js b/packages/google-cloud-compute/samples/generated/v1/interconnect_locations.list.js index a9aa7eca28c..aaa987bf15b 100644 --- a/packages/google-cloud-compute/samples/generated/v1/interconnect_locations.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/interconnect_locations.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/interconnect_remote_locations.list.js b/packages/google-cloud-compute/samples/generated/v1/interconnect_remote_locations.list.js index 4a66035d722..cb72f00d4f5 100644 --- a/packages/google-cloud-compute/samples/generated/v1/interconnect_remote_locations.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/interconnect_remote_locations.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/interconnects.list.js b/packages/google-cloud-compute/samples/generated/v1/interconnects.list.js index 62da92aec39..0a680f3b64a 100644 --- a/packages/google-cloud-compute/samples/generated/v1/interconnects.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/interconnects.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/licenses.list.js b/packages/google-cloud-compute/samples/generated/v1/licenses.list.js index d638d43f2e9..29bef0fcb08 100644 --- a/packages/google-cloud-compute/samples/generated/v1/licenses.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/licenses.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/machine_images.list.js b/packages/google-cloud-compute/samples/generated/v1/machine_images.list.js index 28fabfd418c..7656c7939a3 100644 --- a/packages/google-cloud-compute/samples/generated/v1/machine_images.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/machine_images.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/machine_types.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/machine_types.aggregated_list.js index f8015511abe..315d8da6495 100644 --- a/packages/google-cloud-compute/samples/generated/v1/machine_types.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/machine_types.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/machine_types.list.js b/packages/google-cloud-compute/samples/generated/v1/machine_types.list.js index 4579cde3b3c..b593702b7c3 100644 --- a/packages/google-cloud-compute/samples/generated/v1/machine_types.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/machine_types.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/network_attachments.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/network_attachments.aggregated_list.js index cb7190cf755..447efc622ec 100644 --- a/packages/google-cloud-compute/samples/generated/v1/network_attachments.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/network_attachments.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/network_attachments.list.js b/packages/google-cloud-compute/samples/generated/v1/network_attachments.list.js index 64fba1acb3f..318e1ec07f6 100644 --- a/packages/google-cloud-compute/samples/generated/v1/network_attachments.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/network_attachments.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/network_edge_security_services.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/network_edge_security_services.aggregated_list.js index 6e12ee5e30c..8ea3e10bcc2 100644 --- a/packages/google-cloud-compute/samples/generated/v1/network_edge_security_services.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/network_edge_security_services.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.aggregated_list.js index bcc0c365997..3ffd5592ff5 100644 --- a/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.list.js b/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.list.js index 9c5990c092b..b3069a5b3a8 100644 --- a/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.list_network_endpoints.js b/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.list_network_endpoints.js index 0e408dab541..7a0928b9452 100644 --- a/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.list_network_endpoints.js +++ b/packages/google-cloud-compute/samples/generated/v1/network_endpoint_groups.list_network_endpoints.js @@ -81,7 +81,7 @@ function main(networkEndpointGroup, networkEndpointGroupsListEndpointsRequestRes }; // Run request - const iterable = await computeClient.listNetworkEndpointsAsync(request); + const iterable = computeClient.listNetworkEndpointsAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/network_firewall_policies.list.js b/packages/google-cloud-compute/samples/generated/v1/network_firewall_policies.list.js index b81aa9c0f5f..eef00600902 100644 --- a/packages/google-cloud-compute/samples/generated/v1/network_firewall_policies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/network_firewall_policies.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/networks.list.js b/packages/google-cloud-compute/samples/generated/v1/networks.list.js index d71f270e432..8cea465b087 100644 --- a/packages/google-cloud-compute/samples/generated/v1/networks.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/networks.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/networks.list_peering_routes.js b/packages/google-cloud-compute/samples/generated/v1/networks.list_peering_routes.js index 9e24d93029d..be02cdc8314 100644 --- a/packages/google-cloud-compute/samples/generated/v1/networks.list_peering_routes.js +++ b/packages/google-cloud-compute/samples/generated/v1/networks.list_peering_routes.js @@ -84,7 +84,7 @@ function main(network, project) { }; // Run request - const iterable = await computeClient.listPeeringRoutesAsync(request); + const iterable = computeClient.listPeeringRoutesAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/node_groups.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/node_groups.aggregated_list.js index 9718a6440a8..32ce86c78eb 100644 --- a/packages/google-cloud-compute/samples/generated/v1/node_groups.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/node_groups.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/node_groups.list.js b/packages/google-cloud-compute/samples/generated/v1/node_groups.list.js index 15f79715c98..7a05f9cbfc8 100644 --- a/packages/google-cloud-compute/samples/generated/v1/node_groups.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/node_groups.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/node_groups.list_nodes.js b/packages/google-cloud-compute/samples/generated/v1/node_groups.list_nodes.js index 5704088893b..b71bd086853 100644 --- a/packages/google-cloud-compute/samples/generated/v1/node_groups.list_nodes.js +++ b/packages/google-cloud-compute/samples/generated/v1/node_groups.list_nodes.js @@ -76,7 +76,7 @@ function main(nodeGroup, project, zone) { }; // Run request - const iterable = await computeClient.listNodesAsync(request); + const iterable = computeClient.listNodesAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/node_templates.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/node_templates.aggregated_list.js index a76844ff35b..b611bdd9fef 100644 --- a/packages/google-cloud-compute/samples/generated/v1/node_templates.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/node_templates.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/node_templates.list.js b/packages/google-cloud-compute/samples/generated/v1/node_templates.list.js index b8c9f40360c..af23edbb671 100644 --- a/packages/google-cloud-compute/samples/generated/v1/node_templates.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/node_templates.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/node_types.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/node_types.aggregated_list.js index c04471e6ecf..b642a0d1aa6 100644 --- a/packages/google-cloud-compute/samples/generated/v1/node_types.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/node_types.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/node_types.list.js b/packages/google-cloud-compute/samples/generated/v1/node_types.list.js index 921bbc3dd7b..2c7d7cb602b 100644 --- a/packages/google-cloud-compute/samples/generated/v1/node_types.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/node_types.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/packet_mirrorings.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/packet_mirrorings.aggregated_list.js index 66205d69fdd..cfc42301708 100644 --- a/packages/google-cloud-compute/samples/generated/v1/packet_mirrorings.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/packet_mirrorings.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/packet_mirrorings.list.js b/packages/google-cloud-compute/samples/generated/v1/packet_mirrorings.list.js index 0ddc0fe6907..83da508cfec 100644 --- a/packages/google-cloud-compute/samples/generated/v1/packet_mirrorings.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/packet_mirrorings.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/projects.get_xpn_resources.js b/packages/google-cloud-compute/samples/generated/v1/projects.get_xpn_resources.js index 534a65a7ef0..34169e7381a 100644 --- a/packages/google-cloud-compute/samples/generated/v1/projects.get_xpn_resources.js +++ b/packages/google-cloud-compute/samples/generated/v1/projects.get_xpn_resources.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.getXpnResourcesAsync(request); + const iterable = computeClient.getXpnResourcesAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/projects.list_xpn_hosts.js b/packages/google-cloud-compute/samples/generated/v1/projects.list_xpn_hosts.js index e5f8fac4239..7f81726d972 100644 --- a/packages/google-cloud-compute/samples/generated/v1/projects.list_xpn_hosts.js +++ b/packages/google-cloud-compute/samples/generated/v1/projects.list_xpn_hosts.js @@ -71,7 +71,7 @@ function main(project, projectsListXpnHostsRequestResource) { }; // Run request - const iterable = await computeClient.listXpnHostsAsync(request); + const iterable = computeClient.listXpnHostsAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/public_advertised_prefixes.list.js b/packages/google-cloud-compute/samples/generated/v1/public_advertised_prefixes.list.js index 0e10dcfe553..dd5211bf904 100644 --- a/packages/google-cloud-compute/samples/generated/v1/public_advertised_prefixes.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/public_advertised_prefixes.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/public_delegated_prefixes.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/public_delegated_prefixes.aggregated_list.js index 8bfc7a74be7..773640b81b4 100644 --- a/packages/google-cloud-compute/samples/generated/v1/public_delegated_prefixes.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/public_delegated_prefixes.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/public_delegated_prefixes.list.js b/packages/google-cloud-compute/samples/generated/v1/public_delegated_prefixes.list.js index 7d3be290b46..92c563bf054 100644 --- a/packages/google-cloud-compute/samples/generated/v1/public_delegated_prefixes.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/public_delegated_prefixes.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_autoscalers.list.js b/packages/google-cloud-compute/samples/generated/v1/region_autoscalers.list.js index e614ef23e7e..a15e3b876cc 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_autoscalers.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_autoscalers.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_backend_services.list.js b/packages/google-cloud-compute/samples/generated/v1/region_backend_services.list.js index 4a138298f72..7d51e3980ee 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_backend_services.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_backend_services.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_backend_services.list_usable.js b/packages/google-cloud-compute/samples/generated/v1/region_backend_services.list_usable.js index 9820ebdeee4..ad3a5cb4c6c 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_backend_services.list_usable.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_backend_services.list_usable.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listUsableAsync(request); + const iterable = computeClient.listUsableAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_commitments.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/region_commitments.aggregated_list.js index 5d663a3adfc..2d14ce0f2c6 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_commitments.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_commitments.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_commitments.list.js b/packages/google-cloud-compute/samples/generated/v1/region_commitments.list.js index 0b509f1e5f6..cdb68142aa2 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_commitments.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_commitments.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_disk_types.list.js b/packages/google-cloud-compute/samples/generated/v1/region_disk_types.list.js index de30420cb6d..d9290f0dc60 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_disk_types.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_disk_types.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_disks.list.js b/packages/google-cloud-compute/samples/generated/v1/region_disks.list.js index 9655f203fc6..f6890c8e6b0 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_disks.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_disks.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_health_check_services.list.js b/packages/google-cloud-compute/samples/generated/v1/region_health_check_services.list.js index d68a0a97ad8..677a25a8ff3 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_health_check_services.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_health_check_services.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_health_checks.list.js b/packages/google-cloud-compute/samples/generated/v1/region_health_checks.list.js index b8378831eb9..8392e525b7f 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_health_checks.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_health_checks.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list.js b/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list.js index c6bdf7c1db8..16c9db59086 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_errors.js b/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_errors.js index a76e440359c..10f913c1ce9 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_errors.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_errors.js @@ -76,7 +76,7 @@ function main(instanceGroupManager, project, region) { }; // Run request - const iterable = await computeClient.listErrorsAsync(request); + const iterable = computeClient.listErrorsAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_managed_instances.js b/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_managed_instances.js index 863fc14b535..7103acb61ea 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_managed_instances.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_managed_instances.js @@ -76,7 +76,7 @@ function main(instanceGroupManager, project, region) { }; // Run request - const iterable = await computeClient.listManagedInstancesAsync(request); + const iterable = computeClient.listManagedInstancesAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_per_instance_configs.js b/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_per_instance_configs.js index 2082ac96efc..6a9e26eb6ea 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_per_instance_configs.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_instance_group_managers.list_per_instance_configs.js @@ -76,7 +76,7 @@ function main(instanceGroupManager, project, region) { }; // Run request - const iterable = await computeClient.listPerInstanceConfigsAsync(request); + const iterable = computeClient.listPerInstanceConfigsAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_instance_groups.list.js b/packages/google-cloud-compute/samples/generated/v1/region_instance_groups.list.js index dac559467f0..4ee8db3ae48 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_instance_groups.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_instance_groups.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_instance_groups.list_instances.js b/packages/google-cloud-compute/samples/generated/v1/region_instance_groups.list_instances.js index 9cfbbd3f4f0..b66347e9983 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_instance_groups.list_instances.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_instance_groups.list_instances.js @@ -81,7 +81,7 @@ function main(instanceGroup, project, region, regionInstanceGroupsListInstancesR }; // Run request - const iterable = await computeClient.listInstancesAsync(request); + const iterable = computeClient.listInstancesAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_instance_templates.list.js b/packages/google-cloud-compute/samples/generated/v1/region_instance_templates.list.js index f8f98b66ec7..b4e5439b0c6 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_instance_templates.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_instance_templates.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_network_endpoint_groups.list.js b/packages/google-cloud-compute/samples/generated/v1/region_network_endpoint_groups.list.js index d690b0b7697..148984a1260 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_network_endpoint_groups.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_network_endpoint_groups.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_network_endpoint_groups.list_network_endpoints.js b/packages/google-cloud-compute/samples/generated/v1/region_network_endpoint_groups.list_network_endpoints.js index e920ea7f239..d21d98f6c63 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_network_endpoint_groups.list_network_endpoints.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_network_endpoint_groups.list_network_endpoints.js @@ -76,7 +76,7 @@ function main(networkEndpointGroup, project, region) { }; // Run request - const iterable = await computeClient.listNetworkEndpointsAsync(request); + const iterable = computeClient.listNetworkEndpointsAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_network_firewall_policies.list.js b/packages/google-cloud-compute/samples/generated/v1/region_network_firewall_policies.list.js index 9768dc01a7c..33a97539eb4 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_network_firewall_policies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_network_firewall_policies.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_notification_endpoints.list.js b/packages/google-cloud-compute/samples/generated/v1/region_notification_endpoints.list.js index acc3842ace4..defc903d34d 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_notification_endpoints.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_notification_endpoints.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_operations.list.js b/packages/google-cloud-compute/samples/generated/v1/region_operations.list.js index 565ba286d6a..3c8b70031db 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_operations.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_operations.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_security_policies.list.js b/packages/google-cloud-compute/samples/generated/v1/region_security_policies.list.js index a318b0de4a0..c0dcbbf9a00 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_security_policies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_security_policies.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_ssl_certificates.list.js b/packages/google-cloud-compute/samples/generated/v1/region_ssl_certificates.list.js index 7d2cf7f7bcb..a21c2a585e9 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_ssl_certificates.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_ssl_certificates.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_ssl_policies.list.js b/packages/google-cloud-compute/samples/generated/v1/region_ssl_policies.list.js index a0c01af71b4..dce336e6f92 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_ssl_policies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_ssl_policies.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_target_http_proxies.list.js b/packages/google-cloud-compute/samples/generated/v1/region_target_http_proxies.list.js index c99b81e0df2..ed8a253eec7 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_target_http_proxies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_target_http_proxies.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_target_https_proxies.list.js b/packages/google-cloud-compute/samples/generated/v1/region_target_https_proxies.list.js index 50b2b26ff3c..d7bef508fea 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_target_https_proxies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_target_https_proxies.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_target_tcp_proxies.list.js b/packages/google-cloud-compute/samples/generated/v1/region_target_tcp_proxies.list.js index ce004da3374..ad74e7fb41b 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_target_tcp_proxies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_target_tcp_proxies.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/region_url_maps.list.js b/packages/google-cloud-compute/samples/generated/v1/region_url_maps.list.js index 03bb2c35a64..507d6970312 100644 --- a/packages/google-cloud-compute/samples/generated/v1/region_url_maps.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/region_url_maps.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/regions.list.js b/packages/google-cloud-compute/samples/generated/v1/regions.list.js index 5a7c7e16a84..6473e8a74d9 100644 --- a/packages/google-cloud-compute/samples/generated/v1/regions.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/regions.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/reservations.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/reservations.aggregated_list.js index 69df128fc90..943882995ed 100644 --- a/packages/google-cloud-compute/samples/generated/v1/reservations.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/reservations.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/reservations.list.js b/packages/google-cloud-compute/samples/generated/v1/reservations.list.js index 8c6a4832ea9..a5e73d75f2d 100644 --- a/packages/google-cloud-compute/samples/generated/v1/reservations.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/reservations.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/resource_policies.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/resource_policies.aggregated_list.js index 11b38c12acb..953cb9a20fc 100644 --- a/packages/google-cloud-compute/samples/generated/v1/resource_policies.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/resource_policies.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/resource_policies.list.js b/packages/google-cloud-compute/samples/generated/v1/resource_policies.list.js index 132ec680da6..c008915ea15 100644 --- a/packages/google-cloud-compute/samples/generated/v1/resource_policies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/resource_policies.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/routers.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/routers.aggregated_list.js index ab3c1898039..1217a2fe4cb 100644 --- a/packages/google-cloud-compute/samples/generated/v1/routers.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/routers.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/routers.get_nat_mapping_info.js b/packages/google-cloud-compute/samples/generated/v1/routers.get_nat_mapping_info.js index fa972b2d256..640b9360833 100644 --- a/packages/google-cloud-compute/samples/generated/v1/routers.get_nat_mapping_info.js +++ b/packages/google-cloud-compute/samples/generated/v1/routers.get_nat_mapping_info.js @@ -80,7 +80,7 @@ function main(project, region, router) { }; // Run request - const iterable = await computeClient.getNatMappingInfoAsync(request); + const iterable = computeClient.getNatMappingInfoAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/routers.list.js b/packages/google-cloud-compute/samples/generated/v1/routers.list.js index 8aefca86bfe..f2b67a3e2a6 100644 --- a/packages/google-cloud-compute/samples/generated/v1/routers.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/routers.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/routes.list.js b/packages/google-cloud-compute/samples/generated/v1/routes.list.js index e17551817a8..ada56c62d65 100644 --- a/packages/google-cloud-compute/samples/generated/v1/routes.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/routes.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/security_policies.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/security_policies.aggregated_list.js index 30393e005b8..fdfa8407bc5 100644 --- a/packages/google-cloud-compute/samples/generated/v1/security_policies.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/security_policies.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/security_policies.list.js b/packages/google-cloud-compute/samples/generated/v1/security_policies.list.js index 71460f53d8e..57593829e50 100644 --- a/packages/google-cloud-compute/samples/generated/v1/security_policies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/security_policies.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/service_attachments.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/service_attachments.aggregated_list.js index c1a97b27c76..b9e09b1c486 100644 --- a/packages/google-cloud-compute/samples/generated/v1/service_attachments.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/service_attachments.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/service_attachments.list.js b/packages/google-cloud-compute/samples/generated/v1/service_attachments.list.js index 318ba1cebb8..8302dae0a92 100644 --- a/packages/google-cloud-compute/samples/generated/v1/service_attachments.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/service_attachments.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/snapshots.list.js b/packages/google-cloud-compute/samples/generated/v1/snapshots.list.js index d2252df09d5..6e33e0e662a 100644 --- a/packages/google-cloud-compute/samples/generated/v1/snapshots.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/snapshots.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/ssl_certificates.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/ssl_certificates.aggregated_list.js index 46738f85d51..7875e65e5bd 100644 --- a/packages/google-cloud-compute/samples/generated/v1/ssl_certificates.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/ssl_certificates.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/ssl_certificates.list.js b/packages/google-cloud-compute/samples/generated/v1/ssl_certificates.list.js index a571cdc03ba..f27ee4b9cf2 100644 --- a/packages/google-cloud-compute/samples/generated/v1/ssl_certificates.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/ssl_certificates.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/ssl_policies.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/ssl_policies.aggregated_list.js index eaf4adf6f3b..6e800ec6f9b 100644 --- a/packages/google-cloud-compute/samples/generated/v1/ssl_policies.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/ssl_policies.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/ssl_policies.list.js b/packages/google-cloud-compute/samples/generated/v1/ssl_policies.list.js index 026e6002f73..0a93b793bf3 100644 --- a/packages/google-cloud-compute/samples/generated/v1/ssl_policies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/ssl_policies.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/subnetworks.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/subnetworks.aggregated_list.js index cae6feb4ae1..0a63d55f955 100644 --- a/packages/google-cloud-compute/samples/generated/v1/subnetworks.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/subnetworks.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/subnetworks.list.js b/packages/google-cloud-compute/samples/generated/v1/subnetworks.list.js index 44f7c85da2c..6327fa82d3b 100644 --- a/packages/google-cloud-compute/samples/generated/v1/subnetworks.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/subnetworks.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/subnetworks.list_usable.js b/packages/google-cloud-compute/samples/generated/v1/subnetworks.list_usable.js index 7641ba30c95..56dd674629c 100644 --- a/packages/google-cloud-compute/samples/generated/v1/subnetworks.list_usable.js +++ b/packages/google-cloud-compute/samples/generated/v1/subnetworks.list_usable.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listUsableAsync(request); + const iterable = computeClient.listUsableAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_grpc_proxies.list.js b/packages/google-cloud-compute/samples/generated/v1/target_grpc_proxies.list.js index a33e4e527e7..0e5cd3dc365 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_grpc_proxies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_grpc_proxies.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_http_proxies.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/target_http_proxies.aggregated_list.js index c8da968905f..9c4012c90a3 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_http_proxies.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_http_proxies.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_http_proxies.list.js b/packages/google-cloud-compute/samples/generated/v1/target_http_proxies.list.js index 967c094878f..a968643b8f5 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_http_proxies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_http_proxies.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_https_proxies.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/target_https_proxies.aggregated_list.js index 7fb57c261a2..9e275f67b23 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_https_proxies.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_https_proxies.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_https_proxies.list.js b/packages/google-cloud-compute/samples/generated/v1/target_https_proxies.list.js index 704f43bb446..f388d89468d 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_https_proxies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_https_proxies.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_instances.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/target_instances.aggregated_list.js index 9f55e8dda28..8a6d80ce92a 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_instances.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_instances.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_instances.list.js b/packages/google-cloud-compute/samples/generated/v1/target_instances.list.js index 097c1b208cf..4c119fa92da 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_instances.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_instances.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_pools.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/target_pools.aggregated_list.js index b7cfa79eaae..ecda48dc539 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_pools.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_pools.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_pools.list.js b/packages/google-cloud-compute/samples/generated/v1/target_pools.list.js index ca5ddffdc07..651d5a07734 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_pools.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_pools.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_ssl_proxies.list.js b/packages/google-cloud-compute/samples/generated/v1/target_ssl_proxies.list.js index b01b2cbb144..57776e465e4 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_ssl_proxies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_ssl_proxies.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_tcp_proxies.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/target_tcp_proxies.aggregated_list.js index b9c45bf9da2..4d1d29f9f30 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_tcp_proxies.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_tcp_proxies.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_tcp_proxies.list.js b/packages/google-cloud-compute/samples/generated/v1/target_tcp_proxies.list.js index f9dffc11cf7..6c47f5becae 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_tcp_proxies.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_tcp_proxies.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_vpn_gateways.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/target_vpn_gateways.aggregated_list.js index 8e844c22b83..e5a7d4c655b 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_vpn_gateways.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_vpn_gateways.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/target_vpn_gateways.list.js b/packages/google-cloud-compute/samples/generated/v1/target_vpn_gateways.list.js index b4e9dc059e6..5b550d240b9 100644 --- a/packages/google-cloud-compute/samples/generated/v1/target_vpn_gateways.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/target_vpn_gateways.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/url_maps.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/url_maps.aggregated_list.js index 25cf274e2d0..a10b91d038e 100644 --- a/packages/google-cloud-compute/samples/generated/v1/url_maps.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/url_maps.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/url_maps.list.js b/packages/google-cloud-compute/samples/generated/v1/url_maps.list.js index 8a3fe7d403b..42f97af81f5 100644 --- a/packages/google-cloud-compute/samples/generated/v1/url_maps.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/url_maps.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/vpn_gateways.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/vpn_gateways.aggregated_list.js index e066a6d2db6..ca148b611a8 100644 --- a/packages/google-cloud-compute/samples/generated/v1/vpn_gateways.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/vpn_gateways.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/vpn_gateways.list.js b/packages/google-cloud-compute/samples/generated/v1/vpn_gateways.list.js index bdbeee9a87a..44c2df65975 100644 --- a/packages/google-cloud-compute/samples/generated/v1/vpn_gateways.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/vpn_gateways.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/vpn_tunnels.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1/vpn_tunnels.aggregated_list.js index 1a83f6b9b80..71cf72fa065 100644 --- a/packages/google-cloud-compute/samples/generated/v1/vpn_tunnels.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1/vpn_tunnels.aggregated_list.js @@ -73,7 +73,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/vpn_tunnels.list.js b/packages/google-cloud-compute/samples/generated/v1/vpn_tunnels.list.js index db904e54c48..0109d31c294 100644 --- a/packages/google-cloud-compute/samples/generated/v1/vpn_tunnels.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/vpn_tunnels.list.js @@ -71,7 +71,7 @@ function main(project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/zone_operations.list.js b/packages/google-cloud-compute/samples/generated/v1/zone_operations.list.js index 33915dc77c2..4b5b04fdf95 100644 --- a/packages/google-cloud-compute/samples/generated/v1/zone_operations.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/zone_operations.list.js @@ -71,7 +71,7 @@ function main(project, zone) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1/zones.list.js b/packages/google-cloud-compute/samples/generated/v1/zones.list.js index 93c06da690b..d2f26449dc0 100644 --- a/packages/google-cloud-compute/samples/generated/v1/zones.list.js +++ b/packages/google-cloud-compute/samples/generated/v1/zones.list.js @@ -66,7 +66,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1small/addresses.aggregated_list.js b/packages/google-cloud-compute/samples/generated/v1small/addresses.aggregated_list.js index f8b5c38f261..990373fafc1 100644 --- a/packages/google-cloud-compute/samples/generated/v1small/addresses.aggregated_list.js +++ b/packages/google-cloud-compute/samples/generated/v1small/addresses.aggregated_list.js @@ -71,7 +71,7 @@ function main(project) { }; // Run request - const iterable = await computeClient.aggregatedListAsync(request); + const iterable = computeClient.aggregatedListAsync(request); for await (const [key, value] of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/samples/generated/v1small/addresses.list.js b/packages/google-cloud-compute/samples/generated/v1small/addresses.list.js index aec81124d28..3ce9c69b336 100644 --- a/packages/google-cloud-compute/samples/generated/v1small/addresses.list.js +++ b/packages/google-cloud-compute/samples/generated/v1small/addresses.list.js @@ -73,7 +73,7 @@ function main(orderBy, project, region) { }; // Run request - const iterable = await computeClient.listAsync(request); + const iterable = computeClient.listAsync(request); for await (const response of iterable) { console.log(response); } diff --git a/packages/google-cloud-compute/src/v1/accelerator_types_client.ts b/packages/google-cloud-compute/src/v1/accelerator_types_client.ts index 6705cda7cec..b557731dde1 100644 --- a/packages/google-cloud-compute/src/v1/accelerator_types_client.ts +++ b/packages/google-cloud-compute/src/v1/accelerator_types_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/accelerator_types_client_config.json`. @@ -53,6 +54,8 @@ export class AcceleratorTypesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -109,8 +112,20 @@ export class AcceleratorTypesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof AcceleratorTypesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -128,7 +143,7 @@ export class AcceleratorTypesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -150,10 +165,10 @@ export class AcceleratorTypesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -272,21 +287,52 @@ export class AcceleratorTypesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/addresses_client.ts b/packages/google-cloud-compute/src/v1/addresses_client.ts index 08894e769af..4185e54cf7d 100644 --- a/packages/google-cloud-compute/src/v1/addresses_client.ts +++ b/packages/google-cloud-compute/src/v1/addresses_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/addresses_client_config.json`. @@ -51,6 +52,8 @@ export class AddressesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class AddressesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof AddressesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class AddressesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class AddressesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -278,21 +293,52 @@ export class AddressesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/autoscalers_client.ts b/packages/google-cloud-compute/src/v1/autoscalers_client.ts index 8df381fbef2..9d49a91cbac 100644 --- a/packages/google-cloud-compute/src/v1/autoscalers_client.ts +++ b/packages/google-cloud-compute/src/v1/autoscalers_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/autoscalers_client_config.json`. @@ -51,6 +52,8 @@ export class AutoscalersClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class AutoscalersClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof AutoscalersClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class AutoscalersClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class AutoscalersClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -278,21 +293,52 @@ export class AutoscalersClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/backend_buckets_client.ts b/packages/google-cloud-compute/src/v1/backend_buckets_client.ts index 4d9f781d1c7..49c4ea8fa32 100644 --- a/packages/google-cloud-compute/src/v1/backend_buckets_client.ts +++ b/packages/google-cloud-compute/src/v1/backend_buckets_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/backend_buckets_client_config.json`. @@ -51,6 +52,8 @@ export class BackendBucketsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class BackendBucketsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof BackendBucketsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class BackendBucketsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class BackendBucketsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -278,21 +293,52 @@ export class BackendBucketsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/backend_services_client.ts b/packages/google-cloud-compute/src/v1/backend_services_client.ts index 63fb772562a..ee71d42a74f 100644 --- a/packages/google-cloud-compute/src/v1/backend_services_client.ts +++ b/packages/google-cloud-compute/src/v1/backend_services_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/backend_services_client_config.json`. @@ -51,6 +52,8 @@ export class BackendServicesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class BackendServicesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof BackendServicesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class BackendServicesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class BackendServicesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -292,21 +307,52 @@ export class BackendServicesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/disk_types_client.ts b/packages/google-cloud-compute/src/v1/disk_types_client.ts index 3a10d1a45c2..9aa145ba5ed 100644 --- a/packages/google-cloud-compute/src/v1/disk_types_client.ts +++ b/packages/google-cloud-compute/src/v1/disk_types_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/disk_types_client_config.json`. @@ -50,6 +51,8 @@ export class DiskTypesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class DiskTypesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof DiskTypesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class DiskTypesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class DiskTypesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -269,21 +284,52 @@ export class DiskTypesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/disks_client.ts b/packages/google-cloud-compute/src/v1/disks_client.ts index 348a8b1cfa2..3bea653376b 100644 --- a/packages/google-cloud-compute/src/v1/disks_client.ts +++ b/packages/google-cloud-compute/src/v1/disks_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/disks_client_config.json`. @@ -51,6 +52,8 @@ export class DisksClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class DisksClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof DisksClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class DisksClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class DisksClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -289,21 +304,52 @@ export class DisksClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/external_vpn_gateways_client.ts b/packages/google-cloud-compute/src/v1/external_vpn_gateways_client.ts index d23e796a5b5..a8537187b19 100644 --- a/packages/google-cloud-compute/src/v1/external_vpn_gateways_client.ts +++ b/packages/google-cloud-compute/src/v1/external_vpn_gateways_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/external_vpn_gateways_client_config.json`. @@ -51,6 +52,8 @@ export class ExternalVpnGatewaysClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class ExternalVpnGatewaysClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ExternalVpnGatewaysClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class ExternalVpnGatewaysClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class ExternalVpnGatewaysClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -272,21 +287,52 @@ export class ExternalVpnGatewaysClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/firewall_policies_client.ts b/packages/google-cloud-compute/src/v1/firewall_policies_client.ts index 1ef60981962..41a08e8cf4e 100644 --- a/packages/google-cloud-compute/src/v1/firewall_policies_client.ts +++ b/packages/google-cloud-compute/src/v1/firewall_policies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/firewall_policies_client_config.json`. @@ -51,6 +52,8 @@ export class FirewallPoliciesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class FirewallPoliciesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof FirewallPoliciesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class FirewallPoliciesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class FirewallPoliciesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -284,21 +299,52 @@ export class FirewallPoliciesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/firewalls_client.ts b/packages/google-cloud-compute/src/v1/firewalls_client.ts index b7554e642b2..c9d75134b18 100644 --- a/packages/google-cloud-compute/src/v1/firewalls_client.ts +++ b/packages/google-cloud-compute/src/v1/firewalls_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/firewalls_client_config.json`. @@ -51,6 +52,8 @@ export class FirewallsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class FirewallsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof FirewallsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class FirewallsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class FirewallsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -272,21 +287,52 @@ export class FirewallsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/forwarding_rules_client.ts b/packages/google-cloud-compute/src/v1/forwarding_rules_client.ts index ee0364f791c..554ebf29fd5 100644 --- a/packages/google-cloud-compute/src/v1/forwarding_rules_client.ts +++ b/packages/google-cloud-compute/src/v1/forwarding_rules_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/forwarding_rules_client_config.json`. @@ -51,6 +52,8 @@ export class ForwardingRulesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class ForwardingRulesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ForwardingRulesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class ForwardingRulesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class ForwardingRulesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -279,21 +294,52 @@ export class ForwardingRulesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/global_addresses_client.ts b/packages/google-cloud-compute/src/v1/global_addresses_client.ts index 1ad5674aa1a..a3a8c2e5fcb 100644 --- a/packages/google-cloud-compute/src/v1/global_addresses_client.ts +++ b/packages/google-cloud-compute/src/v1/global_addresses_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/global_addresses_client_config.json`. @@ -51,6 +52,8 @@ export class GlobalAddressesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class GlobalAddressesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof GlobalAddressesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class GlobalAddressesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class GlobalAddressesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -272,21 +287,52 @@ export class GlobalAddressesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/global_forwarding_rules_client.ts b/packages/google-cloud-compute/src/v1/global_forwarding_rules_client.ts index 6b14f0e4af3..df3db823894 100644 --- a/packages/google-cloud-compute/src/v1/global_forwarding_rules_client.ts +++ b/packages/google-cloud-compute/src/v1/global_forwarding_rules_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/global_forwarding_rules_client_config.json`. @@ -51,6 +52,8 @@ export class GlobalForwardingRulesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class GlobalForwardingRulesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof GlobalForwardingRulesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class GlobalForwardingRulesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class GlobalForwardingRulesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -274,21 +289,52 @@ export class GlobalForwardingRulesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/global_network_endpoint_groups_client.ts b/packages/google-cloud-compute/src/v1/global_network_endpoint_groups_client.ts index df4ea7f7c5d..5ed1f854025 100644 --- a/packages/google-cloud-compute/src/v1/global_network_endpoint_groups_client.ts +++ b/packages/google-cloud-compute/src/v1/global_network_endpoint_groups_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/global_network_endpoint_groups_client_config.json`. @@ -51,6 +52,8 @@ export class GlobalNetworkEndpointGroupsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class GlobalNetworkEndpointGroupsClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof GlobalNetworkEndpointGroupsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class GlobalNetworkEndpointGroupsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class GlobalNetworkEndpointGroupsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -280,21 +295,52 @@ export class GlobalNetworkEndpointGroupsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/global_operations_client.ts b/packages/google-cloud-compute/src/v1/global_operations_client.ts index d5b1bb3a9d5..83fa06d5ecd 100644 --- a/packages/google-cloud-compute/src/v1/global_operations_client.ts +++ b/packages/google-cloud-compute/src/v1/global_operations_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/global_operations_client_config.json`. @@ -50,6 +51,8 @@ export class GlobalOperationsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class GlobalOperationsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof GlobalOperationsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class GlobalOperationsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class GlobalOperationsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -275,21 +290,52 @@ export class GlobalOperationsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/global_organization_operations_client.ts b/packages/google-cloud-compute/src/v1/global_organization_operations_client.ts index 39bc7d777ef..34668944c7f 100644 --- a/packages/google-cloud-compute/src/v1/global_organization_operations_client.ts +++ b/packages/google-cloud-compute/src/v1/global_organization_operations_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/global_organization_operations_client_config.json`. @@ -50,6 +51,8 @@ export class GlobalOrganizationOperationsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class GlobalOrganizationOperationsClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof GlobalOrganizationOperationsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class GlobalOrganizationOperationsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class GlobalOrganizationOperationsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -266,21 +281,52 @@ export class GlobalOrganizationOperationsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/global_public_delegated_prefixes_client.ts b/packages/google-cloud-compute/src/v1/global_public_delegated_prefixes_client.ts index 741e48bc387..ce135af405f 100644 --- a/packages/google-cloud-compute/src/v1/global_public_delegated_prefixes_client.ts +++ b/packages/google-cloud-compute/src/v1/global_public_delegated_prefixes_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/global_public_delegated_prefixes_client_config.json`. @@ -51,6 +52,8 @@ export class GlobalPublicDelegatedPrefixesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class GlobalPublicDelegatedPrefixesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof GlobalPublicDelegatedPrefixesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class GlobalPublicDelegatedPrefixesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class GlobalPublicDelegatedPrefixesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -273,21 +288,52 @@ export class GlobalPublicDelegatedPrefixesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/health_checks_client.ts b/packages/google-cloud-compute/src/v1/health_checks_client.ts index 773c888d8a3..82d00bf5e47 100644 --- a/packages/google-cloud-compute/src/v1/health_checks_client.ts +++ b/packages/google-cloud-compute/src/v1/health_checks_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/health_checks_client_config.json`. @@ -51,6 +52,8 @@ export class HealthChecksClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class HealthChecksClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof HealthChecksClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class HealthChecksClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class HealthChecksClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -278,21 +293,52 @@ export class HealthChecksClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/image_family_views_client.ts b/packages/google-cloud-compute/src/v1/image_family_views_client.ts index 8b0662e57cc..cc61f5d5d5e 100644 --- a/packages/google-cloud-compute/src/v1/image_family_views_client.ts +++ b/packages/google-cloud-compute/src/v1/image_family_views_client.ts @@ -27,6 +27,7 @@ import type { import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/image_family_views_client_config.json`. @@ -48,6 +49,8 @@ export class ImageFamilyViewsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -104,8 +107,20 @@ export class ImageFamilyViewsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ImageFamilyViewsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -123,7 +138,7 @@ export class ImageFamilyViewsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -145,10 +160,10 @@ export class ImageFamilyViewsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -251,21 +266,52 @@ export class ImageFamilyViewsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/images_client.ts b/packages/google-cloud-compute/src/v1/images_client.ts index 04572ffaccc..00eadb1c36d 100644 --- a/packages/google-cloud-compute/src/v1/images_client.ts +++ b/packages/google-cloud-compute/src/v1/images_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/images_client_config.json`. @@ -51,6 +52,8 @@ export class ImagesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class ImagesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ImagesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class ImagesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class ImagesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -277,21 +292,52 @@ export class ImagesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/instance_group_managers_client.ts b/packages/google-cloud-compute/src/v1/instance_group_managers_client.ts index 93c8062ef3b..5e0b2a391a6 100644 --- a/packages/google-cloud-compute/src/v1/instance_group_managers_client.ts +++ b/packages/google-cloud-compute/src/v1/instance_group_managers_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/instance_group_managers_client_config.json`. @@ -51,6 +52,8 @@ export class InstanceGroupManagersClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class InstanceGroupManagersClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof InstanceGroupManagersClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class InstanceGroupManagersClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class InstanceGroupManagersClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -307,21 +322,52 @@ export class InstanceGroupManagersClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/instance_groups_client.ts b/packages/google-cloud-compute/src/v1/instance_groups_client.ts index accd3279941..917a7bba50b 100644 --- a/packages/google-cloud-compute/src/v1/instance_groups_client.ts +++ b/packages/google-cloud-compute/src/v1/instance_groups_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/instance_groups_client_config.json`. @@ -51,6 +52,8 @@ export class InstanceGroupsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class InstanceGroupsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof InstanceGroupsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class InstanceGroupsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class InstanceGroupsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -285,21 +300,52 @@ export class InstanceGroupsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/instance_templates_client.ts b/packages/google-cloud-compute/src/v1/instance_templates_client.ts index b1492c75032..af55f2e5f96 100644 --- a/packages/google-cloud-compute/src/v1/instance_templates_client.ts +++ b/packages/google-cloud-compute/src/v1/instance_templates_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/instance_templates_client_config.json`. @@ -51,6 +52,8 @@ export class InstanceTemplatesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class InstanceTemplatesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof InstanceTemplatesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class InstanceTemplatesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class InstanceTemplatesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -279,21 +294,52 @@ export class InstanceTemplatesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/instances_client.ts b/packages/google-cloud-compute/src/v1/instances_client.ts index 4453e9d0187..8cf06437efd 100644 --- a/packages/google-cloud-compute/src/v1/instances_client.ts +++ b/packages/google-cloud-compute/src/v1/instances_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/instances_client_config.json`. @@ -51,6 +52,8 @@ export class InstancesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class InstancesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof InstancesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class InstancesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class InstancesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -323,21 +338,52 @@ export class InstancesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/interconnect_attachments_client.ts b/packages/google-cloud-compute/src/v1/interconnect_attachments_client.ts index fcc2c07d943..7e78e6021f1 100644 --- a/packages/google-cloud-compute/src/v1/interconnect_attachments_client.ts +++ b/packages/google-cloud-compute/src/v1/interconnect_attachments_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/interconnect_attachments_client_config.json`. @@ -51,6 +52,8 @@ export class InterconnectAttachmentsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class InterconnectAttachmentsClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof InterconnectAttachmentsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class InterconnectAttachmentsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class InterconnectAttachmentsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -279,21 +294,52 @@ export class InterconnectAttachmentsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/interconnect_locations_client.ts b/packages/google-cloud-compute/src/v1/interconnect_locations_client.ts index dfdfeeb367a..01523074b59 100644 --- a/packages/google-cloud-compute/src/v1/interconnect_locations_client.ts +++ b/packages/google-cloud-compute/src/v1/interconnect_locations_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/interconnect_locations_client_config.json`. @@ -50,6 +51,8 @@ export class InterconnectLocationsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class InterconnectLocationsClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof InterconnectLocationsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class InterconnectLocationsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class InterconnectLocationsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -265,21 +280,52 @@ export class InterconnectLocationsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/interconnect_remote_locations_client.ts b/packages/google-cloud-compute/src/v1/interconnect_remote_locations_client.ts index c0e975f5431..d6e08d71fb6 100644 --- a/packages/google-cloud-compute/src/v1/interconnect_remote_locations_client.ts +++ b/packages/google-cloud-compute/src/v1/interconnect_remote_locations_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/interconnect_remote_locations_client_config.json`. @@ -50,6 +51,8 @@ export class InterconnectRemoteLocationsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class InterconnectRemoteLocationsClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof InterconnectRemoteLocationsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class InterconnectRemoteLocationsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class InterconnectRemoteLocationsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -266,21 +281,52 @@ export class InterconnectRemoteLocationsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/interconnects_client.ts b/packages/google-cloud-compute/src/v1/interconnects_client.ts index 37a42beb047..a2af7ee3965 100644 --- a/packages/google-cloud-compute/src/v1/interconnects_client.ts +++ b/packages/google-cloud-compute/src/v1/interconnects_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/interconnects_client_config.json`. @@ -51,6 +52,8 @@ export class InterconnectsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class InterconnectsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof InterconnectsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class InterconnectsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class InterconnectsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -274,21 +289,52 @@ export class InterconnectsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/license_codes_client.ts b/packages/google-cloud-compute/src/v1/license_codes_client.ts index 98e04fb96d1..725865b5e41 100644 --- a/packages/google-cloud-compute/src/v1/license_codes_client.ts +++ b/packages/google-cloud-compute/src/v1/license_codes_client.ts @@ -27,6 +27,7 @@ import type { import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/license_codes_client_config.json`. @@ -48,6 +49,8 @@ export class LicenseCodesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -104,8 +107,20 @@ export class LicenseCodesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof LicenseCodesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -123,7 +138,7 @@ export class LicenseCodesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -145,10 +160,10 @@ export class LicenseCodesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -251,21 +266,52 @@ export class LicenseCodesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/licenses_client.ts b/packages/google-cloud-compute/src/v1/licenses_client.ts index 2cffd96aaa9..a7c49b4d0f0 100644 --- a/packages/google-cloud-compute/src/v1/licenses_client.ts +++ b/packages/google-cloud-compute/src/v1/licenses_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/licenses_client_config.json`. @@ -51,6 +52,8 @@ export class LicensesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class LicensesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof LicensesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class LicensesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class LicensesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -273,21 +288,52 @@ export class LicensesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/machine_images_client.ts b/packages/google-cloud-compute/src/v1/machine_images_client.ts index c53ac7e7aeb..bd29ec51ab0 100644 --- a/packages/google-cloud-compute/src/v1/machine_images_client.ts +++ b/packages/google-cloud-compute/src/v1/machine_images_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/machine_images_client_config.json`. @@ -51,6 +52,8 @@ export class MachineImagesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class MachineImagesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof MachineImagesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class MachineImagesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class MachineImagesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -273,21 +288,52 @@ export class MachineImagesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/machine_types_client.ts b/packages/google-cloud-compute/src/v1/machine_types_client.ts index abb133787ae..9d1922ca9f9 100644 --- a/packages/google-cloud-compute/src/v1/machine_types_client.ts +++ b/packages/google-cloud-compute/src/v1/machine_types_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/machine_types_client_config.json`. @@ -50,6 +51,8 @@ export class MachineTypesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class MachineTypesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof MachineTypesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class MachineTypesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class MachineTypesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -269,21 +284,52 @@ export class MachineTypesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/network_attachments_client.ts b/packages/google-cloud-compute/src/v1/network_attachments_client.ts index 05894ecbf60..726512b29a4 100644 --- a/packages/google-cloud-compute/src/v1/network_attachments_client.ts +++ b/packages/google-cloud-compute/src/v1/network_attachments_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/network_attachments_client_config.json`. @@ -51,6 +52,8 @@ export class NetworkAttachmentsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class NetworkAttachmentsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof NetworkAttachmentsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class NetworkAttachmentsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class NetworkAttachmentsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -280,21 +295,52 @@ export class NetworkAttachmentsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/network_edge_security_services_client.ts b/packages/google-cloud-compute/src/v1/network_edge_security_services_client.ts index a8286236893..02672af6d78 100644 --- a/packages/google-cloud-compute/src/v1/network_edge_security_services_client.ts +++ b/packages/google-cloud-compute/src/v1/network_edge_security_services_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/network_edge_security_services_client_config.json`. @@ -51,6 +52,8 @@ export class NetworkEdgeSecurityServicesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class NetworkEdgeSecurityServicesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof NetworkEdgeSecurityServicesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class NetworkEdgeSecurityServicesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class NetworkEdgeSecurityServicesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -273,21 +288,52 @@ export class NetworkEdgeSecurityServicesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/network_endpoint_groups_client.ts b/packages/google-cloud-compute/src/v1/network_endpoint_groups_client.ts index 158dd793b8c..298ddbe706d 100644 --- a/packages/google-cloud-compute/src/v1/network_endpoint_groups_client.ts +++ b/packages/google-cloud-compute/src/v1/network_endpoint_groups_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/network_endpoint_groups_client_config.json`. @@ -51,6 +52,8 @@ export class NetworkEndpointGroupsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class NetworkEndpointGroupsClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof NetworkEndpointGroupsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class NetworkEndpointGroupsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class NetworkEndpointGroupsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -286,21 +301,52 @@ export class NetworkEndpointGroupsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/network_firewall_policies_client.ts b/packages/google-cloud-compute/src/v1/network_firewall_policies_client.ts index 51079096ee1..bc42097d92c 100644 --- a/packages/google-cloud-compute/src/v1/network_firewall_policies_client.ts +++ b/packages/google-cloud-compute/src/v1/network_firewall_policies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/network_firewall_policies_client_config.json`. @@ -51,6 +52,8 @@ export class NetworkFirewallPoliciesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class NetworkFirewallPoliciesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof NetworkFirewallPoliciesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class NetworkFirewallPoliciesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class NetworkFirewallPoliciesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -283,21 +298,52 @@ export class NetworkFirewallPoliciesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/networks_client.ts b/packages/google-cloud-compute/src/v1/networks_client.ts index 28f9bd3f769..4720b312ea8 100644 --- a/packages/google-cloud-compute/src/v1/networks_client.ts +++ b/packages/google-cloud-compute/src/v1/networks_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/networks_client_config.json`. @@ -51,6 +52,8 @@ export class NetworksClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class NetworksClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof NetworksClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class NetworksClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class NetworksClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -282,21 +297,52 @@ export class NetworksClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/node_groups_client.ts b/packages/google-cloud-compute/src/v1/node_groups_client.ts index 24650b8c6c1..66b860eb72f 100644 --- a/packages/google-cloud-compute/src/v1/node_groups_client.ts +++ b/packages/google-cloud-compute/src/v1/node_groups_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/node_groups_client_config.json`. @@ -51,6 +52,8 @@ export class NodeGroupsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class NodeGroupsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof NodeGroupsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class NodeGroupsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class NodeGroupsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -290,21 +305,52 @@ export class NodeGroupsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/node_templates_client.ts b/packages/google-cloud-compute/src/v1/node_templates_client.ts index 249c407c674..51f96c98955 100644 --- a/packages/google-cloud-compute/src/v1/node_templates_client.ts +++ b/packages/google-cloud-compute/src/v1/node_templates_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/node_templates_client_config.json`. @@ -51,6 +52,8 @@ export class NodeTemplatesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class NodeTemplatesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof NodeTemplatesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class NodeTemplatesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class NodeTemplatesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -279,21 +294,52 @@ export class NodeTemplatesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/node_types_client.ts b/packages/google-cloud-compute/src/v1/node_types_client.ts index cd43d378a28..e4019ff682f 100644 --- a/packages/google-cloud-compute/src/v1/node_types_client.ts +++ b/packages/google-cloud-compute/src/v1/node_types_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/node_types_client_config.json`. @@ -50,6 +51,8 @@ export class NodeTypesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class NodeTypesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof NodeTypesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class NodeTypesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class NodeTypesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -269,21 +284,52 @@ export class NodeTypesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/packet_mirrorings_client.ts b/packages/google-cloud-compute/src/v1/packet_mirrorings_client.ts index 9afde60c213..0f58e032f77 100644 --- a/packages/google-cloud-compute/src/v1/packet_mirrorings_client.ts +++ b/packages/google-cloud-compute/src/v1/packet_mirrorings_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/packet_mirrorings_client_config.json`. @@ -51,6 +52,8 @@ export class PacketMirroringsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class PacketMirroringsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof PacketMirroringsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class PacketMirroringsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class PacketMirroringsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -278,21 +293,52 @@ export class PacketMirroringsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/projects_client.ts b/packages/google-cloud-compute/src/v1/projects_client.ts index 3245d1f906b..1ac1c000c8e 100644 --- a/packages/google-cloud-compute/src/v1/projects_client.ts +++ b/packages/google-cloud-compute/src/v1/projects_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/projects_client_config.json`. @@ -51,6 +52,8 @@ export class ProjectsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class ProjectsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ProjectsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class ProjectsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class ProjectsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -284,21 +299,52 @@ export class ProjectsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/public_advertised_prefixes_client.ts b/packages/google-cloud-compute/src/v1/public_advertised_prefixes_client.ts index 126fbb5f439..821b18cf224 100644 --- a/packages/google-cloud-compute/src/v1/public_advertised_prefixes_client.ts +++ b/packages/google-cloud-compute/src/v1/public_advertised_prefixes_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/public_advertised_prefixes_client_config.json`. @@ -51,6 +52,8 @@ export class PublicAdvertisedPrefixesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class PublicAdvertisedPrefixesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof PublicAdvertisedPrefixesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class PublicAdvertisedPrefixesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class PublicAdvertisedPrefixesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -275,21 +290,52 @@ export class PublicAdvertisedPrefixesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/public_delegated_prefixes_client.ts b/packages/google-cloud-compute/src/v1/public_delegated_prefixes_client.ts index 9b89266322f..1962fbb92b3 100644 --- a/packages/google-cloud-compute/src/v1/public_delegated_prefixes_client.ts +++ b/packages/google-cloud-compute/src/v1/public_delegated_prefixes_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/public_delegated_prefixes_client_config.json`. @@ -51,6 +52,8 @@ export class PublicDelegatedPrefixesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class PublicDelegatedPrefixesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof PublicDelegatedPrefixesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class PublicDelegatedPrefixesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class PublicDelegatedPrefixesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -280,21 +295,52 @@ export class PublicDelegatedPrefixesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_autoscalers_client.ts b/packages/google-cloud-compute/src/v1/region_autoscalers_client.ts index f97c045b06d..c93363394fc 100644 --- a/packages/google-cloud-compute/src/v1/region_autoscalers_client.ts +++ b/packages/google-cloud-compute/src/v1/region_autoscalers_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_autoscalers_client_config.json`. @@ -51,6 +52,8 @@ export class RegionAutoscalersClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class RegionAutoscalersClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionAutoscalersClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class RegionAutoscalersClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class RegionAutoscalersClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -272,21 +287,52 @@ export class RegionAutoscalersClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_backend_services_client.ts b/packages/google-cloud-compute/src/v1/region_backend_services_client.ts index 0403e201e90..3ca0abcf691 100644 --- a/packages/google-cloud-compute/src/v1/region_backend_services_client.ts +++ b/packages/google-cloud-compute/src/v1/region_backend_services_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_backend_services_client_config.json`. @@ -51,6 +52,8 @@ export class RegionBackendServicesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionBackendServicesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionBackendServicesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionBackendServicesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionBackendServicesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -284,21 +299,52 @@ export class RegionBackendServicesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_commitments_client.ts b/packages/google-cloud-compute/src/v1/region_commitments_client.ts index 64f729e738e..e31820df754 100644 --- a/packages/google-cloud-compute/src/v1/region_commitments_client.ts +++ b/packages/google-cloud-compute/src/v1/region_commitments_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_commitments_client_config.json`. @@ -51,6 +52,8 @@ export class RegionCommitmentsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class RegionCommitmentsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionCommitmentsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class RegionCommitmentsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class RegionCommitmentsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -276,21 +291,52 @@ export class RegionCommitmentsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_disk_types_client.ts b/packages/google-cloud-compute/src/v1/region_disk_types_client.ts index 3975087439e..ce9a5c1456e 100644 --- a/packages/google-cloud-compute/src/v1/region_disk_types_client.ts +++ b/packages/google-cloud-compute/src/v1/region_disk_types_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_disk_types_client_config.json`. @@ -50,6 +51,8 @@ export class RegionDiskTypesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class RegionDiskTypesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionDiskTypesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class RegionDiskTypesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class RegionDiskTypesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -264,21 +279,52 @@ export class RegionDiskTypesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_disks_client.ts b/packages/google-cloud-compute/src/v1/region_disks_client.ts index 8dfa6eafda3..f0b050e98f0 100644 --- a/packages/google-cloud-compute/src/v1/region_disks_client.ts +++ b/packages/google-cloud-compute/src/v1/region_disks_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_disks_client_config.json`. @@ -51,6 +52,8 @@ export class RegionDisksClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class RegionDisksClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionDisksClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class RegionDisksClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class RegionDisksClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -283,21 +298,52 @@ export class RegionDisksClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_health_check_services_client.ts b/packages/google-cloud-compute/src/v1/region_health_check_services_client.ts index e7d56425f26..91f99227f9a 100644 --- a/packages/google-cloud-compute/src/v1/region_health_check_services_client.ts +++ b/packages/google-cloud-compute/src/v1/region_health_check_services_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_health_check_services_client_config.json`. @@ -51,6 +52,8 @@ export class RegionHealthCheckServicesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionHealthCheckServicesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionHealthCheckServicesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionHealthCheckServicesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionHealthCheckServicesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -273,21 +288,52 @@ export class RegionHealthCheckServicesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_health_checks_client.ts b/packages/google-cloud-compute/src/v1/region_health_checks_client.ts index c98d185f755..b588987001c 100644 --- a/packages/google-cloud-compute/src/v1/region_health_checks_client.ts +++ b/packages/google-cloud-compute/src/v1/region_health_checks_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_health_checks_client_config.json`. @@ -51,6 +52,8 @@ export class RegionHealthChecksClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class RegionHealthChecksClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionHealthChecksClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class RegionHealthChecksClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class RegionHealthChecksClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -272,21 +287,52 @@ export class RegionHealthChecksClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_instance_group_managers_client.ts b/packages/google-cloud-compute/src/v1/region_instance_group_managers_client.ts index 06722fa17c9..ffb86ced87a 100644 --- a/packages/google-cloud-compute/src/v1/region_instance_group_managers_client.ts +++ b/packages/google-cloud-compute/src/v1/region_instance_group_managers_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_instance_group_managers_client_config.json`. @@ -51,6 +52,8 @@ export class RegionInstanceGroupManagersClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionInstanceGroupManagersClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionInstanceGroupManagersClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionInstanceGroupManagersClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionInstanceGroupManagersClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -302,21 +317,52 @@ export class RegionInstanceGroupManagersClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_instance_groups_client.ts b/packages/google-cloud-compute/src/v1/region_instance_groups_client.ts index 93ba07e7a62..e82b67afbae 100644 --- a/packages/google-cloud-compute/src/v1/region_instance_groups_client.ts +++ b/packages/google-cloud-compute/src/v1/region_instance_groups_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_instance_groups_client_config.json`. @@ -51,6 +52,8 @@ export class RegionInstanceGroupsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class RegionInstanceGroupsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionInstanceGroupsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class RegionInstanceGroupsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class RegionInstanceGroupsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -275,21 +290,52 @@ export class RegionInstanceGroupsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_instance_templates_client.ts b/packages/google-cloud-compute/src/v1/region_instance_templates_client.ts index d827a756d96..412172a5c85 100644 --- a/packages/google-cloud-compute/src/v1/region_instance_templates_client.ts +++ b/packages/google-cloud-compute/src/v1/region_instance_templates_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_instance_templates_client_config.json`. @@ -51,6 +52,8 @@ export class RegionInstanceTemplatesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionInstanceTemplatesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionInstanceTemplatesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionInstanceTemplatesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionInstanceTemplatesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -271,21 +286,52 @@ export class RegionInstanceTemplatesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_instances_client.ts b/packages/google-cloud-compute/src/v1/region_instances_client.ts index e38da6fcc99..39a9e65681b 100644 --- a/packages/google-cloud-compute/src/v1/region_instances_client.ts +++ b/packages/google-cloud-compute/src/v1/region_instances_client.ts @@ -28,6 +28,7 @@ import type { import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_instances_client_config.json`. @@ -49,6 +50,8 @@ export class RegionInstancesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -105,8 +108,20 @@ export class RegionInstancesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionInstancesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -124,7 +139,7 @@ export class RegionInstancesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -146,10 +161,10 @@ export class RegionInstancesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -252,21 +267,52 @@ export class RegionInstancesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_network_endpoint_groups_client.ts b/packages/google-cloud-compute/src/v1/region_network_endpoint_groups_client.ts index 4c6b8dcfe8f..d128c82b206 100644 --- a/packages/google-cloud-compute/src/v1/region_network_endpoint_groups_client.ts +++ b/packages/google-cloud-compute/src/v1/region_network_endpoint_groups_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_network_endpoint_groups_client_config.json`. @@ -51,6 +52,8 @@ export class RegionNetworkEndpointGroupsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionNetworkEndpointGroupsClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionNetworkEndpointGroupsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionNetworkEndpointGroupsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionNetworkEndpointGroupsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -280,21 +295,52 @@ export class RegionNetworkEndpointGroupsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_network_firewall_policies_client.ts b/packages/google-cloud-compute/src/v1/region_network_firewall_policies_client.ts index 6f040750bb8..b6cb72388f8 100644 --- a/packages/google-cloud-compute/src/v1/region_network_firewall_policies_client.ts +++ b/packages/google-cloud-compute/src/v1/region_network_firewall_policies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_network_firewall_policies_client_config.json`. @@ -51,6 +52,8 @@ export class RegionNetworkFirewallPoliciesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionNetworkFirewallPoliciesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionNetworkFirewallPoliciesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionNetworkFirewallPoliciesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionNetworkFirewallPoliciesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -285,21 +300,52 @@ export class RegionNetworkFirewallPoliciesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_notification_endpoints_client.ts b/packages/google-cloud-compute/src/v1/region_notification_endpoints_client.ts index 7aef27ad696..f9ac132d98b 100644 --- a/packages/google-cloud-compute/src/v1/region_notification_endpoints_client.ts +++ b/packages/google-cloud-compute/src/v1/region_notification_endpoints_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_notification_endpoints_client_config.json`. @@ -51,6 +52,8 @@ export class RegionNotificationEndpointsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionNotificationEndpointsClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionNotificationEndpointsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionNotificationEndpointsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionNotificationEndpointsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -272,21 +287,52 @@ export class RegionNotificationEndpointsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_operations_client.ts b/packages/google-cloud-compute/src/v1/region_operations_client.ts index ac7a4017135..2efd7a7543b 100644 --- a/packages/google-cloud-compute/src/v1/region_operations_client.ts +++ b/packages/google-cloud-compute/src/v1/region_operations_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_operations_client_config.json`. @@ -50,6 +51,8 @@ export class RegionOperationsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class RegionOperationsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionOperationsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class RegionOperationsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class RegionOperationsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -264,21 +279,52 @@ export class RegionOperationsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_security_policies_client.ts b/packages/google-cloud-compute/src/v1/region_security_policies_client.ts index 3780705fe82..7a35cec7549 100644 --- a/packages/google-cloud-compute/src/v1/region_security_policies_client.ts +++ b/packages/google-cloud-compute/src/v1/region_security_policies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_security_policies_client_config.json`. @@ -51,6 +52,8 @@ export class RegionSecurityPoliciesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionSecurityPoliciesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionSecurityPoliciesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionSecurityPoliciesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionSecurityPoliciesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -276,21 +291,52 @@ export class RegionSecurityPoliciesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_ssl_certificates_client.ts b/packages/google-cloud-compute/src/v1/region_ssl_certificates_client.ts index 8cdb6ec3730..ed4d124bd4c 100644 --- a/packages/google-cloud-compute/src/v1/region_ssl_certificates_client.ts +++ b/packages/google-cloud-compute/src/v1/region_ssl_certificates_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_ssl_certificates_client_config.json`. @@ -51,6 +52,8 @@ export class RegionSslCertificatesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionSslCertificatesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionSslCertificatesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionSslCertificatesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionSslCertificatesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -271,21 +286,52 @@ export class RegionSslCertificatesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_ssl_policies_client.ts b/packages/google-cloud-compute/src/v1/region_ssl_policies_client.ts index d43feacac24..2b07566f21a 100644 --- a/packages/google-cloud-compute/src/v1/region_ssl_policies_client.ts +++ b/packages/google-cloud-compute/src/v1/region_ssl_policies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_ssl_policies_client_config.json`. @@ -51,6 +52,8 @@ export class RegionSslPoliciesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class RegionSslPoliciesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionSslPoliciesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class RegionSslPoliciesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class RegionSslPoliciesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -272,21 +287,52 @@ export class RegionSslPoliciesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_target_http_proxies_client.ts b/packages/google-cloud-compute/src/v1/region_target_http_proxies_client.ts index f929d44aa97..bee16396a86 100644 --- a/packages/google-cloud-compute/src/v1/region_target_http_proxies_client.ts +++ b/packages/google-cloud-compute/src/v1/region_target_http_proxies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_target_http_proxies_client_config.json`. @@ -51,6 +52,8 @@ export class RegionTargetHttpProxiesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionTargetHttpProxiesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionTargetHttpProxiesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionTargetHttpProxiesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionTargetHttpProxiesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -272,21 +287,52 @@ export class RegionTargetHttpProxiesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_target_https_proxies_client.ts b/packages/google-cloud-compute/src/v1/region_target_https_proxies_client.ts index 921794143e0..31d7001ed88 100644 --- a/packages/google-cloud-compute/src/v1/region_target_https_proxies_client.ts +++ b/packages/google-cloud-compute/src/v1/region_target_https_proxies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_target_https_proxies_client_config.json`. @@ -51,6 +52,8 @@ export class RegionTargetHttpsProxiesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionTargetHttpsProxiesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionTargetHttpsProxiesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionTargetHttpsProxiesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionTargetHttpsProxiesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -275,21 +290,52 @@ export class RegionTargetHttpsProxiesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_target_tcp_proxies_client.ts b/packages/google-cloud-compute/src/v1/region_target_tcp_proxies_client.ts index 3a46eb65e3c..008f5f8b285 100644 --- a/packages/google-cloud-compute/src/v1/region_target_tcp_proxies_client.ts +++ b/packages/google-cloud-compute/src/v1/region_target_tcp_proxies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_target_tcp_proxies_client_config.json`. @@ -51,6 +52,8 @@ export class RegionTargetTcpProxiesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -108,8 +111,20 @@ export class RegionTargetTcpProxiesClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof RegionTargetTcpProxiesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -127,7 +142,7 @@ export class RegionTargetTcpProxiesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -149,10 +164,10 @@ export class RegionTargetTcpProxiesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -271,21 +286,52 @@ export class RegionTargetTcpProxiesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/region_url_maps_client.ts b/packages/google-cloud-compute/src/v1/region_url_maps_client.ts index 4e5b247d8f9..3a12bd6eac1 100644 --- a/packages/google-cloud-compute/src/v1/region_url_maps_client.ts +++ b/packages/google-cloud-compute/src/v1/region_url_maps_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/region_url_maps_client_config.json`. @@ -51,6 +52,8 @@ export class RegionUrlMapsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class RegionUrlMapsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionUrlMapsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class RegionUrlMapsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class RegionUrlMapsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -273,21 +288,52 @@ export class RegionUrlMapsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/regions_client.ts b/packages/google-cloud-compute/src/v1/regions_client.ts index 7b710d7e346..9cecfb7e3ec 100644 --- a/packages/google-cloud-compute/src/v1/regions_client.ts +++ b/packages/google-cloud-compute/src/v1/regions_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/regions_client_config.json`. @@ -50,6 +51,8 @@ export class RegionsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class RegionsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class RegionsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class RegionsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -264,21 +279,52 @@ export class RegionsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/reservations_client.ts b/packages/google-cloud-compute/src/v1/reservations_client.ts index 8e6dc26b398..f8c0039c9a0 100644 --- a/packages/google-cloud-compute/src/v1/reservations_client.ts +++ b/packages/google-cloud-compute/src/v1/reservations_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/reservations_client_config.json`. @@ -51,6 +52,8 @@ export class ReservationsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class ReservationsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ReservationsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class ReservationsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class ReservationsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -281,21 +296,52 @@ export class ReservationsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/resource_policies_client.ts b/packages/google-cloud-compute/src/v1/resource_policies_client.ts index 44075c9ba23..175605e8bd3 100644 --- a/packages/google-cloud-compute/src/v1/resource_policies_client.ts +++ b/packages/google-cloud-compute/src/v1/resource_policies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/resource_policies_client_config.json`. @@ -51,6 +52,8 @@ export class ResourcePoliciesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class ResourcePoliciesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ResourcePoliciesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class ResourcePoliciesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class ResourcePoliciesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -280,21 +295,52 @@ export class ResourcePoliciesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/routers_client.ts b/packages/google-cloud-compute/src/v1/routers_client.ts index 41347b8af9c..4655cdb954e 100644 --- a/packages/google-cloud-compute/src/v1/routers_client.ts +++ b/packages/google-cloud-compute/src/v1/routers_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/routers_client_config.json`. @@ -51,6 +52,8 @@ export class RoutersClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class RoutersClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RoutersClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class RoutersClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class RoutersClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -287,21 +302,52 @@ export class RoutersClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/routes_client.ts b/packages/google-cloud-compute/src/v1/routes_client.ts index c210abb1aa2..8830d35a0e4 100644 --- a/packages/google-cloud-compute/src/v1/routes_client.ts +++ b/packages/google-cloud-compute/src/v1/routes_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/routes_client_config.json`. @@ -51,6 +52,8 @@ export class RoutesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class RoutesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RoutesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class RoutesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class RoutesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -265,21 +280,52 @@ export class RoutesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/security_policies_client.ts b/packages/google-cloud-compute/src/v1/security_policies_client.ts index 9b58b9f37ad..0c84e8bfa10 100644 --- a/packages/google-cloud-compute/src/v1/security_policies_client.ts +++ b/packages/google-cloud-compute/src/v1/security_policies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/security_policies_client_config.json`. @@ -51,6 +52,8 @@ export class SecurityPoliciesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class SecurityPoliciesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SecurityPoliciesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class SecurityPoliciesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class SecurityPoliciesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -283,21 +298,52 @@ export class SecurityPoliciesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/service_attachments_client.ts b/packages/google-cloud-compute/src/v1/service_attachments_client.ts index 641dc347c33..f4447ddcb6f 100644 --- a/packages/google-cloud-compute/src/v1/service_attachments_client.ts +++ b/packages/google-cloud-compute/src/v1/service_attachments_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/service_attachments_client_config.json`. @@ -51,6 +52,8 @@ export class ServiceAttachmentsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class ServiceAttachmentsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ServiceAttachmentsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class ServiceAttachmentsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class ServiceAttachmentsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -280,21 +295,52 @@ export class ServiceAttachmentsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/snapshot_settings_service_client.ts b/packages/google-cloud-compute/src/v1/snapshot_settings_service_client.ts index 0a31224ab82..f51c5c01667 100644 --- a/packages/google-cloud-compute/src/v1/snapshot_settings_service_client.ts +++ b/packages/google-cloud-compute/src/v1/snapshot_settings_service_client.ts @@ -28,6 +28,7 @@ import type { import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/snapshot_settings_service_client_config.json`. @@ -49,6 +50,8 @@ export class SnapshotSettingsServiceClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class SnapshotSettingsServiceClient { // Ensure that options include all the required fields. const staticMembers = this .constructor as typeof SnapshotSettingsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class SnapshotSettingsServiceClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class SnapshotSettingsServiceClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -253,21 +268,52 @@ export class SnapshotSettingsServiceClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/snapshots_client.ts b/packages/google-cloud-compute/src/v1/snapshots_client.ts index 5b5bc9636c4..b41314dd12d 100644 --- a/packages/google-cloud-compute/src/v1/snapshots_client.ts +++ b/packages/google-cloud-compute/src/v1/snapshots_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/snapshots_client_config.json`. @@ -51,6 +52,8 @@ export class SnapshotsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class SnapshotsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SnapshotsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class SnapshotsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class SnapshotsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -274,21 +289,52 @@ export class SnapshotsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/ssl_certificates_client.ts b/packages/google-cloud-compute/src/v1/ssl_certificates_client.ts index bf415147af5..dd21a5a4bab 100644 --- a/packages/google-cloud-compute/src/v1/ssl_certificates_client.ts +++ b/packages/google-cloud-compute/src/v1/ssl_certificates_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/ssl_certificates_client_config.json`. @@ -51,6 +52,8 @@ export class SslCertificatesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class SslCertificatesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SslCertificatesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class SslCertificatesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class SslCertificatesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -276,21 +291,52 @@ export class SslCertificatesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/ssl_policies_client.ts b/packages/google-cloud-compute/src/v1/ssl_policies_client.ts index d041955f558..e86092daae0 100644 --- a/packages/google-cloud-compute/src/v1/ssl_policies_client.ts +++ b/packages/google-cloud-compute/src/v1/ssl_policies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/ssl_policies_client_config.json`. @@ -51,6 +52,8 @@ export class SslPoliciesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class SslPoliciesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SslPoliciesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class SslPoliciesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class SslPoliciesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -278,21 +293,52 @@ export class SslPoliciesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/subnetworks_client.ts b/packages/google-cloud-compute/src/v1/subnetworks_client.ts index f5e1212dd85..13f46764a18 100644 --- a/packages/google-cloud-compute/src/v1/subnetworks_client.ts +++ b/packages/google-cloud-compute/src/v1/subnetworks_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/subnetworks_client_config.json`. @@ -51,6 +52,8 @@ export class SubnetworksClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class SubnetworksClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SubnetworksClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class SubnetworksClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class SubnetworksClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -288,21 +303,52 @@ export class SubnetworksClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/target_grpc_proxies_client.ts b/packages/google-cloud-compute/src/v1/target_grpc_proxies_client.ts index 2bcc6ff7bf3..97fee3bad93 100644 --- a/packages/google-cloud-compute/src/v1/target_grpc_proxies_client.ts +++ b/packages/google-cloud-compute/src/v1/target_grpc_proxies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/target_grpc_proxies_client_config.json`. @@ -51,6 +52,8 @@ export class TargetGrpcProxiesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class TargetGrpcProxiesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof TargetGrpcProxiesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class TargetGrpcProxiesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class TargetGrpcProxiesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -271,21 +286,52 @@ export class TargetGrpcProxiesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/target_http_proxies_client.ts b/packages/google-cloud-compute/src/v1/target_http_proxies_client.ts index b66fd04fe9a..f6a88728c0d 100644 --- a/packages/google-cloud-compute/src/v1/target_http_proxies_client.ts +++ b/packages/google-cloud-compute/src/v1/target_http_proxies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/target_http_proxies_client_config.json`. @@ -51,6 +52,8 @@ export class TargetHttpProxiesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class TargetHttpProxiesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof TargetHttpProxiesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class TargetHttpProxiesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class TargetHttpProxiesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -278,21 +293,52 @@ export class TargetHttpProxiesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/target_https_proxies_client.ts b/packages/google-cloud-compute/src/v1/target_https_proxies_client.ts index e662d3ebf96..d2e3146f2c2 100644 --- a/packages/google-cloud-compute/src/v1/target_https_proxies_client.ts +++ b/packages/google-cloud-compute/src/v1/target_https_proxies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/target_https_proxies_client_config.json`. @@ -51,6 +52,8 @@ export class TargetHttpsProxiesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class TargetHttpsProxiesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof TargetHttpsProxiesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class TargetHttpsProxiesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class TargetHttpsProxiesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -282,21 +297,52 @@ export class TargetHttpsProxiesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/target_instances_client.ts b/packages/google-cloud-compute/src/v1/target_instances_client.ts index 40ed9fb3324..3508da0c76e 100644 --- a/packages/google-cloud-compute/src/v1/target_instances_client.ts +++ b/packages/google-cloud-compute/src/v1/target_instances_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/target_instances_client_config.json`. @@ -51,6 +52,8 @@ export class TargetInstancesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class TargetInstancesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof TargetInstancesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class TargetInstancesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class TargetInstancesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -277,21 +292,52 @@ export class TargetInstancesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/target_pools_client.ts b/packages/google-cloud-compute/src/v1/target_pools_client.ts index a689ce49f36..88b5b03b0ea 100644 --- a/packages/google-cloud-compute/src/v1/target_pools_client.ts +++ b/packages/google-cloud-compute/src/v1/target_pools_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/target_pools_client_config.json`. @@ -51,6 +52,8 @@ export class TargetPoolsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class TargetPoolsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof TargetPoolsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class TargetPoolsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class TargetPoolsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -283,21 +298,52 @@ export class TargetPoolsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/target_ssl_proxies_client.ts b/packages/google-cloud-compute/src/v1/target_ssl_proxies_client.ts index cffd1ea0f1a..f43f54e4ebe 100644 --- a/packages/google-cloud-compute/src/v1/target_ssl_proxies_client.ts +++ b/packages/google-cloud-compute/src/v1/target_ssl_proxies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/target_ssl_proxies_client_config.json`. @@ -51,6 +52,8 @@ export class TargetSslProxiesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class TargetSslProxiesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof TargetSslProxiesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class TargetSslProxiesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class TargetSslProxiesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -275,21 +290,52 @@ export class TargetSslProxiesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/target_tcp_proxies_client.ts b/packages/google-cloud-compute/src/v1/target_tcp_proxies_client.ts index ad69fb67b55..ba179fca223 100644 --- a/packages/google-cloud-compute/src/v1/target_tcp_proxies_client.ts +++ b/packages/google-cloud-compute/src/v1/target_tcp_proxies_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/target_tcp_proxies_client_config.json`. @@ -51,6 +52,8 @@ export class TargetTcpProxiesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class TargetTcpProxiesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof TargetTcpProxiesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class TargetTcpProxiesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class TargetTcpProxiesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -278,21 +293,52 @@ export class TargetTcpProxiesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/target_vpn_gateways_client.ts b/packages/google-cloud-compute/src/v1/target_vpn_gateways_client.ts index c8eddf81c30..a4f318c22eb 100644 --- a/packages/google-cloud-compute/src/v1/target_vpn_gateways_client.ts +++ b/packages/google-cloud-compute/src/v1/target_vpn_gateways_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/target_vpn_gateways_client_config.json`. @@ -51,6 +52,8 @@ export class TargetVpnGatewaysClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class TargetVpnGatewaysClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof TargetVpnGatewaysClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class TargetVpnGatewaysClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class TargetVpnGatewaysClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -277,21 +292,52 @@ export class TargetVpnGatewaysClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/url_maps_client.ts b/packages/google-cloud-compute/src/v1/url_maps_client.ts index 79782b3e567..efdf050011a 100644 --- a/packages/google-cloud-compute/src/v1/url_maps_client.ts +++ b/packages/google-cloud-compute/src/v1/url_maps_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/url_maps_client_config.json`. @@ -51,6 +52,8 @@ export class UrlMapsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class UrlMapsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof UrlMapsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class UrlMapsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class UrlMapsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -280,21 +295,52 @@ export class UrlMapsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/vpn_gateways_client.ts b/packages/google-cloud-compute/src/v1/vpn_gateways_client.ts index 1c4dfda89b1..f15b6780167 100644 --- a/packages/google-cloud-compute/src/v1/vpn_gateways_client.ts +++ b/packages/google-cloud-compute/src/v1/vpn_gateways_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/vpn_gateways_client_config.json`. @@ -51,6 +52,8 @@ export class VpnGatewaysClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class VpnGatewaysClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof VpnGatewaysClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class VpnGatewaysClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class VpnGatewaysClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -279,21 +294,52 @@ export class VpnGatewaysClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/vpn_tunnels_client.ts b/packages/google-cloud-compute/src/v1/vpn_tunnels_client.ts index 3c0d86a33a2..9709d28cbf4 100644 --- a/packages/google-cloud-compute/src/v1/vpn_tunnels_client.ts +++ b/packages/google-cloud-compute/src/v1/vpn_tunnels_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/vpn_tunnels_client_config.json`. @@ -51,6 +52,8 @@ export class VpnTunnelsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -107,8 +110,20 @@ export class VpnTunnelsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof VpnTunnelsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -126,7 +141,7 @@ export class VpnTunnelsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -148,10 +163,10 @@ export class VpnTunnelsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -277,21 +292,52 @@ export class VpnTunnelsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/zone_operations_client.ts b/packages/google-cloud-compute/src/v1/zone_operations_client.ts index 9dba1cc84a1..1493c6b125c 100644 --- a/packages/google-cloud-compute/src/v1/zone_operations_client.ts +++ b/packages/google-cloud-compute/src/v1/zone_operations_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/zone_operations_client_config.json`. @@ -50,6 +51,8 @@ export class ZoneOperationsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class ZoneOperationsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ZoneOperationsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class ZoneOperationsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class ZoneOperationsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -264,21 +279,52 @@ export class ZoneOperationsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1/zones_client.ts b/packages/google-cloud-compute/src/v1/zones_client.ts index 29d175ceacd..dd35649ab33 100644 --- a/packages/google-cloud-compute/src/v1/zones_client.ts +++ b/packages/google-cloud-compute/src/v1/zones_client.ts @@ -29,6 +29,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1/zones_client_config.json`. @@ -50,6 +51,8 @@ export class ZonesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -106,8 +109,20 @@ export class ZonesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ZonesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -125,7 +140,7 @@ export class ZonesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -147,10 +162,10 @@ export class ZonesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -264,21 +279,52 @@ export class ZonesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1small/addresses_client.ts b/packages/google-cloud-compute/src/v1small/addresses_client.ts index 13cac7023cc..ce2fa32d857 100644 --- a/packages/google-cloud-compute/src/v1small/addresses_client.ts +++ b/packages/google-cloud-compute/src/v1small/addresses_client.ts @@ -30,6 +30,7 @@ import type { import {Transform} from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1small/addresses_client_config.json`. @@ -54,6 +55,8 @@ export class AddressesClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -110,8 +113,20 @@ export class AddressesClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof AddressesClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -129,7 +144,7 @@ export class AddressesClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -151,10 +166,10 @@ export class AddressesClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -273,21 +288,52 @@ export class AddressesClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/src/v1small/region_operations_client.ts b/packages/google-cloud-compute/src/v1small/region_operations_client.ts index 843e10bf5ae..501ca65ae8f 100644 --- a/packages/google-cloud-compute/src/v1small/region_operations_client.ts +++ b/packages/google-cloud-compute/src/v1small/region_operations_client.ts @@ -27,6 +27,7 @@ import type { import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); + /** * Client JSON configuration object, loaded from * `src/v1small/region_operations_client_config.json`. @@ -48,6 +49,8 @@ export class RegionOperationsClient { private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; auth: gax.GoogleAuth; descriptors: Descriptors = { page: {}, @@ -104,8 +107,20 @@ export class RegionOperationsClient { ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof RegionOperationsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.' + ); + } + this._universeDomain = + opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com'; + this._servicePath = 'compute.' + this._universeDomain; const servicePath = - opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + opts?.servicePath || opts?.apiEndpoint || this._servicePath; this._providedCustomServicePath = !!( opts?.servicePath || opts?.apiEndpoint ); @@ -123,7 +138,7 @@ export class RegionOperationsClient { opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + if (servicePath !== this._servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -145,10 +160,10 @@ export class RegionOperationsClient { this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; + this.auth.defaultServicePath = this._servicePath; // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { + if (servicePath === this._servicePath) { this.auth.defaultScopes = staticMembers.scopes; } @@ -251,21 +266,52 @@ export class RegionOperationsClient { /** * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get servicePath() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { + if ( + typeof process !== undefined && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning' + ); + } return 'compute.googleapis.com'; } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + /** * The port for this API service. * @returns {number} The default port for this service. diff --git a/packages/google-cloud-compute/test/gapic_accelerator_types_v1.ts b/packages/google-cloud-compute/test/gapic_accelerator_types_v1.ts index 290f02610ce..9b4f41a0104 100644 --- a/packages/google-cloud-compute/test/gapic_accelerator_types_v1.ts +++ b/packages/google-cloud-compute/test/gapic_accelerator_types_v1.ts @@ -142,16 +142,62 @@ describe('v1.AcceleratorTypesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - acceleratortypesModule.v1.AcceleratorTypesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new acceleratortypesModule.v1.AcceleratorTypesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - acceleratortypesModule.v1.AcceleratorTypesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new acceleratortypesModule.v1.AcceleratorTypesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + acceleratortypesModule.v1.AcceleratorTypesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + acceleratortypesModule.v1.AcceleratorTypesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new acceleratortypesModule.v1.AcceleratorTypesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new acceleratortypesModule.v1.AcceleratorTypesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new acceleratortypesModule.v1.AcceleratorTypesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_addresses_v1.ts b/packages/google-cloud-compute/test/gapic_addresses_v1.ts index bfddfb8a705..406a6c36f71 100644 --- a/packages/google-cloud-compute/test/gapic_addresses_v1.ts +++ b/packages/google-cloud-compute/test/gapic_addresses_v1.ts @@ -142,14 +142,60 @@ describe('v1.AddressesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = addressesModule.v1.AddressesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new addressesModule.v1.AddressesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = addressesModule.v1.AddressesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new addressesModule.v1.AddressesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = addressesModule.v1.AddressesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = addressesModule.v1.AddressesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new addressesModule.v1.AddressesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new addressesModule.v1.AddressesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new addressesModule.v1.AddressesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_addresses_v1small.ts b/packages/google-cloud-compute/test/gapic_addresses_v1small.ts index 54267ef49f2..c1897b2ecd1 100644 --- a/packages/google-cloud-compute/test/gapic_addresses_v1small.ts +++ b/packages/google-cloud-compute/test/gapic_addresses_v1small.ts @@ -142,14 +142,60 @@ describe('v1small.AddressesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = addressesModule.v1small.AddressesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new addressesModule.v1small.AddressesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = addressesModule.v1small.AddressesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new addressesModule.v1small.AddressesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = addressesModule.v1small.AddressesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = addressesModule.v1small.AddressesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new addressesModule.v1small.AddressesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new addressesModule.v1small.AddressesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new addressesModule.v1small.AddressesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_autoscalers_v1.ts b/packages/google-cloud-compute/test/gapic_autoscalers_v1.ts index 522c2be9111..9545944d9cd 100644 --- a/packages/google-cloud-compute/test/gapic_autoscalers_v1.ts +++ b/packages/google-cloud-compute/test/gapic_autoscalers_v1.ts @@ -142,14 +142,60 @@ describe('v1.AutoscalersClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = autoscalersModule.v1.AutoscalersClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new autoscalersModule.v1.AutoscalersClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = autoscalersModule.v1.AutoscalersClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new autoscalersModule.v1.AutoscalersClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = autoscalersModule.v1.AutoscalersClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = autoscalersModule.v1.AutoscalersClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new autoscalersModule.v1.AutoscalersClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new autoscalersModule.v1.AutoscalersClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new autoscalersModule.v1.AutoscalersClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_backend_buckets_v1.ts b/packages/google-cloud-compute/test/gapic_backend_buckets_v1.ts index 2f1086d88b7..5b9c9081979 100644 --- a/packages/google-cloud-compute/test/gapic_backend_buckets_v1.ts +++ b/packages/google-cloud-compute/test/gapic_backend_buckets_v1.ts @@ -142,16 +142,62 @@ describe('v1.BackendBucketsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - backendbucketsModule.v1.BackendBucketsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new backendbucketsModule.v1.BackendBucketsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - backendbucketsModule.v1.BackendBucketsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new backendbucketsModule.v1.BackendBucketsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + backendbucketsModule.v1.BackendBucketsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + backendbucketsModule.v1.BackendBucketsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new backendbucketsModule.v1.BackendBucketsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new backendbucketsModule.v1.BackendBucketsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new backendbucketsModule.v1.BackendBucketsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_backend_services_v1.ts b/packages/google-cloud-compute/test/gapic_backend_services_v1.ts index f65f0f8fdee..4dfcba562cc 100644 --- a/packages/google-cloud-compute/test/gapic_backend_services_v1.ts +++ b/packages/google-cloud-compute/test/gapic_backend_services_v1.ts @@ -142,16 +142,62 @@ describe('v1.BackendServicesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - backendservicesModule.v1.BackendServicesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new backendservicesModule.v1.BackendServicesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - backendservicesModule.v1.BackendServicesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new backendservicesModule.v1.BackendServicesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + backendservicesModule.v1.BackendServicesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + backendservicesModule.v1.BackendServicesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new backendservicesModule.v1.BackendServicesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new backendservicesModule.v1.BackendServicesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new backendservicesModule.v1.BackendServicesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_disk_types_v1.ts b/packages/google-cloud-compute/test/gapic_disk_types_v1.ts index 012c0106241..9b71f129aea 100644 --- a/packages/google-cloud-compute/test/gapic_disk_types_v1.ts +++ b/packages/google-cloud-compute/test/gapic_disk_types_v1.ts @@ -142,14 +142,60 @@ describe('v1.DiskTypesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = disktypesModule.v1.DiskTypesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new disktypesModule.v1.DiskTypesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = disktypesModule.v1.DiskTypesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new disktypesModule.v1.DiskTypesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = disktypesModule.v1.DiskTypesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = disktypesModule.v1.DiskTypesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new disktypesModule.v1.DiskTypesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new disktypesModule.v1.DiskTypesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new disktypesModule.v1.DiskTypesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_disks_v1.ts b/packages/google-cloud-compute/test/gapic_disks_v1.ts index b6b12f27ffc..45308940534 100644 --- a/packages/google-cloud-compute/test/gapic_disks_v1.ts +++ b/packages/google-cloud-compute/test/gapic_disks_v1.ts @@ -142,14 +142,60 @@ describe('v1.DisksClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = disksModule.v1.DisksClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new disksModule.v1.DisksClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = disksModule.v1.DisksClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new disksModule.v1.DisksClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = disksModule.v1.DisksClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = disksModule.v1.DisksClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new disksModule.v1.DisksClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new disksModule.v1.DisksClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new disksModule.v1.DisksClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_external_vpn_gateways_v1.ts b/packages/google-cloud-compute/test/gapic_external_vpn_gateways_v1.ts index 8135f168a14..0ca52bc498e 100644 --- a/packages/google-cloud-compute/test/gapic_external_vpn_gateways_v1.ts +++ b/packages/google-cloud-compute/test/gapic_external_vpn_gateways_v1.ts @@ -142,16 +142,64 @@ describe('v1.ExternalVpnGatewaysClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - externalvpngatewaysModule.v1.ExternalVpnGatewaysClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new externalvpngatewaysModule.v1.ExternalVpnGatewaysClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - externalvpngatewaysModule.v1.ExternalVpnGatewaysClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new externalvpngatewaysModule.v1.ExternalVpnGatewaysClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + externalvpngatewaysModule.v1.ExternalVpnGatewaysClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + externalvpngatewaysModule.v1.ExternalVpnGatewaysClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new externalvpngatewaysModule.v1.ExternalVpnGatewaysClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new externalvpngatewaysModule.v1.ExternalVpnGatewaysClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new externalvpngatewaysModule.v1.ExternalVpnGatewaysClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_firewall_policies_v1.ts b/packages/google-cloud-compute/test/gapic_firewall_policies_v1.ts index 575efa3ab9b..8baee29d4ae 100644 --- a/packages/google-cloud-compute/test/gapic_firewall_policies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_firewall_policies_v1.ts @@ -142,16 +142,62 @@ describe('v1.FirewallPoliciesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - firewallpoliciesModule.v1.FirewallPoliciesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new firewallpoliciesModule.v1.FirewallPoliciesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - firewallpoliciesModule.v1.FirewallPoliciesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new firewallpoliciesModule.v1.FirewallPoliciesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + firewallpoliciesModule.v1.FirewallPoliciesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + firewallpoliciesModule.v1.FirewallPoliciesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new firewallpoliciesModule.v1.FirewallPoliciesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new firewallpoliciesModule.v1.FirewallPoliciesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new firewallpoliciesModule.v1.FirewallPoliciesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_firewalls_v1.ts b/packages/google-cloud-compute/test/gapic_firewalls_v1.ts index bfee3b65a65..66d57da8c6b 100644 --- a/packages/google-cloud-compute/test/gapic_firewalls_v1.ts +++ b/packages/google-cloud-compute/test/gapic_firewalls_v1.ts @@ -142,14 +142,60 @@ describe('v1.FirewallsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = firewallsModule.v1.FirewallsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new firewallsModule.v1.FirewallsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = firewallsModule.v1.FirewallsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new firewallsModule.v1.FirewallsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = firewallsModule.v1.FirewallsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = firewallsModule.v1.FirewallsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new firewallsModule.v1.FirewallsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new firewallsModule.v1.FirewallsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new firewallsModule.v1.FirewallsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_forwarding_rules_v1.ts b/packages/google-cloud-compute/test/gapic_forwarding_rules_v1.ts index 6b898acebb8..d74f4263258 100644 --- a/packages/google-cloud-compute/test/gapic_forwarding_rules_v1.ts +++ b/packages/google-cloud-compute/test/gapic_forwarding_rules_v1.ts @@ -142,16 +142,62 @@ describe('v1.ForwardingRulesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - forwardingrulesModule.v1.ForwardingRulesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new forwardingrulesModule.v1.ForwardingRulesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - forwardingrulesModule.v1.ForwardingRulesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new forwardingrulesModule.v1.ForwardingRulesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + forwardingrulesModule.v1.ForwardingRulesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + forwardingrulesModule.v1.ForwardingRulesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new forwardingrulesModule.v1.ForwardingRulesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new forwardingrulesModule.v1.ForwardingRulesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new forwardingrulesModule.v1.ForwardingRulesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_global_addresses_v1.ts b/packages/google-cloud-compute/test/gapic_global_addresses_v1.ts index 3f03d7bf2bf..4629f9fa65f 100644 --- a/packages/google-cloud-compute/test/gapic_global_addresses_v1.ts +++ b/packages/google-cloud-compute/test/gapic_global_addresses_v1.ts @@ -142,16 +142,62 @@ describe('v1.GlobalAddressesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - globaladdressesModule.v1.GlobalAddressesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new globaladdressesModule.v1.GlobalAddressesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - globaladdressesModule.v1.GlobalAddressesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new globaladdressesModule.v1.GlobalAddressesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + globaladdressesModule.v1.GlobalAddressesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + globaladdressesModule.v1.GlobalAddressesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new globaladdressesModule.v1.GlobalAddressesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new globaladdressesModule.v1.GlobalAddressesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new globaladdressesModule.v1.GlobalAddressesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_global_forwarding_rules_v1.ts b/packages/google-cloud-compute/test/gapic_global_forwarding_rules_v1.ts index 061fa2d52b5..136b9a53123 100644 --- a/packages/google-cloud-compute/test/gapic_global_forwarding_rules_v1.ts +++ b/packages/google-cloud-compute/test/gapic_global_forwarding_rules_v1.ts @@ -142,16 +142,68 @@ describe('v1.GlobalForwardingRulesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - globalforwardingrulesModule.v1.GlobalForwardingRulesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new globalforwardingrulesModule.v1.GlobalForwardingRulesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - globalforwardingrulesModule.v1.GlobalForwardingRulesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new globalforwardingrulesModule.v1.GlobalForwardingRulesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + globalforwardingrulesModule.v1.GlobalForwardingRulesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + globalforwardingrulesModule.v1.GlobalForwardingRulesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new globalforwardingrulesModule.v1.GlobalForwardingRulesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new globalforwardingrulesModule.v1.GlobalForwardingRulesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new globalforwardingrulesModule.v1.GlobalForwardingRulesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_global_network_endpoint_groups_v1.ts b/packages/google-cloud-compute/test/gapic_global_network_endpoint_groups_v1.ts index 158770c39ef..013e0d73abc 100644 --- a/packages/google-cloud-compute/test/gapic_global_network_endpoint_groups_v1.ts +++ b/packages/google-cloud-compute/test/gapic_global_network_endpoint_groups_v1.ts @@ -142,18 +142,67 @@ describe('v1.GlobalNetworkEndpointGroupsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - globalnetworkendpointgroupsModule.v1.GlobalNetworkEndpointGroupsClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new globalnetworkendpointgroupsModule.v1.GlobalNetworkEndpointGroupsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - globalnetworkendpointgroupsModule.v1.GlobalNetworkEndpointGroupsClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new globalnetworkendpointgroupsModule.v1.GlobalNetworkEndpointGroupsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + globalnetworkendpointgroupsModule.v1.GlobalNetworkEndpointGroupsClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + globalnetworkendpointgroupsModule.v1.GlobalNetworkEndpointGroupsClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new globalnetworkendpointgroupsModule.v1.GlobalNetworkEndpointGroupsClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new globalnetworkendpointgroupsModule.v1.GlobalNetworkEndpointGroupsClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new globalnetworkendpointgroupsModule.v1.GlobalNetworkEndpointGroupsClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_global_operations_v1.ts b/packages/google-cloud-compute/test/gapic_global_operations_v1.ts index d9b1b7f85e6..88d78243e9d 100644 --- a/packages/google-cloud-compute/test/gapic_global_operations_v1.ts +++ b/packages/google-cloud-compute/test/gapic_global_operations_v1.ts @@ -142,16 +142,62 @@ describe('v1.GlobalOperationsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - globaloperationsModule.v1.GlobalOperationsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new globaloperationsModule.v1.GlobalOperationsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - globaloperationsModule.v1.GlobalOperationsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new globaloperationsModule.v1.GlobalOperationsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + globaloperationsModule.v1.GlobalOperationsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + globaloperationsModule.v1.GlobalOperationsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new globaloperationsModule.v1.GlobalOperationsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new globaloperationsModule.v1.GlobalOperationsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new globaloperationsModule.v1.GlobalOperationsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_global_organization_operations_v1.ts b/packages/google-cloud-compute/test/gapic_global_organization_operations_v1.ts index c12de9d6181..7c3b100d11c 100644 --- a/packages/google-cloud-compute/test/gapic_global_organization_operations_v1.ts +++ b/packages/google-cloud-compute/test/gapic_global_organization_operations_v1.ts @@ -142,18 +142,67 @@ describe('v1.GlobalOrganizationOperationsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - globalorganizationoperationsModule.v1.GlobalOrganizationOperationsClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new globalorganizationoperationsModule.v1.GlobalOrganizationOperationsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - globalorganizationoperationsModule.v1.GlobalOrganizationOperationsClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new globalorganizationoperationsModule.v1.GlobalOrganizationOperationsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + globalorganizationoperationsModule.v1 + .GlobalOrganizationOperationsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + globalorganizationoperationsModule.v1 + .GlobalOrganizationOperationsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new globalorganizationoperationsModule.v1.GlobalOrganizationOperationsClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new globalorganizationoperationsModule.v1.GlobalOrganizationOperationsClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new globalorganizationoperationsModule.v1.GlobalOrganizationOperationsClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_global_public_delegated_prefixes_v1.ts b/packages/google-cloud-compute/test/gapic_global_public_delegated_prefixes_v1.ts index a733cc3be99..a15701c54a7 100644 --- a/packages/google-cloud-compute/test/gapic_global_public_delegated_prefixes_v1.ts +++ b/packages/google-cloud-compute/test/gapic_global_public_delegated_prefixes_v1.ts @@ -142,18 +142,67 @@ describe('v1.GlobalPublicDelegatedPrefixesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - globalpublicdelegatedprefixesModule.v1 - .GlobalPublicDelegatedPrefixesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new globalpublicdelegatedprefixesModule.v1.GlobalPublicDelegatedPrefixesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - globalpublicdelegatedprefixesModule.v1 - .GlobalPublicDelegatedPrefixesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new globalpublicdelegatedprefixesModule.v1.GlobalPublicDelegatedPrefixesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + globalpublicdelegatedprefixesModule.v1 + .GlobalPublicDelegatedPrefixesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + globalpublicdelegatedprefixesModule.v1 + .GlobalPublicDelegatedPrefixesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new globalpublicdelegatedprefixesModule.v1.GlobalPublicDelegatedPrefixesClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new globalpublicdelegatedprefixesModule.v1.GlobalPublicDelegatedPrefixesClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new globalpublicdelegatedprefixesModule.v1.GlobalPublicDelegatedPrefixesClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_health_checks_v1.ts b/packages/google-cloud-compute/test/gapic_health_checks_v1.ts index cee45f6c39b..c06f9b63083 100644 --- a/packages/google-cloud-compute/test/gapic_health_checks_v1.ts +++ b/packages/google-cloud-compute/test/gapic_health_checks_v1.ts @@ -142,14 +142,62 @@ describe('v1.HealthChecksClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = healthchecksModule.v1.HealthChecksClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new healthchecksModule.v1.HealthChecksClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = healthchecksModule.v1.HealthChecksClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new healthchecksModule.v1.HealthChecksClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + healthchecksModule.v1.HealthChecksClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + healthchecksModule.v1.HealthChecksClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new healthchecksModule.v1.HealthChecksClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new healthchecksModule.v1.HealthChecksClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new healthchecksModule.v1.HealthChecksClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_image_family_views_v1.ts b/packages/google-cloud-compute/test/gapic_image_family_views_v1.ts index 9fff0ee778d..f19c710a260 100644 --- a/packages/google-cloud-compute/test/gapic_image_family_views_v1.ts +++ b/packages/google-cloud-compute/test/gapic_image_family_views_v1.ts @@ -79,16 +79,62 @@ describe('v1.ImageFamilyViewsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - imagefamilyviewsModule.v1.ImageFamilyViewsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new imagefamilyviewsModule.v1.ImageFamilyViewsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - imagefamilyviewsModule.v1.ImageFamilyViewsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new imagefamilyviewsModule.v1.ImageFamilyViewsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + imagefamilyviewsModule.v1.ImageFamilyViewsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + imagefamilyviewsModule.v1.ImageFamilyViewsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new imagefamilyviewsModule.v1.ImageFamilyViewsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new imagefamilyviewsModule.v1.ImageFamilyViewsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new imagefamilyviewsModule.v1.ImageFamilyViewsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_images_v1.ts b/packages/google-cloud-compute/test/gapic_images_v1.ts index 30a93a50860..ab2664d1189 100644 --- a/packages/google-cloud-compute/test/gapic_images_v1.ts +++ b/packages/google-cloud-compute/test/gapic_images_v1.ts @@ -142,14 +142,60 @@ describe('v1.ImagesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = imagesModule.v1.ImagesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new imagesModule.v1.ImagesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = imagesModule.v1.ImagesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new imagesModule.v1.ImagesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = imagesModule.v1.ImagesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = imagesModule.v1.ImagesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new imagesModule.v1.ImagesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new imagesModule.v1.ImagesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new imagesModule.v1.ImagesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_instance_group_managers_v1.ts b/packages/google-cloud-compute/test/gapic_instance_group_managers_v1.ts index 6b4b0ab7baf..7976dcb2d94 100644 --- a/packages/google-cloud-compute/test/gapic_instance_group_managers_v1.ts +++ b/packages/google-cloud-compute/test/gapic_instance_group_managers_v1.ts @@ -142,16 +142,68 @@ describe('v1.InstanceGroupManagersClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - instancegroupmanagersModule.v1.InstanceGroupManagersClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new instancegroupmanagersModule.v1.InstanceGroupManagersClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - instancegroupmanagersModule.v1.InstanceGroupManagersClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new instancegroupmanagersModule.v1.InstanceGroupManagersClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + instancegroupmanagersModule.v1.InstanceGroupManagersClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + instancegroupmanagersModule.v1.InstanceGroupManagersClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new instancegroupmanagersModule.v1.InstanceGroupManagersClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new instancegroupmanagersModule.v1.InstanceGroupManagersClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new instancegroupmanagersModule.v1.InstanceGroupManagersClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_instance_groups_v1.ts b/packages/google-cloud-compute/test/gapic_instance_groups_v1.ts index 42778413111..45f7927880f 100644 --- a/packages/google-cloud-compute/test/gapic_instance_groups_v1.ts +++ b/packages/google-cloud-compute/test/gapic_instance_groups_v1.ts @@ -142,16 +142,62 @@ describe('v1.InstanceGroupsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - instancegroupsModule.v1.InstanceGroupsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new instancegroupsModule.v1.InstanceGroupsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - instancegroupsModule.v1.InstanceGroupsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new instancegroupsModule.v1.InstanceGroupsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + instancegroupsModule.v1.InstanceGroupsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + instancegroupsModule.v1.InstanceGroupsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new instancegroupsModule.v1.InstanceGroupsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new instancegroupsModule.v1.InstanceGroupsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new instancegroupsModule.v1.InstanceGroupsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_instance_templates_v1.ts b/packages/google-cloud-compute/test/gapic_instance_templates_v1.ts index 63d3e1d5af2..58c8bb29d1b 100644 --- a/packages/google-cloud-compute/test/gapic_instance_templates_v1.ts +++ b/packages/google-cloud-compute/test/gapic_instance_templates_v1.ts @@ -142,16 +142,62 @@ describe('v1.InstanceTemplatesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - instancetemplatesModule.v1.InstanceTemplatesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new instancetemplatesModule.v1.InstanceTemplatesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - instancetemplatesModule.v1.InstanceTemplatesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new instancetemplatesModule.v1.InstanceTemplatesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + instancetemplatesModule.v1.InstanceTemplatesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + instancetemplatesModule.v1.InstanceTemplatesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new instancetemplatesModule.v1.InstanceTemplatesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new instancetemplatesModule.v1.InstanceTemplatesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new instancetemplatesModule.v1.InstanceTemplatesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_instances_v1.ts b/packages/google-cloud-compute/test/gapic_instances_v1.ts index 23ec6f6996f..a698db53bf8 100644 --- a/packages/google-cloud-compute/test/gapic_instances_v1.ts +++ b/packages/google-cloud-compute/test/gapic_instances_v1.ts @@ -142,14 +142,60 @@ describe('v1.InstancesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = instancesModule.v1.InstancesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new instancesModule.v1.InstancesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = instancesModule.v1.InstancesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new instancesModule.v1.InstancesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = instancesModule.v1.InstancesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = instancesModule.v1.InstancesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new instancesModule.v1.InstancesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new instancesModule.v1.InstancesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new instancesModule.v1.InstancesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_interconnect_attachments_v1.ts b/packages/google-cloud-compute/test/gapic_interconnect_attachments_v1.ts index 83192498f6d..11995897c20 100644 --- a/packages/google-cloud-compute/test/gapic_interconnect_attachments_v1.ts +++ b/packages/google-cloud-compute/test/gapic_interconnect_attachments_v1.ts @@ -142,18 +142,68 @@ describe('v1.InterconnectAttachmentsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - interconnectattachmentsModule.v1.InterconnectAttachmentsClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new interconnectattachmentsModule.v1.InterconnectAttachmentsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - interconnectattachmentsModule.v1.InterconnectAttachmentsClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new interconnectattachmentsModule.v1.InterconnectAttachmentsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + interconnectattachmentsModule.v1.InterconnectAttachmentsClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + interconnectattachmentsModule.v1.InterconnectAttachmentsClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new interconnectattachmentsModule.v1.InterconnectAttachmentsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new interconnectattachmentsModule.v1.InterconnectAttachmentsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new interconnectattachmentsModule.v1.InterconnectAttachmentsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_interconnect_locations_v1.ts b/packages/google-cloud-compute/test/gapic_interconnect_locations_v1.ts index ae2d9babf42..0cf7422fbaf 100644 --- a/packages/google-cloud-compute/test/gapic_interconnect_locations_v1.ts +++ b/packages/google-cloud-compute/test/gapic_interconnect_locations_v1.ts @@ -142,16 +142,68 @@ describe('v1.InterconnectLocationsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - interconnectlocationsModule.v1.InterconnectLocationsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new interconnectlocationsModule.v1.InterconnectLocationsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - interconnectlocationsModule.v1.InterconnectLocationsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new interconnectlocationsModule.v1.InterconnectLocationsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + interconnectlocationsModule.v1.InterconnectLocationsClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + interconnectlocationsModule.v1.InterconnectLocationsClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new interconnectlocationsModule.v1.InterconnectLocationsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new interconnectlocationsModule.v1.InterconnectLocationsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new interconnectlocationsModule.v1.InterconnectLocationsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_interconnect_remote_locations_v1.ts b/packages/google-cloud-compute/test/gapic_interconnect_remote_locations_v1.ts index 5a1cb85a705..975fd06847d 100644 --- a/packages/google-cloud-compute/test/gapic_interconnect_remote_locations_v1.ts +++ b/packages/google-cloud-compute/test/gapic_interconnect_remote_locations_v1.ts @@ -142,18 +142,67 @@ describe('v1.InterconnectRemoteLocationsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - interconnectremotelocationsModule.v1.InterconnectRemoteLocationsClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new interconnectremotelocationsModule.v1.InterconnectRemoteLocationsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - interconnectremotelocationsModule.v1.InterconnectRemoteLocationsClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new interconnectremotelocationsModule.v1.InterconnectRemoteLocationsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + interconnectremotelocationsModule.v1.InterconnectRemoteLocationsClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + interconnectremotelocationsModule.v1.InterconnectRemoteLocationsClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new interconnectremotelocationsModule.v1.InterconnectRemoteLocationsClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new interconnectremotelocationsModule.v1.InterconnectRemoteLocationsClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new interconnectremotelocationsModule.v1.InterconnectRemoteLocationsClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_interconnects_v1.ts b/packages/google-cloud-compute/test/gapic_interconnects_v1.ts index 14eacd60c0f..0746e88153d 100644 --- a/packages/google-cloud-compute/test/gapic_interconnects_v1.ts +++ b/packages/google-cloud-compute/test/gapic_interconnects_v1.ts @@ -142,16 +142,62 @@ describe('v1.InterconnectsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - interconnectsModule.v1.InterconnectsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new interconnectsModule.v1.InterconnectsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - interconnectsModule.v1.InterconnectsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new interconnectsModule.v1.InterconnectsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + interconnectsModule.v1.InterconnectsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + interconnectsModule.v1.InterconnectsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new interconnectsModule.v1.InterconnectsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new interconnectsModule.v1.InterconnectsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new interconnectsModule.v1.InterconnectsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_license_codes_v1.ts b/packages/google-cloud-compute/test/gapic_license_codes_v1.ts index ed516c8e8ce..3e15e9929d8 100644 --- a/packages/google-cloud-compute/test/gapic_license_codes_v1.ts +++ b/packages/google-cloud-compute/test/gapic_license_codes_v1.ts @@ -79,14 +79,62 @@ describe('v1.LicenseCodesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = licensecodesModule.v1.LicenseCodesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new licensecodesModule.v1.LicenseCodesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = licensecodesModule.v1.LicenseCodesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new licensecodesModule.v1.LicenseCodesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + licensecodesModule.v1.LicenseCodesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + licensecodesModule.v1.LicenseCodesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new licensecodesModule.v1.LicenseCodesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new licensecodesModule.v1.LicenseCodesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new licensecodesModule.v1.LicenseCodesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_licenses_v1.ts b/packages/google-cloud-compute/test/gapic_licenses_v1.ts index 6828dfdb364..e4f1e6f3a15 100644 --- a/packages/google-cloud-compute/test/gapic_licenses_v1.ts +++ b/packages/google-cloud-compute/test/gapic_licenses_v1.ts @@ -142,14 +142,60 @@ describe('v1.LicensesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = licensesModule.v1.LicensesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new licensesModule.v1.LicensesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = licensesModule.v1.LicensesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new licensesModule.v1.LicensesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = licensesModule.v1.LicensesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = licensesModule.v1.LicensesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new licensesModule.v1.LicensesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new licensesModule.v1.LicensesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new licensesModule.v1.LicensesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_machine_images_v1.ts b/packages/google-cloud-compute/test/gapic_machine_images_v1.ts index 2f2843ca969..0b02f83da41 100644 --- a/packages/google-cloud-compute/test/gapic_machine_images_v1.ts +++ b/packages/google-cloud-compute/test/gapic_machine_images_v1.ts @@ -142,16 +142,62 @@ describe('v1.MachineImagesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - machineimagesModule.v1.MachineImagesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new machineimagesModule.v1.MachineImagesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - machineimagesModule.v1.MachineImagesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new machineimagesModule.v1.MachineImagesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + machineimagesModule.v1.MachineImagesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + machineimagesModule.v1.MachineImagesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new machineimagesModule.v1.MachineImagesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new machineimagesModule.v1.MachineImagesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new machineimagesModule.v1.MachineImagesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_machine_types_v1.ts b/packages/google-cloud-compute/test/gapic_machine_types_v1.ts index 7cec7862b9e..fbf3bd65c91 100644 --- a/packages/google-cloud-compute/test/gapic_machine_types_v1.ts +++ b/packages/google-cloud-compute/test/gapic_machine_types_v1.ts @@ -142,14 +142,62 @@ describe('v1.MachineTypesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = machinetypesModule.v1.MachineTypesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new machinetypesModule.v1.MachineTypesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = machinetypesModule.v1.MachineTypesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new machinetypesModule.v1.MachineTypesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + machinetypesModule.v1.MachineTypesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + machinetypesModule.v1.MachineTypesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new machinetypesModule.v1.MachineTypesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new machinetypesModule.v1.MachineTypesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new machinetypesModule.v1.MachineTypesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_network_attachments_v1.ts b/packages/google-cloud-compute/test/gapic_network_attachments_v1.ts index ad7cb2234a1..a5728864782 100644 --- a/packages/google-cloud-compute/test/gapic_network_attachments_v1.ts +++ b/packages/google-cloud-compute/test/gapic_network_attachments_v1.ts @@ -142,16 +142,62 @@ describe('v1.NetworkAttachmentsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - networkattachmentsModule.v1.NetworkAttachmentsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new networkattachmentsModule.v1.NetworkAttachmentsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - networkattachmentsModule.v1.NetworkAttachmentsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new networkattachmentsModule.v1.NetworkAttachmentsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + networkattachmentsModule.v1.NetworkAttachmentsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + networkattachmentsModule.v1.NetworkAttachmentsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new networkattachmentsModule.v1.NetworkAttachmentsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new networkattachmentsModule.v1.NetworkAttachmentsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new networkattachmentsModule.v1.NetworkAttachmentsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_network_edge_security_services_v1.ts b/packages/google-cloud-compute/test/gapic_network_edge_security_services_v1.ts index 872a9977448..2543e54835c 100644 --- a/packages/google-cloud-compute/test/gapic_network_edge_security_services_v1.ts +++ b/packages/google-cloud-compute/test/gapic_network_edge_security_services_v1.ts @@ -142,18 +142,67 @@ describe('v1.NetworkEdgeSecurityServicesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - networkedgesecurityservicesModule.v1.NetworkEdgeSecurityServicesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new networkedgesecurityservicesModule.v1.NetworkEdgeSecurityServicesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - networkedgesecurityservicesModule.v1.NetworkEdgeSecurityServicesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new networkedgesecurityservicesModule.v1.NetworkEdgeSecurityServicesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + networkedgesecurityservicesModule.v1.NetworkEdgeSecurityServicesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + networkedgesecurityservicesModule.v1.NetworkEdgeSecurityServicesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new networkedgesecurityservicesModule.v1.NetworkEdgeSecurityServicesClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new networkedgesecurityservicesModule.v1.NetworkEdgeSecurityServicesClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new networkedgesecurityservicesModule.v1.NetworkEdgeSecurityServicesClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_network_endpoint_groups_v1.ts b/packages/google-cloud-compute/test/gapic_network_endpoint_groups_v1.ts index bc34c07aca6..f512d9f7b17 100644 --- a/packages/google-cloud-compute/test/gapic_network_endpoint_groups_v1.ts +++ b/packages/google-cloud-compute/test/gapic_network_endpoint_groups_v1.ts @@ -142,16 +142,68 @@ describe('v1.NetworkEndpointGroupsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - networkendpointgroupsModule.v1.NetworkEndpointGroupsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new networkendpointgroupsModule.v1.NetworkEndpointGroupsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - networkendpointgroupsModule.v1.NetworkEndpointGroupsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new networkendpointgroupsModule.v1.NetworkEndpointGroupsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + networkendpointgroupsModule.v1.NetworkEndpointGroupsClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + networkendpointgroupsModule.v1.NetworkEndpointGroupsClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new networkendpointgroupsModule.v1.NetworkEndpointGroupsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new networkendpointgroupsModule.v1.NetworkEndpointGroupsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new networkendpointgroupsModule.v1.NetworkEndpointGroupsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_network_firewall_policies_v1.ts b/packages/google-cloud-compute/test/gapic_network_firewall_policies_v1.ts index 736bb44d2b6..f6cf94adcc1 100644 --- a/packages/google-cloud-compute/test/gapic_network_firewall_policies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_network_firewall_policies_v1.ts @@ -142,18 +142,68 @@ describe('v1.NetworkFirewallPoliciesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - networkfirewallpoliciesModule.v1.NetworkFirewallPoliciesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new networkfirewallpoliciesModule.v1.NetworkFirewallPoliciesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - networkfirewallpoliciesModule.v1.NetworkFirewallPoliciesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new networkfirewallpoliciesModule.v1.NetworkFirewallPoliciesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + networkfirewallpoliciesModule.v1.NetworkFirewallPoliciesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + networkfirewallpoliciesModule.v1.NetworkFirewallPoliciesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new networkfirewallpoliciesModule.v1.NetworkFirewallPoliciesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new networkfirewallpoliciesModule.v1.NetworkFirewallPoliciesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new networkfirewallpoliciesModule.v1.NetworkFirewallPoliciesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_networks_v1.ts b/packages/google-cloud-compute/test/gapic_networks_v1.ts index 3f996a34b95..2857d54b2e3 100644 --- a/packages/google-cloud-compute/test/gapic_networks_v1.ts +++ b/packages/google-cloud-compute/test/gapic_networks_v1.ts @@ -142,14 +142,60 @@ describe('v1.NetworksClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = networksModule.v1.NetworksClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new networksModule.v1.NetworksClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = networksModule.v1.NetworksClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new networksModule.v1.NetworksClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = networksModule.v1.NetworksClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = networksModule.v1.NetworksClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new networksModule.v1.NetworksClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new networksModule.v1.NetworksClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new networksModule.v1.NetworksClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_node_groups_v1.ts b/packages/google-cloud-compute/test/gapic_node_groups_v1.ts index c1fdbf8a8e0..43d7c3362ad 100644 --- a/packages/google-cloud-compute/test/gapic_node_groups_v1.ts +++ b/packages/google-cloud-compute/test/gapic_node_groups_v1.ts @@ -142,14 +142,60 @@ describe('v1.NodeGroupsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = nodegroupsModule.v1.NodeGroupsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new nodegroupsModule.v1.NodeGroupsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = nodegroupsModule.v1.NodeGroupsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new nodegroupsModule.v1.NodeGroupsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = nodegroupsModule.v1.NodeGroupsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = nodegroupsModule.v1.NodeGroupsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new nodegroupsModule.v1.NodeGroupsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new nodegroupsModule.v1.NodeGroupsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new nodegroupsModule.v1.NodeGroupsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_node_templates_v1.ts b/packages/google-cloud-compute/test/gapic_node_templates_v1.ts index 160ac230865..6828eb35a13 100644 --- a/packages/google-cloud-compute/test/gapic_node_templates_v1.ts +++ b/packages/google-cloud-compute/test/gapic_node_templates_v1.ts @@ -142,16 +142,62 @@ describe('v1.NodeTemplatesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - nodetemplatesModule.v1.NodeTemplatesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new nodetemplatesModule.v1.NodeTemplatesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - nodetemplatesModule.v1.NodeTemplatesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new nodetemplatesModule.v1.NodeTemplatesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + nodetemplatesModule.v1.NodeTemplatesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + nodetemplatesModule.v1.NodeTemplatesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new nodetemplatesModule.v1.NodeTemplatesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new nodetemplatesModule.v1.NodeTemplatesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new nodetemplatesModule.v1.NodeTemplatesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_node_types_v1.ts b/packages/google-cloud-compute/test/gapic_node_types_v1.ts index a1904cc8761..96cf7da9a91 100644 --- a/packages/google-cloud-compute/test/gapic_node_types_v1.ts +++ b/packages/google-cloud-compute/test/gapic_node_types_v1.ts @@ -142,14 +142,60 @@ describe('v1.NodeTypesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = nodetypesModule.v1.NodeTypesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new nodetypesModule.v1.NodeTypesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = nodetypesModule.v1.NodeTypesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new nodetypesModule.v1.NodeTypesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = nodetypesModule.v1.NodeTypesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = nodetypesModule.v1.NodeTypesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new nodetypesModule.v1.NodeTypesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new nodetypesModule.v1.NodeTypesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new nodetypesModule.v1.NodeTypesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_packet_mirrorings_v1.ts b/packages/google-cloud-compute/test/gapic_packet_mirrorings_v1.ts index c740ae77919..8779077bb6a 100644 --- a/packages/google-cloud-compute/test/gapic_packet_mirrorings_v1.ts +++ b/packages/google-cloud-compute/test/gapic_packet_mirrorings_v1.ts @@ -142,16 +142,62 @@ describe('v1.PacketMirroringsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - packetmirroringsModule.v1.PacketMirroringsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new packetmirroringsModule.v1.PacketMirroringsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - packetmirroringsModule.v1.PacketMirroringsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new packetmirroringsModule.v1.PacketMirroringsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + packetmirroringsModule.v1.PacketMirroringsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + packetmirroringsModule.v1.PacketMirroringsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new packetmirroringsModule.v1.PacketMirroringsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new packetmirroringsModule.v1.PacketMirroringsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new packetmirroringsModule.v1.PacketMirroringsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_projects_v1.ts b/packages/google-cloud-compute/test/gapic_projects_v1.ts index 85f3ae29b75..208cb84232a 100644 --- a/packages/google-cloud-compute/test/gapic_projects_v1.ts +++ b/packages/google-cloud-compute/test/gapic_projects_v1.ts @@ -142,14 +142,60 @@ describe('v1.ProjectsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = projectsModule.v1.ProjectsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new projectsModule.v1.ProjectsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = projectsModule.v1.ProjectsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new projectsModule.v1.ProjectsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = projectsModule.v1.ProjectsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = projectsModule.v1.ProjectsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new projectsModule.v1.ProjectsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new projectsModule.v1.ProjectsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new projectsModule.v1.ProjectsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_public_advertised_prefixes_v1.ts b/packages/google-cloud-compute/test/gapic_public_advertised_prefixes_v1.ts index 3ae5d1b0c6f..c0cca657afb 100644 --- a/packages/google-cloud-compute/test/gapic_public_advertised_prefixes_v1.ts +++ b/packages/google-cloud-compute/test/gapic_public_advertised_prefixes_v1.ts @@ -142,18 +142,68 @@ describe('v1.PublicAdvertisedPrefixesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - publicadvertisedprefixesModule.v1.PublicAdvertisedPrefixesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new publicadvertisedprefixesModule.v1.PublicAdvertisedPrefixesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - publicadvertisedprefixesModule.v1.PublicAdvertisedPrefixesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new publicadvertisedprefixesModule.v1.PublicAdvertisedPrefixesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + publicadvertisedprefixesModule.v1.PublicAdvertisedPrefixesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + publicadvertisedprefixesModule.v1.PublicAdvertisedPrefixesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new publicadvertisedprefixesModule.v1.PublicAdvertisedPrefixesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new publicadvertisedprefixesModule.v1.PublicAdvertisedPrefixesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new publicadvertisedprefixesModule.v1.PublicAdvertisedPrefixesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_public_delegated_prefixes_v1.ts b/packages/google-cloud-compute/test/gapic_public_delegated_prefixes_v1.ts index e9878302a55..a87861a4319 100644 --- a/packages/google-cloud-compute/test/gapic_public_delegated_prefixes_v1.ts +++ b/packages/google-cloud-compute/test/gapic_public_delegated_prefixes_v1.ts @@ -142,18 +142,68 @@ describe('v1.PublicDelegatedPrefixesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - publicdelegatedprefixesModule.v1.PublicDelegatedPrefixesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new publicdelegatedprefixesModule.v1.PublicDelegatedPrefixesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - publicdelegatedprefixesModule.v1.PublicDelegatedPrefixesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new publicdelegatedprefixesModule.v1.PublicDelegatedPrefixesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + publicdelegatedprefixesModule.v1.PublicDelegatedPrefixesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + publicdelegatedprefixesModule.v1.PublicDelegatedPrefixesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new publicdelegatedprefixesModule.v1.PublicDelegatedPrefixesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new publicdelegatedprefixesModule.v1.PublicDelegatedPrefixesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new publicdelegatedprefixesModule.v1.PublicDelegatedPrefixesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_autoscalers_v1.ts b/packages/google-cloud-compute/test/gapic_region_autoscalers_v1.ts index a8c2f4f8b99..92686bc494e 100644 --- a/packages/google-cloud-compute/test/gapic_region_autoscalers_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_autoscalers_v1.ts @@ -142,16 +142,62 @@ describe('v1.RegionAutoscalersClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionautoscalersModule.v1.RegionAutoscalersClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regionautoscalersModule.v1.RegionAutoscalersClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionautoscalersModule.v1.RegionAutoscalersClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regionautoscalersModule.v1.RegionAutoscalersClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionautoscalersModule.v1.RegionAutoscalersClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionautoscalersModule.v1.RegionAutoscalersClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regionautoscalersModule.v1.RegionAutoscalersClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regionautoscalersModule.v1.RegionAutoscalersClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionautoscalersModule.v1.RegionAutoscalersClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_backend_services_v1.ts b/packages/google-cloud-compute/test/gapic_region_backend_services_v1.ts index 36635665dac..e136693bda0 100644 --- a/packages/google-cloud-compute/test/gapic_region_backend_services_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_backend_services_v1.ts @@ -142,16 +142,68 @@ describe('v1.RegionBackendServicesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionbackendservicesModule.v1.RegionBackendServicesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regionbackendservicesModule.v1.RegionBackendServicesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionbackendservicesModule.v1.RegionBackendServicesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regionbackendservicesModule.v1.RegionBackendServicesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionbackendservicesModule.v1.RegionBackendServicesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionbackendservicesModule.v1.RegionBackendServicesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regionbackendservicesModule.v1.RegionBackendServicesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regionbackendservicesModule.v1.RegionBackendServicesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionbackendservicesModule.v1.RegionBackendServicesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_commitments_v1.ts b/packages/google-cloud-compute/test/gapic_region_commitments_v1.ts index 03852c058ab..285132d78b7 100644 --- a/packages/google-cloud-compute/test/gapic_region_commitments_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_commitments_v1.ts @@ -142,16 +142,62 @@ describe('v1.RegionCommitmentsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regioncommitmentsModule.v1.RegionCommitmentsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regioncommitmentsModule.v1.RegionCommitmentsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regioncommitmentsModule.v1.RegionCommitmentsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regioncommitmentsModule.v1.RegionCommitmentsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regioncommitmentsModule.v1.RegionCommitmentsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regioncommitmentsModule.v1.RegionCommitmentsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regioncommitmentsModule.v1.RegionCommitmentsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regioncommitmentsModule.v1.RegionCommitmentsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regioncommitmentsModule.v1.RegionCommitmentsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_disk_types_v1.ts b/packages/google-cloud-compute/test/gapic_region_disk_types_v1.ts index 0c358288c25..a33a48f405f 100644 --- a/packages/google-cloud-compute/test/gapic_region_disk_types_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_disk_types_v1.ts @@ -142,16 +142,62 @@ describe('v1.RegionDiskTypesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regiondisktypesModule.v1.RegionDiskTypesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regiondisktypesModule.v1.RegionDiskTypesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regiondisktypesModule.v1.RegionDiskTypesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regiondisktypesModule.v1.RegionDiskTypesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regiondisktypesModule.v1.RegionDiskTypesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regiondisktypesModule.v1.RegionDiskTypesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regiondisktypesModule.v1.RegionDiskTypesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regiondisktypesModule.v1.RegionDiskTypesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regiondisktypesModule.v1.RegionDiskTypesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_disks_v1.ts b/packages/google-cloud-compute/test/gapic_region_disks_v1.ts index b50d6846192..7bd8d4d10d4 100644 --- a/packages/google-cloud-compute/test/gapic_region_disks_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_disks_v1.ts @@ -142,14 +142,60 @@ describe('v1.RegionDisksClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = regiondisksModule.v1.RegionDisksClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regiondisksModule.v1.RegionDisksClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = regiondisksModule.v1.RegionDisksClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regiondisksModule.v1.RegionDisksClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = regiondisksModule.v1.RegionDisksClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = regiondisksModule.v1.RegionDisksClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regiondisksModule.v1.RegionDisksClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regiondisksModule.v1.RegionDisksClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regiondisksModule.v1.RegionDisksClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_health_check_services_v1.ts b/packages/google-cloud-compute/test/gapic_region_health_check_services_v1.ts index ae24c07e3e0..ccd6610507c 100644 --- a/packages/google-cloud-compute/test/gapic_region_health_check_services_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_health_check_services_v1.ts @@ -142,18 +142,68 @@ describe('v1.RegionHealthCheckServicesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionhealthcheckservicesModule.v1.RegionHealthCheckServicesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regionhealthcheckservicesModule.v1.RegionHealthCheckServicesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionhealthcheckservicesModule.v1.RegionHealthCheckServicesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regionhealthcheckservicesModule.v1.RegionHealthCheckServicesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionhealthcheckservicesModule.v1.RegionHealthCheckServicesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionhealthcheckservicesModule.v1.RegionHealthCheckServicesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regionhealthcheckservicesModule.v1.RegionHealthCheckServicesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regionhealthcheckservicesModule.v1.RegionHealthCheckServicesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionhealthcheckservicesModule.v1.RegionHealthCheckServicesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_health_checks_v1.ts b/packages/google-cloud-compute/test/gapic_region_health_checks_v1.ts index 62d392e31e7..921655e88cf 100644 --- a/packages/google-cloud-compute/test/gapic_region_health_checks_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_health_checks_v1.ts @@ -142,16 +142,62 @@ describe('v1.RegionHealthChecksClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionhealthchecksModule.v1.RegionHealthChecksClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regionhealthchecksModule.v1.RegionHealthChecksClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionhealthchecksModule.v1.RegionHealthChecksClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regionhealthchecksModule.v1.RegionHealthChecksClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionhealthchecksModule.v1.RegionHealthChecksClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionhealthchecksModule.v1.RegionHealthChecksClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regionhealthchecksModule.v1.RegionHealthChecksClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regionhealthchecksModule.v1.RegionHealthChecksClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionhealthchecksModule.v1.RegionHealthChecksClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_instance_group_managers_v1.ts b/packages/google-cloud-compute/test/gapic_region_instance_group_managers_v1.ts index 4ec4981ff45..2971d71da3a 100644 --- a/packages/google-cloud-compute/test/gapic_region_instance_group_managers_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_instance_group_managers_v1.ts @@ -142,18 +142,67 @@ describe('v1.RegionInstanceGroupManagersClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regioninstancegroupmanagersModule.v1.RegionInstanceGroupManagersClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regioninstancegroupmanagersModule.v1.RegionInstanceGroupManagersClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regioninstancegroupmanagersModule.v1.RegionInstanceGroupManagersClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regioninstancegroupmanagersModule.v1.RegionInstanceGroupManagersClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regioninstancegroupmanagersModule.v1.RegionInstanceGroupManagersClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regioninstancegroupmanagersModule.v1.RegionInstanceGroupManagersClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regioninstancegroupmanagersModule.v1.RegionInstanceGroupManagersClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regioninstancegroupmanagersModule.v1.RegionInstanceGroupManagersClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regioninstancegroupmanagersModule.v1.RegionInstanceGroupManagersClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_instance_groups_v1.ts b/packages/google-cloud-compute/test/gapic_region_instance_groups_v1.ts index f927429eb8e..cbddd59fbbb 100644 --- a/packages/google-cloud-compute/test/gapic_region_instance_groups_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_instance_groups_v1.ts @@ -142,16 +142,66 @@ describe('v1.RegionInstanceGroupsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regioninstancegroupsModule.v1.RegionInstanceGroupsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regioninstancegroupsModule.v1.RegionInstanceGroupsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regioninstancegroupsModule.v1.RegionInstanceGroupsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regioninstancegroupsModule.v1.RegionInstanceGroupsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regioninstancegroupsModule.v1.RegionInstanceGroupsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regioninstancegroupsModule.v1.RegionInstanceGroupsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regioninstancegroupsModule.v1.RegionInstanceGroupsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regioninstancegroupsModule.v1.RegionInstanceGroupsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regioninstancegroupsModule.v1.RegionInstanceGroupsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_instance_templates_v1.ts b/packages/google-cloud-compute/test/gapic_region_instance_templates_v1.ts index 1ce82e35eb5..0ed2e2a50cb 100644 --- a/packages/google-cloud-compute/test/gapic_region_instance_templates_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_instance_templates_v1.ts @@ -142,18 +142,68 @@ describe('v1.RegionInstanceTemplatesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regioninstancetemplatesModule.v1.RegionInstanceTemplatesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regioninstancetemplatesModule.v1.RegionInstanceTemplatesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regioninstancetemplatesModule.v1.RegionInstanceTemplatesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regioninstancetemplatesModule.v1.RegionInstanceTemplatesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regioninstancetemplatesModule.v1.RegionInstanceTemplatesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regioninstancetemplatesModule.v1.RegionInstanceTemplatesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regioninstancetemplatesModule.v1.RegionInstanceTemplatesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regioninstancetemplatesModule.v1.RegionInstanceTemplatesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regioninstancetemplatesModule.v1.RegionInstanceTemplatesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_instances_v1.ts b/packages/google-cloud-compute/test/gapic_region_instances_v1.ts index 1014878883d..d92ef0961c6 100644 --- a/packages/google-cloud-compute/test/gapic_region_instances_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_instances_v1.ts @@ -79,16 +79,62 @@ describe('v1.RegionInstancesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regioninstancesModule.v1.RegionInstancesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regioninstancesModule.v1.RegionInstancesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regioninstancesModule.v1.RegionInstancesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regioninstancesModule.v1.RegionInstancesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regioninstancesModule.v1.RegionInstancesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regioninstancesModule.v1.RegionInstancesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regioninstancesModule.v1.RegionInstancesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regioninstancesModule.v1.RegionInstancesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regioninstancesModule.v1.RegionInstancesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_network_endpoint_groups_v1.ts b/packages/google-cloud-compute/test/gapic_region_network_endpoint_groups_v1.ts index 1296ab9ef61..13a76db4d05 100644 --- a/packages/google-cloud-compute/test/gapic_region_network_endpoint_groups_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_network_endpoint_groups_v1.ts @@ -142,18 +142,67 @@ describe('v1.RegionNetworkEndpointGroupsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionnetworkendpointgroupsModule.v1.RegionNetworkEndpointGroupsClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regionnetworkendpointgroupsModule.v1.RegionNetworkEndpointGroupsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionnetworkendpointgroupsModule.v1.RegionNetworkEndpointGroupsClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regionnetworkendpointgroupsModule.v1.RegionNetworkEndpointGroupsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionnetworkendpointgroupsModule.v1.RegionNetworkEndpointGroupsClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionnetworkendpointgroupsModule.v1.RegionNetworkEndpointGroupsClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regionnetworkendpointgroupsModule.v1.RegionNetworkEndpointGroupsClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regionnetworkendpointgroupsModule.v1.RegionNetworkEndpointGroupsClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionnetworkendpointgroupsModule.v1.RegionNetworkEndpointGroupsClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_network_firewall_policies_v1.ts b/packages/google-cloud-compute/test/gapic_region_network_firewall_policies_v1.ts index ac1d1f25385..974078e410b 100644 --- a/packages/google-cloud-compute/test/gapic_region_network_firewall_policies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_network_firewall_policies_v1.ts @@ -142,18 +142,67 @@ describe('v1.RegionNetworkFirewallPoliciesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionnetworkfirewallpoliciesModule.v1 - .RegionNetworkFirewallPoliciesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regionnetworkfirewallpoliciesModule.v1.RegionNetworkFirewallPoliciesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionnetworkfirewallpoliciesModule.v1 - .RegionNetworkFirewallPoliciesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regionnetworkfirewallpoliciesModule.v1.RegionNetworkFirewallPoliciesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionnetworkfirewallpoliciesModule.v1 + .RegionNetworkFirewallPoliciesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionnetworkfirewallpoliciesModule.v1 + .RegionNetworkFirewallPoliciesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regionnetworkfirewallpoliciesModule.v1.RegionNetworkFirewallPoliciesClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regionnetworkfirewallpoliciesModule.v1.RegionNetworkFirewallPoliciesClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionnetworkfirewallpoliciesModule.v1.RegionNetworkFirewallPoliciesClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_notification_endpoints_v1.ts b/packages/google-cloud-compute/test/gapic_region_notification_endpoints_v1.ts index eeb406ea20d..ba5abf6d704 100644 --- a/packages/google-cloud-compute/test/gapic_region_notification_endpoints_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_notification_endpoints_v1.ts @@ -142,18 +142,67 @@ describe('v1.RegionNotificationEndpointsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionnotificationendpointsModule.v1.RegionNotificationEndpointsClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regionnotificationendpointsModule.v1.RegionNotificationEndpointsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionnotificationendpointsModule.v1.RegionNotificationEndpointsClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regionnotificationendpointsModule.v1.RegionNotificationEndpointsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionnotificationendpointsModule.v1.RegionNotificationEndpointsClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionnotificationendpointsModule.v1.RegionNotificationEndpointsClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regionnotificationendpointsModule.v1.RegionNotificationEndpointsClient( + {universeDomain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regionnotificationendpointsModule.v1.RegionNotificationEndpointsClient( + {universe_domain: 'example.com'} + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionnotificationendpointsModule.v1.RegionNotificationEndpointsClient( + {universe_domain: 'example.com', universeDomain: 'example.net'} + ); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_operations_v1.ts b/packages/google-cloud-compute/test/gapic_region_operations_v1.ts index 7be8bc7123f..4d56258c2be 100644 --- a/packages/google-cloud-compute/test/gapic_region_operations_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_operations_v1.ts @@ -142,16 +142,62 @@ describe('v1.RegionOperationsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionoperationsModule.v1.RegionOperationsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regionoperationsModule.v1.RegionOperationsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionoperationsModule.v1.RegionOperationsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regionoperationsModule.v1.RegionOperationsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionoperationsModule.v1.RegionOperationsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionoperationsModule.v1.RegionOperationsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regionoperationsModule.v1.RegionOperationsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regionoperationsModule.v1.RegionOperationsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionoperationsModule.v1.RegionOperationsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_operations_v1small.ts b/packages/google-cloud-compute/test/gapic_region_operations_v1small.ts index ef464f72295..d71d9ece0af 100644 --- a/packages/google-cloud-compute/test/gapic_region_operations_v1small.ts +++ b/packages/google-cloud-compute/test/gapic_region_operations_v1small.ts @@ -79,16 +79,64 @@ describe('v1small.RegionOperationsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionoperationsModule.v1small.RegionOperationsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regionoperationsModule.v1small.RegionOperationsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionoperationsModule.v1small.RegionOperationsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regionoperationsModule.v1small.RegionOperationsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionoperationsModule.v1small.RegionOperationsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionoperationsModule.v1small.RegionOperationsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regionoperationsModule.v1small.RegionOperationsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regionoperationsModule.v1small.RegionOperationsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionoperationsModule.v1small.RegionOperationsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_security_policies_v1.ts b/packages/google-cloud-compute/test/gapic_region_security_policies_v1.ts index a7d6847c2ca..f61275d14e5 100644 --- a/packages/google-cloud-compute/test/gapic_region_security_policies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_security_policies_v1.ts @@ -142,18 +142,68 @@ describe('v1.RegionSecurityPoliciesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionsecuritypoliciesModule.v1.RegionSecurityPoliciesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regionsecuritypoliciesModule.v1.RegionSecurityPoliciesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionsecuritypoliciesModule.v1.RegionSecurityPoliciesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regionsecuritypoliciesModule.v1.RegionSecurityPoliciesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionsecuritypoliciesModule.v1.RegionSecurityPoliciesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionsecuritypoliciesModule.v1.RegionSecurityPoliciesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regionsecuritypoliciesModule.v1.RegionSecurityPoliciesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regionsecuritypoliciesModule.v1.RegionSecurityPoliciesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionsecuritypoliciesModule.v1.RegionSecurityPoliciesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_ssl_certificates_v1.ts b/packages/google-cloud-compute/test/gapic_region_ssl_certificates_v1.ts index c66ce79c0cb..e1842c03310 100644 --- a/packages/google-cloud-compute/test/gapic_region_ssl_certificates_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_ssl_certificates_v1.ts @@ -142,16 +142,68 @@ describe('v1.RegionSslCertificatesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionsslcertificatesModule.v1.RegionSslCertificatesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regionsslcertificatesModule.v1.RegionSslCertificatesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionsslcertificatesModule.v1.RegionSslCertificatesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regionsslcertificatesModule.v1.RegionSslCertificatesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionsslcertificatesModule.v1.RegionSslCertificatesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionsslcertificatesModule.v1.RegionSslCertificatesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regionsslcertificatesModule.v1.RegionSslCertificatesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regionsslcertificatesModule.v1.RegionSslCertificatesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionsslcertificatesModule.v1.RegionSslCertificatesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_ssl_policies_v1.ts b/packages/google-cloud-compute/test/gapic_region_ssl_policies_v1.ts index 169bc8ddd97..8d7b089e1c6 100644 --- a/packages/google-cloud-compute/test/gapic_region_ssl_policies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_ssl_policies_v1.ts @@ -142,16 +142,62 @@ describe('v1.RegionSslPoliciesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionsslpoliciesModule.v1.RegionSslPoliciesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regionsslpoliciesModule.v1.RegionSslPoliciesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionsslpoliciesModule.v1.RegionSslPoliciesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regionsslpoliciesModule.v1.RegionSslPoliciesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionsslpoliciesModule.v1.RegionSslPoliciesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionsslpoliciesModule.v1.RegionSslPoliciesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regionsslpoliciesModule.v1.RegionSslPoliciesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regionsslpoliciesModule.v1.RegionSslPoliciesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionsslpoliciesModule.v1.RegionSslPoliciesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_target_http_proxies_v1.ts b/packages/google-cloud-compute/test/gapic_region_target_http_proxies_v1.ts index 26a3a387a8a..2c40cd81b42 100644 --- a/packages/google-cloud-compute/test/gapic_region_target_http_proxies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_target_http_proxies_v1.ts @@ -142,18 +142,68 @@ describe('v1.RegionTargetHttpProxiesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regiontargethttpproxiesModule.v1.RegionTargetHttpProxiesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regiontargethttpproxiesModule.v1.RegionTargetHttpProxiesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regiontargethttpproxiesModule.v1.RegionTargetHttpProxiesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regiontargethttpproxiesModule.v1.RegionTargetHttpProxiesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regiontargethttpproxiesModule.v1.RegionTargetHttpProxiesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regiontargethttpproxiesModule.v1.RegionTargetHttpProxiesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regiontargethttpproxiesModule.v1.RegionTargetHttpProxiesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regiontargethttpproxiesModule.v1.RegionTargetHttpProxiesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regiontargethttpproxiesModule.v1.RegionTargetHttpProxiesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_target_https_proxies_v1.ts b/packages/google-cloud-compute/test/gapic_region_target_https_proxies_v1.ts index 384a1f04209..eb02d63bdce 100644 --- a/packages/google-cloud-compute/test/gapic_region_target_https_proxies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_target_https_proxies_v1.ts @@ -142,18 +142,68 @@ describe('v1.RegionTargetHttpsProxiesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regiontargethttpsproxiesModule.v1.RegionTargetHttpsProxiesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regiontargethttpsproxiesModule.v1.RegionTargetHttpsProxiesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regiontargethttpsproxiesModule.v1.RegionTargetHttpsProxiesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regiontargethttpsproxiesModule.v1.RegionTargetHttpsProxiesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regiontargethttpsproxiesModule.v1.RegionTargetHttpsProxiesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regiontargethttpsproxiesModule.v1.RegionTargetHttpsProxiesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regiontargethttpsproxiesModule.v1.RegionTargetHttpsProxiesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regiontargethttpsproxiesModule.v1.RegionTargetHttpsProxiesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regiontargethttpsproxiesModule.v1.RegionTargetHttpsProxiesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_target_tcp_proxies_v1.ts b/packages/google-cloud-compute/test/gapic_region_target_tcp_proxies_v1.ts index 44fb61c5b4f..6f856c3ba93 100644 --- a/packages/google-cloud-compute/test/gapic_region_target_tcp_proxies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_target_tcp_proxies_v1.ts @@ -142,18 +142,68 @@ describe('v1.RegionTargetTcpProxiesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regiontargettcpproxiesModule.v1.RegionTargetTcpProxiesClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new regiontargettcpproxiesModule.v1.RegionTargetTcpProxiesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regiontargettcpproxiesModule.v1.RegionTargetTcpProxiesClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new regiontargettcpproxiesModule.v1.RegionTargetTcpProxiesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regiontargettcpproxiesModule.v1.RegionTargetTcpProxiesClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regiontargettcpproxiesModule.v1.RegionTargetTcpProxiesClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new regiontargettcpproxiesModule.v1.RegionTargetTcpProxiesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new regiontargettcpproxiesModule.v1.RegionTargetTcpProxiesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regiontargettcpproxiesModule.v1.RegionTargetTcpProxiesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_region_url_maps_v1.ts b/packages/google-cloud-compute/test/gapic_region_url_maps_v1.ts index 41914df4039..2b839b7e3a7 100644 --- a/packages/google-cloud-compute/test/gapic_region_url_maps_v1.ts +++ b/packages/google-cloud-compute/test/gapic_region_url_maps_v1.ts @@ -142,16 +142,62 @@ describe('v1.RegionUrlMapsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - regionurlmapsModule.v1.RegionUrlMapsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regionurlmapsModule.v1.RegionUrlMapsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - regionurlmapsModule.v1.RegionUrlMapsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regionurlmapsModule.v1.RegionUrlMapsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + regionurlmapsModule.v1.RegionUrlMapsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + regionurlmapsModule.v1.RegionUrlMapsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regionurlmapsModule.v1.RegionUrlMapsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regionurlmapsModule.v1.RegionUrlMapsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionurlmapsModule.v1.RegionUrlMapsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_regions_v1.ts b/packages/google-cloud-compute/test/gapic_regions_v1.ts index f6b2f4aa33d..2656eedd9f6 100644 --- a/packages/google-cloud-compute/test/gapic_regions_v1.ts +++ b/packages/google-cloud-compute/test/gapic_regions_v1.ts @@ -142,14 +142,60 @@ describe('v1.RegionsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = regionsModule.v1.RegionsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new regionsModule.v1.RegionsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = regionsModule.v1.RegionsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new regionsModule.v1.RegionsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = regionsModule.v1.RegionsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = regionsModule.v1.RegionsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new regionsModule.v1.RegionsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new regionsModule.v1.RegionsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new regionsModule.v1.RegionsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_reservations_v1.ts b/packages/google-cloud-compute/test/gapic_reservations_v1.ts index 1dd4d1c55cb..0913bef5cab 100644 --- a/packages/google-cloud-compute/test/gapic_reservations_v1.ts +++ b/packages/google-cloud-compute/test/gapic_reservations_v1.ts @@ -142,14 +142,62 @@ describe('v1.ReservationsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = reservationsModule.v1.ReservationsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new reservationsModule.v1.ReservationsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = reservationsModule.v1.ReservationsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new reservationsModule.v1.ReservationsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + reservationsModule.v1.ReservationsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + reservationsModule.v1.ReservationsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new reservationsModule.v1.ReservationsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new reservationsModule.v1.ReservationsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new reservationsModule.v1.ReservationsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_resource_policies_v1.ts b/packages/google-cloud-compute/test/gapic_resource_policies_v1.ts index e286f098fba..d1777acb32d 100644 --- a/packages/google-cloud-compute/test/gapic_resource_policies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_resource_policies_v1.ts @@ -142,16 +142,62 @@ describe('v1.ResourcePoliciesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - resourcepoliciesModule.v1.ResourcePoliciesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new resourcepoliciesModule.v1.ResourcePoliciesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - resourcepoliciesModule.v1.ResourcePoliciesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new resourcepoliciesModule.v1.ResourcePoliciesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + resourcepoliciesModule.v1.ResourcePoliciesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + resourcepoliciesModule.v1.ResourcePoliciesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new resourcepoliciesModule.v1.ResourcePoliciesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new resourcepoliciesModule.v1.ResourcePoliciesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new resourcepoliciesModule.v1.ResourcePoliciesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_routers_v1.ts b/packages/google-cloud-compute/test/gapic_routers_v1.ts index ccfa33624e3..a2ee16bd4fa 100644 --- a/packages/google-cloud-compute/test/gapic_routers_v1.ts +++ b/packages/google-cloud-compute/test/gapic_routers_v1.ts @@ -142,14 +142,60 @@ describe('v1.RoutersClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = routersModule.v1.RoutersClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new routersModule.v1.RoutersClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = routersModule.v1.RoutersClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new routersModule.v1.RoutersClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = routersModule.v1.RoutersClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = routersModule.v1.RoutersClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new routersModule.v1.RoutersClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new routersModule.v1.RoutersClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new routersModule.v1.RoutersClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_routes_v1.ts b/packages/google-cloud-compute/test/gapic_routes_v1.ts index 8ed7b145905..b1428148017 100644 --- a/packages/google-cloud-compute/test/gapic_routes_v1.ts +++ b/packages/google-cloud-compute/test/gapic_routes_v1.ts @@ -142,14 +142,60 @@ describe('v1.RoutesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = routesModule.v1.RoutesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new routesModule.v1.RoutesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = routesModule.v1.RoutesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new routesModule.v1.RoutesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = routesModule.v1.RoutesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = routesModule.v1.RoutesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new routesModule.v1.RoutesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new routesModule.v1.RoutesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new routesModule.v1.RoutesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_security_policies_v1.ts b/packages/google-cloud-compute/test/gapic_security_policies_v1.ts index abef80eb7c6..bc2e069a8b1 100644 --- a/packages/google-cloud-compute/test/gapic_security_policies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_security_policies_v1.ts @@ -142,16 +142,62 @@ describe('v1.SecurityPoliciesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - securitypoliciesModule.v1.SecurityPoliciesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new securitypoliciesModule.v1.SecurityPoliciesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - securitypoliciesModule.v1.SecurityPoliciesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new securitypoliciesModule.v1.SecurityPoliciesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + securitypoliciesModule.v1.SecurityPoliciesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + securitypoliciesModule.v1.SecurityPoliciesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new securitypoliciesModule.v1.SecurityPoliciesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new securitypoliciesModule.v1.SecurityPoliciesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new securitypoliciesModule.v1.SecurityPoliciesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_service_attachments_v1.ts b/packages/google-cloud-compute/test/gapic_service_attachments_v1.ts index 407c3059b56..9d1836b4a69 100644 --- a/packages/google-cloud-compute/test/gapic_service_attachments_v1.ts +++ b/packages/google-cloud-compute/test/gapic_service_attachments_v1.ts @@ -142,16 +142,62 @@ describe('v1.ServiceAttachmentsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - serviceattachmentsModule.v1.ServiceAttachmentsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new serviceattachmentsModule.v1.ServiceAttachmentsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - serviceattachmentsModule.v1.ServiceAttachmentsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new serviceattachmentsModule.v1.ServiceAttachmentsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + serviceattachmentsModule.v1.ServiceAttachmentsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + serviceattachmentsModule.v1.ServiceAttachmentsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new serviceattachmentsModule.v1.ServiceAttachmentsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new serviceattachmentsModule.v1.ServiceAttachmentsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new serviceattachmentsModule.v1.ServiceAttachmentsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_snapshot_settings_service_v1.ts b/packages/google-cloud-compute/test/gapic_snapshot_settings_service_v1.ts index e79cab3fe55..b63758e7c23 100644 --- a/packages/google-cloud-compute/test/gapic_snapshot_settings_service_v1.ts +++ b/packages/google-cloud-compute/test/gapic_snapshot_settings_service_v1.ts @@ -79,18 +79,68 @@ describe('v1.SnapshotSettingsServiceClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - snapshotsettingsserviceModule.v1.SnapshotSettingsServiceClient - .servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = + new snapshotsettingsserviceModule.v1.SnapshotSettingsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - snapshotsettingsserviceModule.v1.SnapshotSettingsServiceClient - .apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = + new snapshotsettingsserviceModule.v1.SnapshotSettingsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + snapshotsettingsserviceModule.v1.SnapshotSettingsServiceClient + .servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + snapshotsettingsserviceModule.v1.SnapshotSettingsServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new snapshotsettingsserviceModule.v1.SnapshotSettingsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new snapshotsettingsserviceModule.v1.SnapshotSettingsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new snapshotsettingsserviceModule.v1.SnapshotSettingsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_snapshots_v1.ts b/packages/google-cloud-compute/test/gapic_snapshots_v1.ts index 02f25f8f859..2295cb37f43 100644 --- a/packages/google-cloud-compute/test/gapic_snapshots_v1.ts +++ b/packages/google-cloud-compute/test/gapic_snapshots_v1.ts @@ -142,14 +142,60 @@ describe('v1.SnapshotsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = snapshotsModule.v1.SnapshotsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new snapshotsModule.v1.SnapshotsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = snapshotsModule.v1.SnapshotsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new snapshotsModule.v1.SnapshotsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = snapshotsModule.v1.SnapshotsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = snapshotsModule.v1.SnapshotsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new snapshotsModule.v1.SnapshotsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new snapshotsModule.v1.SnapshotsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new snapshotsModule.v1.SnapshotsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_ssl_certificates_v1.ts b/packages/google-cloud-compute/test/gapic_ssl_certificates_v1.ts index ebf171ab556..fe1311ecd28 100644 --- a/packages/google-cloud-compute/test/gapic_ssl_certificates_v1.ts +++ b/packages/google-cloud-compute/test/gapic_ssl_certificates_v1.ts @@ -142,16 +142,62 @@ describe('v1.SslCertificatesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - sslcertificatesModule.v1.SslCertificatesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new sslcertificatesModule.v1.SslCertificatesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - sslcertificatesModule.v1.SslCertificatesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new sslcertificatesModule.v1.SslCertificatesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sslcertificatesModule.v1.SslCertificatesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sslcertificatesModule.v1.SslCertificatesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sslcertificatesModule.v1.SslCertificatesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sslcertificatesModule.v1.SslCertificatesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sslcertificatesModule.v1.SslCertificatesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_ssl_policies_v1.ts b/packages/google-cloud-compute/test/gapic_ssl_policies_v1.ts index 2541e350f7e..b2633774207 100644 --- a/packages/google-cloud-compute/test/gapic_ssl_policies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_ssl_policies_v1.ts @@ -142,14 +142,60 @@ describe('v1.SslPoliciesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = sslpoliciesModule.v1.SslPoliciesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new sslpoliciesModule.v1.SslPoliciesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = sslpoliciesModule.v1.SslPoliciesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new sslpoliciesModule.v1.SslPoliciesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = sslpoliciesModule.v1.SslPoliciesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = sslpoliciesModule.v1.SslPoliciesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sslpoliciesModule.v1.SslPoliciesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sslpoliciesModule.v1.SslPoliciesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sslpoliciesModule.v1.SslPoliciesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_subnetworks_v1.ts b/packages/google-cloud-compute/test/gapic_subnetworks_v1.ts index 1c9b2a4a00d..e122f6cf336 100644 --- a/packages/google-cloud-compute/test/gapic_subnetworks_v1.ts +++ b/packages/google-cloud-compute/test/gapic_subnetworks_v1.ts @@ -142,14 +142,60 @@ describe('v1.SubnetworksClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = subnetworksModule.v1.SubnetworksClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new subnetworksModule.v1.SubnetworksClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = subnetworksModule.v1.SubnetworksClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new subnetworksModule.v1.SubnetworksClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = subnetworksModule.v1.SubnetworksClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = subnetworksModule.v1.SubnetworksClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new subnetworksModule.v1.SubnetworksClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new subnetworksModule.v1.SubnetworksClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new subnetworksModule.v1.SubnetworksClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_target_grpc_proxies_v1.ts b/packages/google-cloud-compute/test/gapic_target_grpc_proxies_v1.ts index 050d8396239..561210586bd 100644 --- a/packages/google-cloud-compute/test/gapic_target_grpc_proxies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_target_grpc_proxies_v1.ts @@ -142,16 +142,62 @@ describe('v1.TargetGrpcProxiesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - targetgrpcproxiesModule.v1.TargetGrpcProxiesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new targetgrpcproxiesModule.v1.TargetGrpcProxiesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - targetgrpcproxiesModule.v1.TargetGrpcProxiesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new targetgrpcproxiesModule.v1.TargetGrpcProxiesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + targetgrpcproxiesModule.v1.TargetGrpcProxiesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + targetgrpcproxiesModule.v1.TargetGrpcProxiesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new targetgrpcproxiesModule.v1.TargetGrpcProxiesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new targetgrpcproxiesModule.v1.TargetGrpcProxiesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new targetgrpcproxiesModule.v1.TargetGrpcProxiesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_target_http_proxies_v1.ts b/packages/google-cloud-compute/test/gapic_target_http_proxies_v1.ts index cdf228a75e6..cc0eb9c0642 100644 --- a/packages/google-cloud-compute/test/gapic_target_http_proxies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_target_http_proxies_v1.ts @@ -142,16 +142,62 @@ describe('v1.TargetHttpProxiesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - targethttpproxiesModule.v1.TargetHttpProxiesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new targethttpproxiesModule.v1.TargetHttpProxiesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - targethttpproxiesModule.v1.TargetHttpProxiesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new targethttpproxiesModule.v1.TargetHttpProxiesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + targethttpproxiesModule.v1.TargetHttpProxiesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + targethttpproxiesModule.v1.TargetHttpProxiesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new targethttpproxiesModule.v1.TargetHttpProxiesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new targethttpproxiesModule.v1.TargetHttpProxiesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new targethttpproxiesModule.v1.TargetHttpProxiesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_target_https_proxies_v1.ts b/packages/google-cloud-compute/test/gapic_target_https_proxies_v1.ts index fad7a977516..30596162d2a 100644 --- a/packages/google-cloud-compute/test/gapic_target_https_proxies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_target_https_proxies_v1.ts @@ -142,16 +142,62 @@ describe('v1.TargetHttpsProxiesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - targethttpsproxiesModule.v1.TargetHttpsProxiesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new targethttpsproxiesModule.v1.TargetHttpsProxiesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - targethttpsproxiesModule.v1.TargetHttpsProxiesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new targethttpsproxiesModule.v1.TargetHttpsProxiesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + targethttpsproxiesModule.v1.TargetHttpsProxiesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + targethttpsproxiesModule.v1.TargetHttpsProxiesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new targethttpsproxiesModule.v1.TargetHttpsProxiesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new targethttpsproxiesModule.v1.TargetHttpsProxiesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new targethttpsproxiesModule.v1.TargetHttpsProxiesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_target_instances_v1.ts b/packages/google-cloud-compute/test/gapic_target_instances_v1.ts index 264cbc4ddbd..354bcb44264 100644 --- a/packages/google-cloud-compute/test/gapic_target_instances_v1.ts +++ b/packages/google-cloud-compute/test/gapic_target_instances_v1.ts @@ -142,16 +142,62 @@ describe('v1.TargetInstancesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - targetinstancesModule.v1.TargetInstancesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new targetinstancesModule.v1.TargetInstancesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - targetinstancesModule.v1.TargetInstancesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new targetinstancesModule.v1.TargetInstancesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + targetinstancesModule.v1.TargetInstancesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + targetinstancesModule.v1.TargetInstancesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new targetinstancesModule.v1.TargetInstancesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new targetinstancesModule.v1.TargetInstancesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new targetinstancesModule.v1.TargetInstancesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_target_pools_v1.ts b/packages/google-cloud-compute/test/gapic_target_pools_v1.ts index cdbb3f030e0..f2ae2b41d11 100644 --- a/packages/google-cloud-compute/test/gapic_target_pools_v1.ts +++ b/packages/google-cloud-compute/test/gapic_target_pools_v1.ts @@ -142,14 +142,60 @@ describe('v1.TargetPoolsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = targetpoolsModule.v1.TargetPoolsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new targetpoolsModule.v1.TargetPoolsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = targetpoolsModule.v1.TargetPoolsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new targetpoolsModule.v1.TargetPoolsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = targetpoolsModule.v1.TargetPoolsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = targetpoolsModule.v1.TargetPoolsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new targetpoolsModule.v1.TargetPoolsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new targetpoolsModule.v1.TargetPoolsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new targetpoolsModule.v1.TargetPoolsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_target_ssl_proxies_v1.ts b/packages/google-cloud-compute/test/gapic_target_ssl_proxies_v1.ts index 446493498a0..64e811e8178 100644 --- a/packages/google-cloud-compute/test/gapic_target_ssl_proxies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_target_ssl_proxies_v1.ts @@ -142,16 +142,62 @@ describe('v1.TargetSslProxiesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - targetsslproxiesModule.v1.TargetSslProxiesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new targetsslproxiesModule.v1.TargetSslProxiesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - targetsslproxiesModule.v1.TargetSslProxiesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new targetsslproxiesModule.v1.TargetSslProxiesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + targetsslproxiesModule.v1.TargetSslProxiesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + targetsslproxiesModule.v1.TargetSslProxiesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new targetsslproxiesModule.v1.TargetSslProxiesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new targetsslproxiesModule.v1.TargetSslProxiesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new targetsslproxiesModule.v1.TargetSslProxiesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_target_tcp_proxies_v1.ts b/packages/google-cloud-compute/test/gapic_target_tcp_proxies_v1.ts index 94ed2a922b6..32d9817ded6 100644 --- a/packages/google-cloud-compute/test/gapic_target_tcp_proxies_v1.ts +++ b/packages/google-cloud-compute/test/gapic_target_tcp_proxies_v1.ts @@ -142,16 +142,62 @@ describe('v1.TargetTcpProxiesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - targettcpproxiesModule.v1.TargetTcpProxiesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new targettcpproxiesModule.v1.TargetTcpProxiesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - targettcpproxiesModule.v1.TargetTcpProxiesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new targettcpproxiesModule.v1.TargetTcpProxiesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + targettcpproxiesModule.v1.TargetTcpProxiesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + targettcpproxiesModule.v1.TargetTcpProxiesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new targettcpproxiesModule.v1.TargetTcpProxiesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new targettcpproxiesModule.v1.TargetTcpProxiesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new targettcpproxiesModule.v1.TargetTcpProxiesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_target_vpn_gateways_v1.ts b/packages/google-cloud-compute/test/gapic_target_vpn_gateways_v1.ts index 9f16672ec53..8f0dc7902cc 100644 --- a/packages/google-cloud-compute/test/gapic_target_vpn_gateways_v1.ts +++ b/packages/google-cloud-compute/test/gapic_target_vpn_gateways_v1.ts @@ -142,16 +142,62 @@ describe('v1.TargetVpnGatewaysClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - targetvpngatewaysModule.v1.TargetVpnGatewaysClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new targetvpngatewaysModule.v1.TargetVpnGatewaysClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - targetvpngatewaysModule.v1.TargetVpnGatewaysClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new targetvpngatewaysModule.v1.TargetVpnGatewaysClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + targetvpngatewaysModule.v1.TargetVpnGatewaysClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + targetvpngatewaysModule.v1.TargetVpnGatewaysClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new targetvpngatewaysModule.v1.TargetVpnGatewaysClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new targetvpngatewaysModule.v1.TargetVpnGatewaysClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new targetvpngatewaysModule.v1.TargetVpnGatewaysClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_url_maps_v1.ts b/packages/google-cloud-compute/test/gapic_url_maps_v1.ts index 052dc1a243c..e0abc071fd5 100644 --- a/packages/google-cloud-compute/test/gapic_url_maps_v1.ts +++ b/packages/google-cloud-compute/test/gapic_url_maps_v1.ts @@ -142,14 +142,60 @@ describe('v1.UrlMapsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = urlmapsModule.v1.UrlMapsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new urlmapsModule.v1.UrlMapsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = urlmapsModule.v1.UrlMapsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new urlmapsModule.v1.UrlMapsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = urlmapsModule.v1.UrlMapsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = urlmapsModule.v1.UrlMapsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new urlmapsModule.v1.UrlMapsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new urlmapsModule.v1.UrlMapsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new urlmapsModule.v1.UrlMapsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_vpn_gateways_v1.ts b/packages/google-cloud-compute/test/gapic_vpn_gateways_v1.ts index e6c2bcaa844..97151551783 100644 --- a/packages/google-cloud-compute/test/gapic_vpn_gateways_v1.ts +++ b/packages/google-cloud-compute/test/gapic_vpn_gateways_v1.ts @@ -142,14 +142,60 @@ describe('v1.VpnGatewaysClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = vpngatewaysModule.v1.VpnGatewaysClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new vpngatewaysModule.v1.VpnGatewaysClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = vpngatewaysModule.v1.VpnGatewaysClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new vpngatewaysModule.v1.VpnGatewaysClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = vpngatewaysModule.v1.VpnGatewaysClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = vpngatewaysModule.v1.VpnGatewaysClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new vpngatewaysModule.v1.VpnGatewaysClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new vpngatewaysModule.v1.VpnGatewaysClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new vpngatewaysModule.v1.VpnGatewaysClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_vpn_tunnels_v1.ts b/packages/google-cloud-compute/test/gapic_vpn_tunnels_v1.ts index 5447e40f75e..227bb7bf330 100644 --- a/packages/google-cloud-compute/test/gapic_vpn_tunnels_v1.ts +++ b/packages/google-cloud-compute/test/gapic_vpn_tunnels_v1.ts @@ -142,14 +142,60 @@ describe('v1.VpnTunnelsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = vpntunnelsModule.v1.VpnTunnelsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new vpntunnelsModule.v1.VpnTunnelsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = vpntunnelsModule.v1.VpnTunnelsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new vpntunnelsModule.v1.VpnTunnelsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = vpntunnelsModule.v1.VpnTunnelsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = vpntunnelsModule.v1.VpnTunnelsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new vpntunnelsModule.v1.VpnTunnelsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new vpntunnelsModule.v1.VpnTunnelsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new vpntunnelsModule.v1.VpnTunnelsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_zone_operations_v1.ts b/packages/google-cloud-compute/test/gapic_zone_operations_v1.ts index ec6f35991f1..858e152f66e 100644 --- a/packages/google-cloud-compute/test/gapic_zone_operations_v1.ts +++ b/packages/google-cloud-compute/test/gapic_zone_operations_v1.ts @@ -142,16 +142,62 @@ describe('v1.ZoneOperationsClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = - zoneoperationsModule.v1.ZoneOperationsClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new zoneoperationsModule.v1.ZoneOperationsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = - zoneoperationsModule.v1.ZoneOperationsClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new zoneoperationsModule.v1.ZoneOperationsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + zoneoperationsModule.v1.ZoneOperationsClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + zoneoperationsModule.v1.ZoneOperationsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new zoneoperationsModule.v1.ZoneOperationsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new zoneoperationsModule.v1.ZoneOperationsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new zoneoperationsModule.v1.ZoneOperationsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => { diff --git a/packages/google-cloud-compute/test/gapic_zones_v1.ts b/packages/google-cloud-compute/test/gapic_zones_v1.ts index 30fd64c2d66..2a8434bb466 100644 --- a/packages/google-cloud-compute/test/gapic_zones_v1.ts +++ b/packages/google-cloud-compute/test/gapic_zones_v1.ts @@ -142,14 +142,60 @@ describe('v1.ZonesClient', () => { sinon.restore(); }); describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = zonesModule.v1.ZonesClient.servicePath; - assert(servicePath); + it('has apiEndpoint', () => { + const client = new zonesModule.v1.ZonesClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); }); - it('has apiEndpoint', () => { - const apiEndpoint = zonesModule.v1.ZonesClient.apiEndpoint; - assert(apiEndpoint); + it('has universeDomain', () => { + const client = new zonesModule.v1.ZonesClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process !== 'undefined' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = zonesModule.v1.ZonesClient.servicePath; + assert.strictEqual(servicePath, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = zonesModule.v1.ZonesClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new zonesModule.v1.ZonesClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new zonesModule.v1.ZonesClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'compute.example.com'); + }); + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new zonesModule.v1.ZonesClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); }); it('has port', () => {